> Dear friends,
>
> I want to count the number of elements and nodes in a xml
> with an xsl. can u say a way6 to do it.
>
> <A>
> <A1>
> <A12>
> <A12>
> <A12>
> </A1>
> <A2>
> <A12>
> <A12>
> </A2>
> ....
> </A>
>
> i should get a sum in this case of 8 ie sum of nodes and
> childs .. how to get this done .
<xsl:template match="/">
<xsl:value-of select="count(//*)"/>
</xsl:template>
...will count all of the elements (not text or whitespace nodes)
Ps. your xml isn't well formed. If there should be 8 elements, then
<A12> should be <A12/>.
cheers
andrew
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
| Current Thread |
- RE: Re:, (continued)
- Andrew Welch - Wed, 7 Jan 2004 05:59:18 -0500 (EST)
- Gary Calvin - Wed, 7 Jan 2004 14:14:00 -0500 (EST)
- Peter_Ivan - Thu, 8 Jan 2004 03:52:39 -0500 (EST)
- Andrew Welch - Thu, 8 Jan 2004 04:11:23 -0500 (EST) <=
|
|