xsl:key does not work with XSLTC when a global variable is defined with 
document()
----------------------------------------------------------------------------------

                 Key: XALANJ-2534
                 URL: https://issues.apache.org/jira/browse/XALANJ-2534
             Project: XalanJ2
          Issue Type: Bug
      Security Level: No security risk; visible to anyone (Ordinary problems in 
Xalan projects.  Anybody can view the issue.)
          Components: XSLTC
    Affects Versions: 2.7.1
            Reporter: Damien Guillaume


The summary says it all. Actually, it does not happen if the variable is not 
used in the stylesheet (probably because optimization prevents the reading of 
the external document). The bug occurs with XSLTC but not Xalan.

Here is a sample test:

    <xsl:key name="things" match="thing" use="label"/>
    <xsl:variable name="messages" select="document('messages.xml')/messages"/>
    
    <xsl:template match="/">
        <results>
            nb:<xsl:value-of select="count(key('things', 'tag'))"/> (should be 
1)
            
            <!-- works without this line, or if the messages variable 
declaration is moved here -->
            <xsl:value-of select="$messages/message[@label='tag']"/>
        </results>
    </xsl:template>


-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscr...@xml.apache.org
For additional commands, e-mail: xalan-dev-h...@xml.apache.org

Reply via email to