简体   繁体   中英

Get the total number of nodes and counting nodes

Is it possible to get the total number of XML nodes?

Also, how does one do a for-statement with XSLT?

If you want to count the node of you XML you could use count(object/node) and it will be something like this:

 <xsl:value-of select="count(/root/*)"/>

The instruction above will let you know how many child nodes does your root node has

<xsl:for-each select="/root/element-you-wanna-loop" >
    <!-- Do something with your nodes here -->    
</xsl:for-each>

Hope this helps you.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM