xsl-list
[Top] [All Lists]

Re: [xsl] question about count(node())

2007-06-22 14:32:11
Andreas Peter wrote:

I match on <block> and count the nodes by using
<xsl:with-param name="countnodes" select="count(node())"/>

The returned value is "9". I need to know how many nodes are between the element <block>. Could anyone of you out there explain to me which nodes are counted? I cannot see any schema behind.


That you receive '9' has already been explained by Eric and Michael. Here are some possible scenarios for what you may mean:

If you want to count *all* nodes, I assume you mean all descendants from block. Use: count(//node()). If you want all nodes, but not the whitespace or text nodes, use count(//*). If you want all nodes, but not whitespace nodes, including text nodes, you can use count(//text()[.] | //*). etc

Cheers,
-- Abel Braaksma

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>