[xsl] Re: Re: Counting Nodes

Subject: [xsl] Re: Re: Counting Nodes
From: Dimitre Novatchev <dnovatchev@xxxxxxxxx>
Date: Mon, 26 Nov 2001 21:07:57 -0800 (PST)
> > 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.

Dimitre Novatchev.

Do You Yahoo!?
Yahoo! GeoCities - quick and easy web site hosting, just $8.95/month.

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

Current Thread