You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by "Henry Zongaro (JIRA)" <xa...@xml.apache.org> on 2006/11/20 15:39:05 UTC

[jira] Commented: (XALANJ-2339) XSLTC: name()-function doesnt work properly with test-statement before

    [ http://issues.apache.org/jira/browse/XALANJ-2339?page=comments#action_12451318 ] 
            
Henry Zongaro commented on XALANJ-2339:
---------------------------------------

It looks like XSLTC is inconsistent in its treatment of node set iterators (DTMAxisIterator).  In cases where there is a reference to a variable whose value is a node set, the generated code will invoke the cloneIterator() method on the variable, and use that for the variable reference.

However, a parameter's type is not generally known statically, and XSLTC generates references to methods defined in BasisLibrary which sometimes use the original iterator (performing a reset() operation first) and sometimes clone the iterator (without performing reset() first).  In particular, BasisLibrary.booleanF (which implements the boolean function for references to parameters) uses the iterator directly by first resetting it, and then checking whether it returns at least one node.  The BasisLibrary.referenceToNodeSet method (which casts a parameter to an iterator, and reports an error if the parameter is of the wrong type) on the other hand, which is used to convert the parameter to a node set for the call to the name function, clones the iterator for the parameter and returns that.  However, the clone operation clones the original iterator's state.  In the case of the parameter, its iterator has been advanced past the first element through the operation of BasisLibrary.booleanF, and so the name() function has no node left to operate upon.

> XSLTC: name()-function doesnt work properly with test-statement before
> ----------------------------------------------------------------------
>
>                 Key: XALANJ-2339
>                 URL: http://issues.apache.org/jira/browse/XALANJ-2339
>             Project: XalanJ2
>          Issue Type: Bug
>          Components: XPath-function, XSLTC
>    Affects Versions: 2.7
>         Environment: JDK 1.4
>            Reporter: Daniel Reuter
>
> XML:
> <?xml version="1.0" encoding="UTF-8"?>
> <test>
>    <sub>
>       <value>test</value>
>    </sub>
> <test>
> XSL:
> <xsl:template match="test">
>    <xsl:call-template name="subtemplate">
>       <xsl:with-param name="nodeSet" select="sub"/>
>    </xsl:call-template>
> </xsl:template>
> <xsl:template name="subtemplate">
>    <xsl:param name="nodeSet"/>
>       <xsl:if test="$nodeSet">
>          Name=<xsl:value-of select="name($nodeSet)"/>		
>       </xsl:if>			
> </xsl:template>
> The name()-function in the "subtemplate" doesnt work properly. Without the former test-statement, the function writes the correct name of the node ("sub"). The Bug only appears with XSLTC activated.

-- 
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