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

xsltransform replaces "<" with entities

P: n/a
Hello NG!

Within a xsl-stylesheet I have an element

<xsl:text><![CDATA[...<br>...]]></xsl:text>

If I use that stylesheet to transform some xml-data (to html) with

....
pOut = New System.IO.StringWriter
pXslt.Load(strStylesheetFile)
pXslt.Transform(pXPathNav, Nothing, pOut, Nothing)
....

then in the result-document the brackets are replaced with the
html-entities, so I get

....&lt;br&gt...

But I need the brackets, so that it is a html-tag!!!

What do I have to write into my xsl-stylesheet or is there a special option
for the xsltransform I have to set?

Thanks, D.Barisch
Nov 12 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a


Daniel Barisch wrote:

Within a xsl-stylesheet I have an element

<xsl:text><![CDATA[...<br>...]]></xsl:text>

If I use that stylesheet to transform some xml-data (to html) with

...
pOut = New System.IO.StringWriter
pXslt.Load(strStylesheetFile)
pXslt.Transform(pXPathNav, Nothing, pOut, Nothing)
...

then in the result-document the brackets are replaced with the
html-entities, so I get

...&lt;br&gt...

But I need the brackets, so that it is a html-tag!!!


Then don't use <xsl:text> and a CDATA to create the element but a
literal result element e.g.
<br />
and it will be happily transformed to
<br>
if you chose html as the output method.

--

Martin Honnen
http://JavaScript.FAQTs.com/

Nov 12 '05 #2

P: n/a
| Then don't use <xsl:text> and a CDATA to create the element but a
| literal result element e.g.
| <br />
| and it will be happily transformed to
| <br>

That does not work, because the "<br>" only is a part of the text of the
<xsl:text>-element. It creates a string (script-code!), that is later parsed
and executed by an other procedure of my application, before the final
html-page is viewed. So the transform-result is a kind of template, that
includes many "<br>"-tags and I don't really like to cut the text in little
pieces.

| if you chose html as the output method.

Maybe I only have to set this. I'll give it a try...

Thanks, D.Barisch
Nov 12 '05 #3

P: n/a
Got it...

<xsl:text disable-output-escaping="yes"><![CDATA[...<br>...")}]]></xsl:text>
Nov 12 '05 #4

P: n/a


Daniel Barisch wrote:
Got it...

<xsl:text disable-output-escaping="yes"><![CDATA[...<br>...")}]]></xsl:text>


Be warned that that doesn't work in all environments, it is an optional
feature as
http://www.w3.org/TR/xslt#disable-output-escaping
says and usually there are other ways to solve the problem, in this case
certainly to include an element directly if you want an element in the
output.

--

Martin Honnen
http://JavaScript.FAQTs.com/

Nov 12 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.