This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Counting Nodes
- From: "Richard Jinks" <cyberthymia at yahoo dot co dot uk>
- To: <xsl-list at lists dot mulberrytech dot com>
- Date: Mon, 26 Nov 2001 08:46:48 -0000
- Subject: [xsl] Counting Nodes
- Reply-to: xsl-list at lists dot mulberrytech dot com
Hi
More of an XPath question than an XSLT question, but it arose from an
example transformation, so this seems like a good place to ask...
Is the following expression legal?
count(//|//@*)
It is supposed to count all nodes and attributes from the current context
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.
I've tried reading the XPath spec and the XSLT Programmers Reference (2nd
Ed), but I can't arrive at a conclusive decision.
They appear to imply that I can't use the // by itself, needing to follow it
with a node set (i.e. //* (which won't help, btw, as it doesn't count the
text nodes) ), but there are sections which suggest that I can use it as a
node set (e.g. AbbreviatedRelativeLocationPath, p354 of above book).
Please can someone help my confusion?
Thanks,
Richard Jinks
_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list