Counting Child Nodes using Axis instead of count?

wxdqz

New Member
Hello. I have the following xml, basically.


<data>
<risk>
<personVal/>
<description>Total</description>
<last/>
<numVal/>
<quantity/>
<testVal>470400.42</testVal>
<totals>220421.73</totals>
<totalmade>232356.69</totalmade>
<dailymade>139.21</dailymade>
<ling>1223.00</ling>
<risk>
<personVal>Consumer</personVal>
<description/>
<last/>
<numVal/>
<quantity/>
<testVal>215892.50</testVal>
<totals>537.00</totals>
<totalmade>132062.50</totalmade>
<dailymade>85.51</dailymade>
<ling>34.96</ling>
<risk>
<personVal>Consumer</personVal>
<description>MMM</description>
<last/>
<numVal/>
<quantity/>
<testVal>215760.00</testVal>
<totals>462.00</totals>
<totalmade>132060.00</totalmade>
<dailymade>68.01</dailymade>
<ling>34.96</ling>
<risk>
<personVal/>
<description>MMM Jan 07 60.00 Call</description>
<last>19.00</last>
<numVal>-0.60</numVal>
<quantity>-22.00</quantity>
<testVal>41800.00</testVal>
<totals>121.00</totals>
<totalmade>-41679.00</totalmade>
<dailymade>1320.00</dailymade>
<ling>-2200.00</ling>
</risk>
<risk>
<personVal/>
<description>MMM Apr 07 70.00 Put</description>
<last>0.40</last>
<numVal>0.05</numVal>
<quantity>-4.00</quantity>
<testVal>160.00</testVal>
<totals>220.00</totals>
<totalmade>60.00</totalmade>
<dailymade>-20.00</dailymade>
<ling>34.96</ling>
</risk>
<risk>
<personVal/>
<description>MMM Stock</description>
<last>78.99</last>
<numVal>-0.56</numVal>
<quantity>2200.00</quantity>
<testVal>173800.00</testVal>
<totals>121.00</totals>
<totalmade>173679.00</totalmade>
<dailymade>-1231.99</dailymade>
<ling>2200.00</ling>
</risk>
</risk>
</risk>
</risk>
</data>


I would like to be able to use axis to count the TOTAL number of children in each row INSTEAD of using <xsl:value-of select="count(risk) + count(risk/risk)"/>

Kinda n00b with the axis stuff. Any help is appreciated!
 
Back
Top