Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: xsl:copy-of does not preserve disable-output-escaping

From: shurik@-----------.---------.---
To: NULL
Date: 2/5/2007 11:42:00 PM

Thank you for your reply, 

It looks like <xsl:text>&_#_0_1_6_0_;</txsl:text> works for me (underscores 
added to prevent encoding within the forum post)

But I am not sure I understand why and how it works. 
What I need is to output the "No-Break Space" character to HTML (in the 
manner I described anove, a temporary tree is generated first and then copied 
to ouput). 
Which encoding should I specify in XML declaration\xsl:output directives to 
be sure it will work everywhere? Are there other possible issues with this 
solution?


"Oleg Tkachenko [MVP]" wrote:

> shurik wrote:
> > Here is an example, there is a text node within a variable A. The textnode 
> > has disable-output-escaping="yes". I need to ouput the variable A into the 
> > result tree preserving the disable-ouput-escaping setting. 
> > 
> > This template:
> > 
> > <xsl:stylesheet version="1.0" 
> > xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
> > xmlns:msxsl="urn:schemas-microsoft-com:xslt" >
> > 	<xsl:template match="/">
> > 		<xsl:variable name="A">
> > 			<xsl:text disable-output-escaping="yes"> </xsl:text>
> > 		</xsl:variable>
> > 		<xsl:copy-of select="msxsl:node-set($A)"/>
> > 	</xsl:template>
> > </xsl:stylesheet>
> > 
> > produces " " but I need " "
> 
> Why don't you just use <xsl:text>0xA0;</xsl:text> ?
> 
> To your question - XSLT spec doesn't allow such tricks:
> 
> "It is an error for output escaping to be disabled for a text node that 
> is used for something other than a text node in the result tree. Thus, 
> it is an error to disable output escaping for an xsl:value-of or 
> xsl:text element that is used to generate the string-value of a comment, 
> processing instruction or attribute node; it is also an error to convert 
> a result tree fragment to a number or a string if the result tree 
> fragment contains a text node for which escaping was disabled. "
> 
> In short - disable-output-escaping is output serialization feature and 
> definitely won't work inside transformation.
> 
> -- 
> Oleg Tkachenko [XML MVP, MCPD]
> http://blog.tkachenko.com | http://www.XmlLab.Net | http://www.XLinq.Net
> 


transparent
Print
Mail
Digg
delicious
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent