[xsl] how getting a list of occurences

Subject: [xsl] how getting a list of occurences
From: Elena Pierazzo <pierazzo@xxxxxxxxxxxxx>
Date: Fri, 19 Sep 2003 09:35:47 +0200
Hi all,
I firstly apologize for my beginner's question.

I've an XML document like this
<root>
   ....
      ...
         <p>
            <persName>pippo</persName>
            ...
            <persName>pluto</persName>
            ...
           <persName>pippo</persName>
            ...
            <persName>ciccio</persName>
            ....
          </p>
      ....
   ....
</root>

I would like to get as an output a list of all the occurences of the <persName> element and the number of time that the form occours, like that:

pippo 2
pluto 1
ciccio 1

I've tryed to do this using <xsl:number> as follow:

<xsl:template match="p">
<xsl:for-each select="persName">
<br />
<xsl:value-of select="." />:
<xsl:number count="*" value="???">
</xsl:number>
</xsl:for-each>
</xsl:template>

but I'm unable to complete the expression required by the value attribute.
Thank you in advance

Elena Pierazzo



XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list


Current Thread