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”
This recurses the entire XML tree via the descendant axis (
//), looks at all element nodes (*) that have no child element nodes (not(*)) and contain data other than whitespace (normalize-space() != '').The resulting node-set is counted (and returns 4 in your case).