0

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.

2

1 Answer 1

2

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.