471,594 Members | 1,705 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,594 software developers and data experts.

xsltransform replaces "<" with entities

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
4 1877


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
| 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
Got it...

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


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.

Similar topics

5 posts views Thread by Jonny T | last post: by
12 posts views Thread by aa | last post: by
5 posts views Thread by Eric A. Forgy | last post: by
1 post views Thread by Christian Schmidbauer | last post: by
7 posts views Thread by Diandian Zhang | last post: by
reply views Thread by XIAOLAOHU | last post: by
reply views Thread by leo001 | last post: by
reply views Thread by Anwar ali | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.