Counting only specific element

pirata_web

New Member
I'm trying to count the occurrence of an individual element regardless of where it appears in the structure of the xml document. I've tried variations of position() and count() both with and without for-each loops and can't seem to find anything that will work. Anyone have an idea on how to do this?An example document would be:\[code\]<text> <body> <div1> <p>abc</p> <div2> <p>def</p> </div2> </div1> <div1> <p>ghi</p> <div2> <p>jkl <name>adam</name></p> <div3> <p>mno</p> </div3> </div2> <p>qrs</p> </div1> </body></text>\[/code\]with the return:\[code\]<1>abc<2>def<3>ghi<4>jkl adam<5>mno<6>qrs\[/code\]
 
Top