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=11809>.
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=11809

node-set increments everytime xsl:value-of refers to the node-set

           Summary: node-set increments everytime xsl:value-of refers to the
                    node-set
           Product: XalanJ2
           Version: 2.4Dx
          Platform: PC
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Xalan
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]
                CC: [EMAIL PROTECTED]


In a named template when the node-set "." is passed as a parameter, the node-set
will increment in count every time <xsl:value-of select=$xxx> is used. 

I am using this on WindowsMe.  I don't know which component this belongs to.

Here is the XSL file:

-----------------------------------------------------------------------
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
                version="1.0">

<xsl:template match="/">
   <xsl:apply-templates/>
</xsl:template>

<xsl:template match="bigtag">
  <xsl:element name="sometext">
    <xsl:apply-templates select="littletag">
      <xsl:with-param name="this-node-set" select="littletag"/>
    </xsl:apply-templates>
    calling named template from bigtag template
    <xsl:call-template name="littletag-template">
       <xsl:with-param name="this-node-set" select="littletag"/>
    </xsl:call-template>
  </xsl:element>
</xsl:template>


<xsl:template match="littletag">
   <xsl:param name="this-node-set"/>
   Called by apply-templates
   this-node-set has <xsl:value-of select="count($this-node-set)"/> nodes
   this-node-set has <xsl:value-of select="count($this-node-set)"/> nodes
   this-node-set has <xsl:value-of select="count($this-node-set)"/> nodes
    calling named template from littletag template
   <xsl:call-template name="littletag-template">
      <xsl:with-param name="this-node-set" select="."/>
   </xsl:call-template>
</xsl:template>

<xsl:template name="littletag-template">
   <xsl:param name="this-node-set"/>
   Called by call-template
   this-node-set has <xsl:value-of select="count($this-node-set)"/> nodes
   this-node-set has <xsl:value-of select="count($this-node-set)"/> nodes
   this-node-set has <xsl:value-of select="count($this-node-set)"/> nodes
</xsl:template>

</xsl:stylesheet>
---------------------------------------------------------

Here is the xml file:
-------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<bigtag>
  <littletag/>
</bigtag>
------------------------------------------------------------


Here is the output:
------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<sometext>
   Called by apply-templates
   this-node-set has 1 nodes
   this-node-set has 1 nodes
   this-node-set has 1 nodes
    calling named template from littletag template
   
   Called by call-template
   this-node-set has 1 nodes
   this-node-set has 2 nodes
   this-node-set has 3 nodes

    calling named template from bigtag template
    
   Called by call-template
   this-node-set has 1 nodes
   this-node-set has 1 nodes
   this-node-set has 1 nodes
</sometext>
--------------------------------------------------

The behaviour is seen in the section that says
   this-node-set has 1 nodes
   this-node-set has 2 nodes
   this-node-set has 3 nodes


Thank you.

Reply via email to