By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
449,145 Members | 1,135 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 449,145 IT Pros & Developers. It's quick & easy.

Displaying embedded html from an xml file through an xsl stylesheet

P: n/a
Hi chaps

I've got an XML file, within that file i've embedded html code using
the
<![CDATA[ ]]>
tag

I'm displaying that xml file through a browser using an xsl style
sheet. However it is displaying any html from the xml file as text,
ie its displaying as text <br/> and <b> etc

How can i tell my xml file to display the html tags as html and not
display them as text?

Many thanks
Jul 20 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
"Joe Price" <jo*****@hotmail.com> wrote in message
news:e0**************************@posting.google.c om
I've got an XML file, within that file i've embedded html code using
the <![CDATA[ ]]> tag

I'm displaying that xml file through a browser using an xsl style
sheet. However it is displaying any html from the xml file as text,
ie its displaying as text <br/> and <b> etc


Sure, because the XSL Processor correctly escapes these tags, so they do
not lose their (in this case textual) meaning in HTML.
What you have to do is prevent this process called "output-escaping"
from happening.

When you have
<native>
<![CDATA[<p>Hallo</p><br><b>test</b>]]>
</native>

then this does the trick:
<xsl:template match="native">
<xsl:value-of disable-output-escaping="yes" select="."/>
</xsl:template>

HTH Martin
Jul 20 '05 #2

P: n/a
cheers bud, worked a treat
"Martin Boehm" <ng********@arcor.de> wrote in message news:<3f***********************@newsread2.arcor-online.net>...
"Joe Price" <jo*****@hotmail.com> wrote in message
news:e0**************************@posting.google.c om
I've got an XML file, within that file i've embedded html code using
the <![CDATA[ ]]> tag

I'm displaying that xml file through a browser using an xsl style
sheet. However it is displaying any html from the xml file as text,
ie its displaying as text <br/> and <b> etc


Sure, because the XSL Processor correctly escapes these tags, so they do
not lose their (in this case textual) meaning in HTML.
What you have to do is prevent this process called "output-escaping"
from happening.

When you have
<native>
<![CDATA[<p>Hallo</p><br><b>test</b>]]>
</native>

then this does the trick:
<xsl:template match="native">
<xsl:value-of disable-output-escaping="yes" select="."/>
</xsl:template>

HTH Martin

Jul 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.