[no subject]

From: Sue Miller <smiller@xxxxxxxxxxxxxxx>
Date: Tue, 17 Jul 2001 14:55:04 +0100 (BST)
Hi,
I'm trying to do a count of how many times field[@column='3'] has the same
value within my XML tree. e.g. How many times does field[@column='3']
have the value A. I need to do something that will output "1 of 2
results found" or, to start of with, something that will output "2 results
where found with this value".

XML:

<?xml version="1.0" encoding="UTF-8"?>
<search>
  <errors/>
  <results>
    <record>
      <field column="3">A</field>
    </record>
    <record>
      <field column="3">A</field>
    </record>
    <record>
      <field column="3">B</field>
    </record>
  <results>
</search>


The following won't work because you've got a boolean not a NodeList in
count but gives an idea of what i want to do.....

XSL:

<xsl:for-each select="/search/results/record">
   <xsl:value-of select="field[@column='3']" />
   <xsl:value-of select="count(//search/results/record/field[@column='3']=field[@column='3'])"/>
   &#160;results found.
</xsl:for-each select>

Any ideas?
Thanks,
Sue






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


Current Thread