[thelist] Count XML Nodes

Matt Warden mwarden at gmail.com
Mon Dec 20 19:40:23 CST 2004


On Tue, 21 Dec 2004 01:39:31 -0000, Jamie Lewis <emaillists at eyota.net> wrote:
> Anyone know how i can count how many xml nodes are in a document?
> 
> XML looks like:
> 
> <TESTIMONIALS>
>         <TESTIMONY>
>                 ....more child nodes ...
>         </TESTIMONY>
>         <TESTIMONY>
>                 ....more child nodes ...
>         </TESTIMONY>
>         <TESTIMONY>
>                 ....more child nodes ...
>         </TESTIMONY>
> </TESTIMONIALS>
> 
> And i want to count the number of TESTIMONIALS\TESTIMONY


We would need to know what language and/or parser you are using. XSL?
PHP? Javascript?

For example, XSL would be something liek this:

<xsl:number value="count(testimony)"/>



-- 
Matt Warden
Miami University
Oxford, OH
http://mattwarden.com


This email proudly and graciously contributes to entropy.


More information about the thelist mailing list