xsl-list
[Top] [All Lists]

Re: Confused by xsl:for-each

2004-11-25 06:42:47

are you sure you want //a rather than .//a  ?
//a selects all a from anwhere in the document not just those under the
current element.

  BUT <xsl:value-of select="number(//a) I get 0, although there are two
  <a..> inside <td>.


number() converts a string such as "2" into a number such as 2
if you give it a node set such as //a it will take the string value
of the first node in the set in document order and then coerce that to a number.
As you didn't show the whole document I don't know what your first a
looked like, it mus have been <a href=...>0</a>
The first one you showed was  <a href="external/address.html">Adresse
1</a>
which would have produced NaN.

You want count() to count nodes, not number().

select="count(.//a)"

David

________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

--~------------------------------------------------------------------
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>