You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by "Son, G.J. van" <va...@WT.TNO.NL> on 2000/12/28 16:32:40 UTC

"Off by one" bug in xsl:copy-of function in Xalan-C

Hi all,

I am trying out the TestXSLT.exe utility on a Windows NT platform,
using Xalan-C++ version 1.0 and Xerces-C++ Parser version 1.3.0.
When running 'TestXSLT -in err.xml -xsl err.xsl -xml -out out.xml'
I got following output file in which the ID's seem to have been shifted.

I could think of a workaround in this case, but we use the 'xsl:copy-of'
function also in other sections where workarounds are not so obvious.
Is this a bug I stumbled upon, or am I missing something?

Thanks in advance for any insights, Gertjan.


----------------- Output file 'out.xml' ------------------------
<?xml version="1.0" encoding="UTF-8"?>
<TESSIE>
	<MODEL/>
	<MODEL ID="100000"/>
	<MODEL ID="2"/>
</TESSIE>
-----------------------------------------------------------------

----------------- XML inputfile 'err.xml' -----------------------
<?xml version="1.0"?>
<TEST RELEASE="R6.0">
	<ELEMENT ID="100000"/>
	<ELEMENT ID="2"/>
	<ELEMENT ID="33333"/>
</TEST>
--------------------------------------------------------

----------------- XSL file 'err.xsl' -----------------------------
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
     <xsl:output indent="yes" method="xml" version="1.0"/>
 
     <xsl:template match="TEST" mode ="child">
        <xsl:apply-templates/>
     </xsl:template>

     <xsl:template match="TEST">
        <xsl:element name="TESSIE">
           <xsl:apply-templates select="." mode="child"/>
        </xsl:element>
     </xsl:template>

     <xsl:template match="ELEMENT">
        <xsl:element name="MODEL">
           <xsl:copy-of select="@ID"/>
        </xsl:element>
        <xsl:apply-templates/>
     </xsl:template>

</xsl:stylesheet>
--------------------------------------------------------