[xsl] Counting common value within specific attributes

Subject: [xsl] Counting common value within specific attributes
From: "Andrew Quan" <aquan@xxxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 28 Apr 2006 12:40:40 +1000
Hi,

I'm Using XSLT 1.0

I've searched around in the FAQ and i couldnt find any information regarding
this issue - hopefully I can get some help, although I feel like I may have
not structured my question correctly... I hope you understand it. I'm a
relative beginner too, so that probably doesnt help either. Sorry!

Given a data set similar to this:

<device>
    <deviceID>1</deviceID>
    <desc>Description1</desc>
    <chan1>0<chan1>
    <chan2>0<chan2>
    <chan3>2<chan3>
    <chan4>2<chan4>
    <chan5>2<chan5>
    <chan6>2<chan6>
    <chan7>4<chan7>
    <chan8>0<chan8>
    <chan9>2<chan9>
</device>
<device>
    <deviceID>2</deviceID>
    <desc>Description2</desc>
    <chan1>2<chan1>
    <chan2>2<chan2>
    <chan3>2<chan3>
    <chan4>4<chan4>
    <chan5>2<chan5>
    <chan6>2<chan6>
    <chan7>2<chan7>
    <chan8>2<chan8>
    <chan9>4<chan9>
</device>

Is there a way to count how many times, for example, a 2 appears in all
attributes starting with the name "chan"?

Ideal output:

Device ID | Description | Channels=0 | Channels=2 | Channels=4 |
1	| Description1	| 3 | 5 | 1 |
2 	| Description2    | 0 | 7 | 2 |

Any help appreciated, i'll keep searching till then
Andrew

Current Thread