This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

sort, count, number, group



    After perusing the FAQ I can sort, count, number, and group.
    But I cannot do them all at once.  Please help.

    Example:

xml:

<root>
    <foo>
          <bar>bard</bar>
          <bar>bark</bar>
    </foo>
    <foo>
          <bar>bark</bar>
          <bar>barb</bar>
     </foo>
</root>

Sample xsl that selects distinct <bar>

<xsl:template match="//bar[not(. = following::bar)]">
     <xsl:value-of select="."/>
</xsl:template>

produces:

bard bark barb

what I want is to number these, sort them, and count the number of times
they appear in the xml source

Desired output:

1.  barb  -1
2.  bard  -1
3.  bark  -2

I can't seem to get there from here.  Do I need to use for-each?

Thanks,
            -Quagly




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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]