DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=6850>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=6850

XSLTC: global variables can't be initialized with key() function

           Summary: XSLTC: global variables can't be initialized with key()
                    function
           Product: XalanJ2
           Version: 2.3
          Platform: PC
        OS/Version: Windows NT/2K
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: org.apache.xalan.xsltc
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


Global variables that contain calls to the key function don't contain the 
correct values.  If you make the variable definition local the below example
works:

Example stylesheet:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; version="1.0">
        <xsl:key name="env-param" match="/root/env/param" use="@name"/>
        <xsl:variable name="m" select="key( 'env-param', 'm' )"/>
                        
        <xsl:template match="/">
                <root>
                        <xsl:value-of select="$m"/>
                </root>                                         
        </xsl:template>
</xsl:stylesheet>

Example input doc:
<root>
        <env>
                <param name="m">123</param>
                <param name="n">321</param>
        </env>
</root>

Reply via email to