Reputation: 473
Return the number of child in a node.
This is my XML:
<LIGHT_INFORMATION_LIST>
<LIGHT_INFORMATION>
<LIGHT_COLOUR>W-G</LIGHT_COLOUR>
</LIGHT_INFORMATION>
<LIGHT_INFORMATION>
<LIGHT_COLOUR>W-R</LIGHT_COLOUR>
</LIGHT_INFORMATION>
<LIGHT_INFORMATION>
<LIGHT_COLOUR>R</LIGHT_COLOUR>
</LIGHT_INFORMATION>
<LIGHT_INFORMATION>
<LIGHT_COLOUR>G</LIGHT_COLOUR>
</LIGHT_INFORMATION>
<LIGHT_INFORMATION>
<LIGHT_COLOUR>W</LIGHT_COLOUR>
</LIGHT_INFORMATION>
</LIGHT_INFORMATION_LIST>
Request Output:
The output request is 5. (The number of child called LIGHT_INFORMATION)
Upvotes: 1
Views: 1460
Reputation: 473
This is the solution:
<xsl:value-of select="count(LIGHT_INFORMATION_LIST/LIGHT_INFORMATION)"/>
Return 5
Upvotes: 2