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

RE: Curious result of the position() function

Subject: RE: Curious result of the position() function
From: "Passin, Tom" <tpassin@xxxxxxxxxxxx>
Date: Thu, 29 Jul 2004 10:51:34 -0400
xsl pos
> From: David Carlisle [mailto:davidc@xxxxxxxxx]


> > I believed that the position() function should give me the position
> number
> > of the node in the node set.
>
> "set" always implies an unordered data structure, there is no postion
in
> a set. It does give the position in the current node list, which in
thi
> scase consists of, alternately an element node and a text node (with
> white space in it)

Just to augment what David said, you will get the expected results if
you select just the specific nodes you are interested in.  For example,
this will give you the position() results you expected -

<xsl:template match="/">
  <result>
    <xsl:apply-templates select='/document/table/row'/>
  </result>
</xsl:template>

Now, only the "row" elements get fed to the template, so the position()
values reflect a row's position among just the other rows.

Cheers,

Tom P

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.