Count end points in XML using XSL

Posted by Chris on Stack Overflow See other posts from Stack Overflow or by Chris
Published on 2010-03-31T09:03:25Z Indexed on 2010/03/31 9:13 UTC
Read the original article Hit count: 337

Filed under:
|
|

I want to be able to count "end points" in an XML file using XSL. By endpoint I mean tag's with no children that contain data.

i.e.

<xmlsnippet> 
    <tag1>NOTENOUGHDAYS</tag1> 
    <tag2>INVALIDINPUTS</tag2> 
    <tag3> 
        <tag4> 
            <tag5>2</tag5> 
            <tag6>1</tag6> 
        </tag4> 
    </tag3> 
</xmlsnippet> 

This XML should return 4 as there are 4 "end points"

© Stack Overflow or respective owner

Related posts about xsl

Related posts about xslt