You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by "Brian Minchau (JIRA)" <xa...@xml.apache.org> on 2006/10/31 05:45:18 UTC

[jira] Commented: (XALANJ-2293) Error counting nodes when using a variable

    [ http://issues.apache.org/jira/browse/XALANJ-2293?page=comments#action_12445773 ] 
            
Brian Minchau commented on XALANJ-2293:
---------------------------------------

Ricotta,
The fix in XALANJ-2204 has been re-worked, and that issue is once again resolved, so
this issue should also be resolved now.  Please confirm that it works for you.

> Error counting nodes when using a variable
> ------------------------------------------
>
>                 Key: XALANJ-2293
>                 URL: http://issues.apache.org/jira/browse/XALANJ-2293
>             Project: XalanJ2
>          Issue Type: Bug
>          Components: Xalan
>    Affects Versions: 2.7
>            Reporter: Ricotta
>            Priority: Critical
>             Fix For: Latest Development Code
>
>
> Consider the following XML file:
> ---------------------------------------------------
> <xmldata>
>     <value/>
>     <value/>
> </xmldata>
> ---------------------------------------------------
> Consider the following XSL file:
> ---------------------------------------------------
> <xsl:stylesheet version = '1.0' xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>
> <xsl:variable name="doc" select="xmldata"/>
> <xsl:template match="xmldata">
> <html>
>   <head/>
>   <body>
>   
>    Number of elements: <xsl:value-of select="count($doc/value)"/>
>    <br/>
>    Number of elements: <xsl:value-of select="count($doc/value)"/>
>    <br/>
>   </body>
> </html>
> </xsl:template>
> </xsl:stylesheet>
> ---------------------------------------------------
> As you can see, the output should be an html page showing the total number of elements twice. However, this is the output:
> ---------------------------------------------------
> Number of elements: 2
> Number of elements: 4
> ---------------------------------------------------
> Now consider the following XSL file:
> ---------------------------------------------------
> <xsl:stylesheet version = '1.0' xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>
> <xsl:template match="xmldata">
> <xsl:variable name="doc" select="."/>
> <html>
>   <head/>
>   <body>
>   
>    Number of elements: <xsl:value-of select="count($doc/value)"/>
>    <br/>
>    Number of elements: <xsl:value-of select="count($doc/value)"/>
>    <br/>
>   </body>
> </html>
> </xsl:template>
> </xsl:stylesheet>
> ---------------------------------------------------
> Now the output is correct:
> ---------------------------------------------------
> Number of elements: 2
> Number of elements: 2
> ---------------------------------------------------
> Comparing the two XSL files, the only diference is that the "doc" variable is declared outside or inside the template.
> Thank you!

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