[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

disable-output-encoding with xsl:copy

Subject: disable-output-encoding with xsl:copy
From: Robert Capasso <rcapasso@xxxxxxxxxxxxx>
Date: Mon, 30 Apr 2007 18:30:23 -0400
 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. '&#8220;').  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>&#8220;You can&#8217;t always get what you
want&#8230;&#8221;</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

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.