You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by "David Bertoni (JIRA)" <xa...@xml.apache.org> on 2005/04/29 00:33:20 UTC
[jira] Commented: (XALANC-497) Local variables or parameters in EXSLT-functions are interpreted as global
[ http://issues.apache.org/jira/browse/XALANC-497?page=comments#action_63997 ]
David Bertoni commented on XALANC-497:
--------------------------------------
This looks like a bug in our variable tracking code. However, you should be aware that xalan-C does not implement extension elements, so it does not implement the EXSL extension element 'function'.
> 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
> Assignee: David Bertoni
>
> 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: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org