[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: output an apostrophe
[ aruniima.chakrabarti] > but meanwhile I came with the problem that what if I want to > output the string > child::*[name()='label']/@val_id > on screen... Sometimes the results can depend on the serializer that the xslt processor uses. For example, if the serializer normally places double quotes around an attribute value, then when it encounters double quotes within an attribute value it has to escape them. You may have encountered this behavior. One way around this can be to use the other type of quote to embed in your values. Then the serializer does not need to escape them. A smarter serializer might insepct the attribute value first to figure out what kind of quotes to use to avoid having to escape them. For example, with my copy of Saxon, I get these results - <xsl:template match="/root"> <element type=' "xxx" '/> </xsl:template> Result - <Saxon) <element type=" "xxx" "/> <Xalan) <element type=" "xxx" "/> (MSXSML3) <element type=" "xxx" " /> (XT) <element type=" "xxx" "/> <xsl:template match="/root"> <element type=" 'xxx' "/> </xsl:template> Result - (Saxon, MSXML3, XALAN,XT) <element type=" 'xxx' "/> On the other hand, for many or most purposes, it does not matter if the quotes are escaped. For example, the following generates the expected output: <name select="{"xxx"}"/> And so does the following: <xsl:template match="/"> <name> <xsl:value-of select="name(*[name()="root"])"/> </name> </xsl:template> This is to be expected since the parser will replace the character references or entities with their replacement values before the xslt processor sees them. Cheers, Tom P 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
|