Printing out variables with escaped text.
I'm having a problem printing out variables that contain text declared with disable-output-escaping="yes" (and yes, I'm doing dodgy stuff, trying to create start and end tags where I shouldn't, before anyone tells me I shouldn't be doing this.) Consider the following stylesheet - it surprised me that this didn't work. --- START <?xml version="1.0"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:output method="html" /> <xsl:template match="/"> <xsl:variable name="bob"> <xsl:text><fake_element_no_escaping> </xsl:text> <xsl:text disable-output-escaping="yes"><fake_element_escaping> </xsl:text> </xsl:variable> <xsl:value-of select="$bob" /> </xsl:template> </xsl:stylesheet> --- END The output from both Saxon and Xalan was (actually Saxon didn't bother escaping the >'s, but that's OK for now.) <fake_element_no_escaping> <fake_element_escaping> So I pulled out the spec and it suggested using <xsl:copy-of> instead of <xsl:value-of>. So I tried that and got : Saxon: <fake_element_no_escaping> <fake_element_escaping> Xalan: <fake_element_no_escaping> <fake_element_escaping> which is what I originally wanted. It's getting pretty hard to find bugs in Saxon nowadays, so I thought I'd post this to list instead of straight to Mike, to see if anyone had any thoughts on what is the correct behaviour here - the spec doesn't appear to address this issue specifically. Any comments? Thanks. -- Warren Hedley Department of Engineering Science Auckland University New Zealand XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format