Project

Profile

Help

disable-output-escaping option in XSLT 2.0

Added by Anonymous about 17 years ago

Legacy ID: #4201064 Legacy Poster: khill (deepyellow)

The following code snippet for outputing "&nbsp;" literally to an xhtml file does not appear to work in version 8.9. Is this an intentional change for XSLT 1.0? <xsl:text disable-output-escaping="yes"><![CDATA[&nbsp;]]></xsl:text> The output generated is: &amp;nbsp; Thanks, Ken


Replies (2)

RE: disable-output-escaping option in XSLT 2. - Added by Anonymous about 17 years ago

Legacy ID: #4201109 Legacy Poster: Michael Kay (mhkay)

It works for me. Stylesheet test.xsl: <xsl:stylesheet version = "2.0" xmlns:xsl = "http://www.w3.org/1999/XSL/Transform" > <xsl:template name="main" > <a><xsl:text disable-output-escaping="yes"><![CDATA[&nbsp;]]></xsl:text></a> </xsl:template> </xsl:stylesheet> Command line: java net.sf.saxon.Transform -it main test.xsl Output: <?xml version="1.0" encoding="UTF-8"?><a>&nbsp;</a> Not that I would recommend this practice. The best way to output a NBSP character is simply to write &#xa0; and if you are really concerned to have it represented as an entity reference, use encoding="us-ascii" in your xsl:output. Michael Kay

RE: disable-output-escaping option in XSLT 2.0 - Added by Anonymous about 17 years ago

Legacy ID: #4201574 Legacy Poster: khill (deepyellow)

Curiouser and curiouser! I tried your example, and got the processing instruction followed by several pages of newlines. The entity was nowhere to be seen. The method you suggested works for me, so unless you'll like to explore this more, I'm able to move on. Thanks! -Ken

    (1-2/2)

    Please register to reply