This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: Re: Counting Nodes
- From: Dimitre Novatchev <dnovatchev at yahoo dot com>
- To: xsl-list at lists dot mulberrytech dot com
- Date: Mon, 26 Nov 2001 21:07:57 -0800 (PST)
- Subject: [xsl] Re: Re: Counting Nodes
- Reply-to: xsl-list at lists dot mulberrytech dot com
> > So, do as you said:
> > count(//node()|//@*)
>
> I'm curious. Apart from the present case (evaluating processors),
> why might one need to count the total number of nodes in an XML
> document (excluding inquisitiveness)?
1. In case you've decided to use the Wendell Piez non-recursive repetition method
you might want to be sure there are enough nodes. Then you'll evaluate:
count(//node() | //@* | //namespace::*)
2. In case you're seeking a ***permanent*** ID scheme for any node -- then you'll
have to traverse the nodes from the above union. If you chose to use their position
in this nodelist, then the count will give you a base to calculate the minimum
necessary length in bytes of the node ID.
Cheers,
Dimitre Novatchev.
__________________________________________________
Do You Yahoo!?
Yahoo! GeoCities - quick and easy web site hosting, just $8.95/month.
http://geocities.yahoo.com/ps/info1
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list