Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

XML File

<article>
    <paragraph>
        Stack Overflow is a question and answer site for
        &lt;b&gt;professional&lt;/b&gt; and enthusiast programmers.
    </paragraph>
</article>

HTML output

Stack Overflow is a question and answer site for professional and enthusiast programmers.

Question:

I want to transform &lt;b&gt; to the HTML element <b> using XSLT. Please suggest any XSLT code.

share|improve this question
    
Please don't add thanks and hello messages, we'd like to see your question only. Thanks! :) –  Ian Carroll Jun 20 '13 at 19:50
    
Possible duplicate of How to unescape XML characters with help of XSLT? –  nwellnhof Jun 20 '13 at 20:19

1 Answer 1

It's bad XML design, of course, to include an escaped XML document embedded in another document like this. But it happens all the time. If the escaped tags are HTML and you want to copy them direct to the output, then disable-output-escaping will sometimes do the trick - but not always, because it only works when you are serializing. If you run an XSLT transformation in Mozilla then the output HTML is rendered without ever being serialized, so disable-output-escaping has no effect. XSLT pros therefore tend to discourage its use.

The better approach is to reparse the text that contains escaped tags. There's no standard way of doing this until XSLT 3.0 (which has a parse-xml() function), but you can often do it using extension functions.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.