Local variables or parameters in EXSLT-functions are interpreted as global
--------------------------------------------------------------------------
Key: XALANC-497
URL: http://issues.apache.org/jira/browse/XALANC-497
Project: XalanC
Type: Bug
Versions: 1.9
Environment: Windows XP Prof.; Xalan-C 1.9.0 (Xalan-C_1_9_0-win32-msvc_60.zip)
and Xerces-C 2.6.0 (xerces-c_2_6_0-windows_nt-msvc_60.zip)
Reporter: Joachim Pfisterer
Local variables or parameters in EXSLT-functions are interpreted as global, so
we got an Error-message if we use the same parameter/variable in different
functions.
When we execute the following Stylesheet "Xalan-C_bug.xsl":
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
xmlns:common="http://exslt.org/common"
xmlns:math="http://exslt.org/math"
xmlns:func="http://exslt.org/functions"
xmlns:my="http://pfisterer.software/functions"
exclude-result-prefixes="common math func my">
<xsl:include href="Round.xsl"/>
<xsl:output method="xml" indent="yes" encoding="iso-8859-1"/>
<xsl:template match="/*">
<xsl:copy>
<xsl:copy-of select="@*"/>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>
<xsl:template match="Number">
<RoundedNumber>
<xsl:value-of select="my:round3(.)"/>
</RoundedNumber>
</xsl:template>
</xsl:stylesheet>
witch includes the following "Round.xsl" Stylesheet:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:common="http://exslt.org/common"
xmlns:math="http://exslt.org/math"
xmlns:func="http://exslt.org/functions"
xmlns:my="http://pfisterer.software/functions"
exclude-result-prefixes="common math func my">
<func:function name="my:round3">
<xsl:param name="x"/>
<xsl:variable name="result" select="round($x * 1000) div 1000"/>
<func:result>
<xsl:value-of select="$result"/>
</func:result>
</func:function>
<func:function name="my:round6">
<xsl:param name="x"/>
<xsl:variable name="result" select="round($x * 1000000) div
1000000"/>
<func:result>
<xsl:value-of select="$result"/>
</func:result>
</func:function>
</xsl:stylesheet>
together with an xml-sourcefile with some <Number>-Elements, we got the Error:
C:\>Xalan -o result.xml Numbers.xml Xalan-C_bug.xsl
XSLT Error: A global variable or parameter with this name has already been
declared. (file:///C:/Round.xsl, line 18, column 24.)
The reported bug does not accur with Xalan-J 2.6.0!
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]