-----Original Message-----
From: owner-xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
[mailto:owner-xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com] On Behalf Of
Nick Laqua
Sent: 12 August 2003 16:35
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] side effects when debugging
Hi everybody,
I hope I don't mention a known problem though I checked the xsl faq
and the list archives.
I experienced strange behaviour depending on the debug
settings of the
processor (see processor version below).
Vendor: Apache Software Foundation
Vendor URL: http://xml.apache.org/xalan-j
I am using the following stylesheet:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0" indent="yes"/>
<xsl:template match="D">
<xsl:for-each select="A">
<xsl:sort select="POSITION" data-type="number"
order="ascending"/>
<xsl:element name="PositionNr">
<xsl:value-of select="POSITION"/>
</xsl:element>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
The input file looks like this:
<?xml version = "1.0" encoding = "ISO-8859-1"?>
<D>
<A>
<POSITION>5</POSITION>
<ACTION>1</ACTION>
</A>
<A>
<POSITION>1</POSITION>
<ACTION>1</ACTION>
</A>
<A>
<POSITION>3</POSITION>
<ACTION>1</ACTION>
</A>
</D>
Without debugging options (command line inline), the result
looks like
this (obviously correct):
t:/Programme/JRE/1.4.1/bin/java.exe -cp
d:/cvsworking/nl/dev/classes/xalan.jar
org.apache.xalan.xslt.Process -in
d:/cvsworking/nl/dev/java/newtron/system/impl/a2a/std/ressourc
es/mapping/test/xml/test_sort.xml
-xsl
d:/cvsworking/nl/dev/java/newtron/system/impl/a2a/std/ressourc
es/mapping/test/xslt/test_sort.xslt
<?xml version="1.0" encoding="UTF-8"?>
<PositionNr>1</PositionNr>
<PositionNr>3</PositionNr>
<PositionNr>5</PositionNr>
But enabling debugging (for instance trace selection events = -TS),
the result is different (though using the same input):
t:/Programme/JRE/1.4.1/bin/java.exe -cp
d:/cvsworking/nl/dev/classes/xalan.jar
org.apache.xalan.xslt.Process -TS -in
d:/cvsworking/nl/dev/java/newtron/system/impl/a2a/std/ressourc
es/mapping/test/xml/test_sort.xml
-xsl
d:/cvsworking/nl/dev/java/newtron/system/impl/a2a/std/ressourc
es/mapping/test/xslt/test_sort.xslt
<?xml version="1.0" encoding="UTF-8"?>
<PositionNr>1</PositionNr>
<PositionNr>3</PositionNr>
<PositionNr>5</PositionNr>
<PositionNr>5</PositionNr>
<PositionNr>1</PositionNr>
<PositionNr>3</PositionNr>
As you can see, in the second case, firstly all nodes are sorted
correctly, but additional the same nodes are added in
document order.
Is this a "design mistake" by me or a bug/something
specific to xalan
? In this case, I might post it to some xalan list.
Thx a lot in advance
Cheers Nick
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list