Pre-format text in an XML file

G

Guest

I have text in an xml file which I wish to pre-format before it is read into
an xsl document and displayed in an xml control. In the xml file I have
something like this:

<section><![CDATA[<h1> first message</h1> second message <b> third
message</b>]]>

However, when it is rendered on the page it appears like this:

<h1> first message</h1> second message <b> third message</b>

I need it to be rendered as html when the page is displayed. Any ideas?
 
M

Martin Honnen

cashdeskmac said:
I have text in an xml file which I wish to pre-format before it is read into
an xsl document and displayed in an xml control. In the xml file I have
something like this:

<section><![CDATA[<h1> first message</h1> second message <b> third
message</b>]]>

However, when it is rendered on the page it appears like this:

<h1> first message</h1> second message <b> third message</b>

I need it to be rendered as html when the page is displayed. Any ideas?

If you are using XSLT then you would need e.g.
<xsl:template match="section">
<xsl:value-of select="." disable-output-escaping="yes" />
</xsl:template>
to make sure the tags in the CDATA section are not escaped.
 
G

Guest

Many thanks, Martin, that is perfect.

Martin Honnen said:
I have text in an xml file which I wish to pre-format before it is read into
an xsl document and displayed in an xml control. In the xml file I have
something like this:

<section><![CDATA[<h1> first message</h1> second message <b> third
message</b>]]>

However, when it is rendered on the page it appears like this:

<h1> first message</h1> second message <b> third message</b>

I need it to be rendered as html when the page is displayed. Any ideas?

If you are using XSLT then you would need e.g.
<xsl:template match="section">
<xsl:value-of select="." disable-output-escaping="yes" />
</xsl:template>
to make sure the tags in the CDATA section are not escaped.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top