[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] disable-output-encoding with xsl:copy
Hi all-
I am using Saxon 6.5.5 with XSLT version 1.1. I'm currently working on a transformation which utilizes the identity template to perform a deep copy of all nodes in a set with the exception of one certain type of node ('graphic') and any of its descendants. These nodes are handled separately in their own template. The input and output is XML, with some HTML character codes contained within the text of the nodes being copied. The structural bit copies just fine, with content and attributes showing up on the other side as well. The only issue I'm having is with certain HTML character codes (e.g. '“'). These seem to be getting encoded(decoded?) during the transformation. I want to preserve the character codes without specifying the xsl:output method as "html". Below is the relevant template along with the input and output for a sample node: <xsl:template mode="copy" match="@*|node()"> <xsl:if test="not(ancestor::graphic)"> <xsl:copy> <xsl:copy-of select="@*"/> <xsl:apply-templates mode="copy"/> </xsl:copy> </xsl:if> </xsl:template> input: <p>“You can’t always get what you want…”</p> output: <p>You cant always get what you want</p> I would like the text content of the output to exactly match the content of the input. I have tried this alternate method but run into the same problem with the added effect of generating a ton of 'invalid element name' errors: <xsl:template mode="copy" match="node()"> <xsl:if test="not(ancestor::graphic)"> <xsl:element name="name(.)" namespace="namespace-uri(.)"> <xsl:copy-of select="@*"/> <xsl:value-of select="text()" disable-output- escaping="yes"/> <xsl:apply-templates mode="copy"/> </xsl:element> </xsl:if> </xsl:template> Any help would be appreciated! -Robert
|
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
|