Hi Dmitri,
 
It's very simple if I understood you correctly. I would call count() function. For instance:
 
<xsl:template match="items">
    <H1>
        <xsl:value-of select="count(item[@width = 2])"/>
    </H1>
</xsl:template>
 
or you can create variable with number of items with attribute width equal to 2:
   
    <xsl:variable name="cnt_2" select="count(item[@width = 2])"/>
 
Is that what you need?
 
Thanks,
Dmitry
-----Original Message-----
From: Dmitri Ilyin [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, July 11, 2001 01:30
To: '[EMAIL PROTECTED]'
Subject: RE: node-set as param

Hi Dmitri,
 
thank for answer,
 
I need to cound the <item> nodes that have width = 2:
 
<root>
   <items>
      <item width="2">
      <item width="1">
      <item width="2">
      <item width="3">
   </items>
</root>
 
I can make it in for-each but in that case I can not increment counter.
 
I have no idea how can I do that.
 
have you any suggestions??
 
regards
 
Dmitri
     
-----Original Message-----
From: Voytenko, Dimitry [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, July 10, 2001 8:36 PM
To: '[EMAIL PROTECTED]'
Subject: RE: node-set as param

Hi Dmitri,
 
just call
<xsl:call-template name="template-with-nodeset-param">
    <xsl:with-param name="nodeset-param" select="nodeset-expression"/>
</xsl:call-template>
 
You'll get node-set in parameter "nodeset-param" in template "template-with-nodeset-param".
 
For instance for XML:
<root>
    <items>
        <item id="1"/>
        <item id="2"/>
        <item id="3"/>
    </items>
</root>
 
in xsl:
 
.....
<xsl:template match="/">
    <xsl:call-template name="show-items">
        <xsl:with-param name="items" select="/root/items"/>
    </xsl:call-template>
</xsl:template>
...
<xsl:template name="show-items">
    <xsl:param name="items"/>
    <xsl:for-each select="$items/item">
        <xsl:value-of select="@id"/>
    </xsl:for-each>
</xsl:template>
 
Is that what you need?
 
Thanks,
Dmitry
-----Original Message-----
From: Dmitri Ilyin [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, July 10, 2001 08:51
To: Xalan-Dev List (E-mail)
Subject: node-set as param

Hi *,
 
how can I select  "node set" and set it as param in temlate call??
 
regards
 
Dmitri

Reply via email to