You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by "Mukul Gandhi (JIRA)" <xa...@xml.apache.org> on 2010/10/23 06:07:22 UTC

[jira] Commented: (XALANJ-2524) applying exslt:node-set to a node set yields something that is not a node set

    [ https://issues.apache.org/jira/browse/XALANJ-2524?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12924119#action_12924119 ] 

Mukul Gandhi commented on XALANJ-2524:
--------------------------------------

I believe the problem reported by you is not there with node-set function implementation in Xalan-J. For example in the sample program you posted, if we write following XSLT instructions:

<xsl:value-of select="count($tns1)" />
<xsl:value-of select="count($tns2)" />

Then both of these statements print numeric value 3 (which is the number of nodes in the node-set). Therefore both of variables "tns1" and "tns2" contain node-set.

I suspect that, the problem was in implementation of exslt:object-type function in Xalan.

I found it interesting to fix this bug with Xalan's "object-type" implementation and have attached a little patch, which seems to solve this particular problem.

> applying exslt:node-set to a node set yields something that is not a node set
> -----------------------------------------------------------------------------
>
>                 Key: XALANJ-2524
>                 URL: https://issues.apache.org/jira/browse/XALANJ-2524
>             Project: XalanJ2
>          Issue Type: Bug
>      Security Level: No security risk; visible to anyone(Ordinary problems in Xalan projects.  Anybody can view the issue.) 
>          Components: Xalan-extensions
>    Affects Versions: 2.7.1
>            Reporter: Julian Reschke
>            Priority: Minor
>         Attachments: patch_xalanj-2524.txt
>
>
> Applying the exslt:node-set extension to something that already is a node set yields a non-node set result.
> This is a bug according to <http://exslt.org/exsl/functions/node-set/exsl.node-set.html>:
> "If the argument is a node-set already, it is simply returned as is."
> Test case:
> <?xml version="1.0" encoding="UTF-8"?>
> <xsl:stylesheet version="1.0"
>                 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>                 xmlns:exslt="http://exslt.org/common"
> >
> <xsl:output method="text"/>
> <xsl:template match="/">
>   
>   <xsl:variable name="t">
>     <root>
>       <x>1</x>
>       <x>2</x>
>       <x>3</x>
>     </root>
>   </xsl:variable>
>   <xsl:variable name="tns1" select="exslt:node-set($t)/root/x"/>
>   <xsl:variable name="tns2" select="exslt:node-set($tns1)"/>
>   
>   Type of t: <xsl:value-of select="exslt:object-type($t)"/>
>   Type of tns1: <xsl:value-of select="exslt:object-type($tns1)"/>
>   Name of tns2: <xsl:value-of select="exslt:object-type($tns2)"/>
>   
> </xsl:template>
> </xsl:stylesheet>
> This yields the expected result in xsltproc, Saxon 6.* and XSLTC, but not in Xalan-J.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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