[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Confused by xsl:for-each

Subject: Re: Confused by xsl:for-each
From: David Carlisle <davidc@xxxxxxxxx>
Date: Thu, 25 Nov 2004 13:42:47 GMT
xsl for each count
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
________________________________________________________________________

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.