Hi Nick, You appear to be describing bug 16222, which has been fixed. Please try the latest version of Xalan. I noticed you're using JDK 1.4 so please also note this FAQ entry: http://xml.apache.org/xalan-j/faq.html#faq-N100CB on how to use the latest Xalan version with your JDK.
If you're still getting an incorrect result with the latest version, please open a bugzilla report and attach a test case. Thanks! Gordon On Wed, 13 Aug 2003, Nick Laqua wrote: > > 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/ressources/mapping/test/xml/test_sort.xml > > -xsl > > d:/cvsworking/nl/dev/java/newtron/system/impl/a2a/std/ressources/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/ressources/mapping/test/xml/test_sort.xml > > -xsl > > d:/cvsworking/nl/dev/java/newtron/system/impl/a2a/std/ressources/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 (xslt) or a bug/something specific to > > xalan ? > > > > Thx a lot in advance > > > > Cheers Nick >