Hi, I'd like to report two bugs and one case where I'm not quite sure, wether this is a bug. I'm sending this to both xerces-dev and xalan-dev because I'm not quite sure in each case which one is concerned.
All files to reproduce these effects are attached. These bugs occur using various Java virtual machines (Blackdown JDK 1.1.8, Sun J2SE 1.3.1, IBM Java2) Bug 1: ------ (1) decimal point in wrong position (2) selection of other symbol for decimal point doesn't work Buggy behavior: Using: xerces.jar, xalan.jar: xerces: 1.3.1, 1.4 xalan: 2.0.1, 2.1.0 (CVS) Command: java org.apache.xalan.xslt.Process -IN bug1.xml -XSL bug1.xsl Result: 1.22 Using other tool, correct behavior: Using: xp.jar, xt.jar: Command: java com.jclark.xsl.sax.Driver bug1.xml bug1.xsl Result: 122,26 Bug 2: ------ (1) xerces 2.0.0-alpha neither accepts files with version attribute in xsl:stylesheet nor without (2) other versions of xerces accept both Example Files: (a) bug2a.xsl is correct, no output (b) bug2b.xsl is not correct, attribute version missing in xsl:stylesheet otherwise identical to bug2a.xsl Buggy behavior: Using: xerces.jar, xalan.jar: xerces: 2.0.0-alpha (CVS) xalan: 2.0.1, 2.1.0 (CVS) Command: java org.apache.xalan.xslt.Process -IN bug2a.xml -XSL bug2a.xsl Result: bug2a.xsl; Line 2; Column 36; XSLT Error (javax.xml.transform.TransformerConfigurationException): "version" attribute is not allowed on the xsl:stylesheet element! Command: java org.apache.xalan.xslt.Process -IN bug2b.xml -XSL bug2b.xsl Result: XSLT Error (javax.xml.transform.TransformerConfigurationException): xsl:stylesheet requires attribute: version Correct(?) behavior: Using: xerces.jar, xalan.jar: xerces: 1.3.1, 1.4 xalan: 2.0.1, 2.1.0 (CVS) Command: java org.apache.xalan.xslt.Process -IN bug2a.xml -XSL bug2a.xsl Result: no output Command: java org.apache.xalan.xslt.Process -IN bug2b.xml -XSL bug2b.xsl Result: no output Bug 3: ------ (1) handling of variable scopes differes from other tools which behavior is correct? Behavior of current xalan: Using: xerces.jar, xalan.jar: xerces: 1.3.1, 1.4 xalan: 2.0.1, 2.1.0 (CVS) Command: java org.apache.xalan.xslt.Process -IN bug3.xml -XSL bug3.xsl Result: Name: Fred Amount: 1 Value: 17 Subtotal: 17 Name: Barney Amount: 3 Value: 25 Subtotal: 75 Name: Wilma Amount: 2 Value: 11 Subtotal: 22 Total: 114 Using other tool, different behavior: (xalan 1.2.2 behaves like this, too) Using: xp.jar, xt.jar: Command: java com.jclark.xsl.sax.Driver bug3.xml bug3.xsl Result: Name: Fred Amount: 1 Value: 17 Subtotal: 17 Name: Barney Amount: 3 Value: 25 Subtotal: 75 Name: Wilma Amount: 2 Value: 11 Subtotal: 22 Total: 22 Regards, Kester. -- Kester Habermann <[EMAIL PROTECTED]> LinuxTag 2001 http://www.linuxtag.org/ Tel: +49.631.3109371 Fax: +49.631.3109372
<root> </root>
<xsl:stylesheet xmlns:xsl = "http://www.w3.org/1999/XSL/Transform" version = "1.0" > <xsl:decimal-format name="german" decimal-separator=","/> <xsl:output method = "text" /> <xsl:variable name = "A" >122.2640</xsl:variable> <xsl:template match = "/" > <xsl:value-of select = "format-number($A,'#.##')" /> </xsl:template> </xsl:stylesheet>
<root> </root>
<xsl:stylesheet xmlns:xsl = "http://www.w3.org/1999/XSL/Transform" version = "1.0" > <xsl:output method = "text" /> </xsl:stylesheet>
<root> </root>
<xsl:stylesheet xmlns:xsl = "http://www.w3.org/1999/XSL/Transform"> <xsl:output method = "text" /> </xsl:stylesheet>
<?xml version="1.0" encoding="ISO-8859-1"?> <!DOCTYPE Bug3 [ <!ELEMENT root (person+)> <!ELEMENT person (name, amount, value)> <!ELEMENT name (#PCDATA)> <!ELEMENT amount (#PCDATA)> <!ELEMENT value (#PCDATA)> ]> <root> <person> <name>Fred</name> <amount>1</amount> <value>17</value> </person> <person> <name>Barney</name> <amount>3</amount> <value>25</value> </person> <person> <name>Wilma</name> <amount>2</amount> <value>11</value> </person> </root>
<?xml version="1.0"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:output method="text"/> <xsl:template match="root"> <xsl:apply-templates select="//person"/> <xsl:variable name="total">0</xsl:variable> <xsl:for-each select="//person"> <xsl:variable name="total"> <xsl:value-of select="$total + ./amount * ./value"/> </xsl:variable> <xsl:if test="position()=last()"> Total: <xsl:value-of select="$total"/> </xsl:if> </xsl:for-each> </xsl:template> <xsl:template match="person"> Name: <xsl:value-of select="./name"/> Amount: <xsl:value-of select="./amount"/> Value: <xsl:value-of select="./value"/> Subtotal: <xsl:value-of select="./amount * ./value"/> </xsl:template> </xsl:stylesheet>