This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: Counting Nodes
- From: Oleg Tkachenko <olegt at multiconn dot com>
- To: xsl-list at lists dot mulberrytech dot com
- Date: Mon, 26 Nov 2001 11:44:27 +0200
- Subject: Re: [xsl] Counting Nodes
- Organization: Multiconn International
- References: <001b01c17656$e5a18f40$4e0aa8c0@3b2.com>
- Reply-to: xsl-list at lists dot mulberrytech dot com
Richard Jinks wrot
> Is the following expression legal?
> count(//|//@*)
I don't think so, // is a short form of /descendant-or-self::node()/ and
according to grammar rule 3
[3] RelativeLocationPath ::= Step |
RelativeLocationPath '/' Step | AbbreviatedRelativeLocationPath
requires Step after last "/".
> It is supposed to count all nodes and attributes from the current context
> node.
So, do as you said:
count(//node()|//@*)
>
> The reason I'm asking is that I'm currently evaluating a few different XSLT
> processers, with a view to using one of them in a product I'm working on.
> I've noticed that different processers handle it differently, the main
> stumbling block being the "//" by itself.
>
> Usually, they work separately (i.e. count(//) and count(//@*) ), but a
> couple (e.g. Apache's XalanC) seem to fall over when they are combined as
> above.
Huh, interesting point, can you say where count(//) works? This
expression have to raise syntax error.
--
Oleg Tkachenko
Multiconn International, Israel
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list