xsl-list
[Top] [All Lists]

AW: [xsl] copy-of converts hex to decimal

2009-10-08 07:31:45
thanks, that makes sense. so it's a matter of serialization



----- Ursprüngliche Mail ----
Von: Martin Honnen <Martin(_dot_)Honnen(_at_)gmx(_dot_)de>
An: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Gesendet: Donnerstag, den 8. Oktober 2009, 11:55:26 Uhr
Betreff: Re: [xsl] copy-of converts hex to decimal

Matthias Müller wrote:

can someone explain why xsl:copy-of converts hex values to decimal?
e.g. the node:

<HexDecTest>
    <Hex>&#x2160;</Hex>
    <Dez>Ⅰ</Dez>
</HexDecTest>

is processed to:

<Result>
   <Hex>Ⅰ</Hex>
   <Dez>Ⅰ</Dez>
</Result>

using this template:

<xsl:template match="HexDecTest">
        <xsl:element name="Result">
            <xsl:copy-of select="Hex"/>
            <xsl:copy-of select="Dez"/>
        </xsl:element>
</xsl:template>

i expected the hex value unchanged,

XSLT works on the XSLT/XPath data model, a tree model. In that model the Hex 
and the Dez elements have a text node with character data of Unicode characters 
as a child. The input tree is transformed to a result tree, again with text 
nodes of Unicode characters.

That result tree can then be serialized and only then you might get characters 
escaped, for instance when you have specified an output encoding in which the 
characters can not be directly represented. Your serializer has choosen decimal 
numbers for escaping.

So the main point is that XSLT does not operate on the markup representation of 
the input and xsl:copy-of certainly is not a way to copy the markup in the 
input literally to the output. XSLT operates on a tree often created by parsing 
an XML document and then creates a result tree and optionally serializes that 
result tree, often as XML.


-- 
    Martin Honnen
    http://msmvps.com/blogs/martin_honnen/

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--




--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>