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

Re: Interpretation of preceding axis (preceding-siblin

Subject: Re: Interpretation of preceding axis (preceding-sibling in particular)
From: Jeni Tennison <mail@xxxxxxxxxxxxxxxx>
Date: Fri, 3 Aug 2001 18:28:05 +0100
Re:  Interpretation of preceding axis (preceding-siblin
Hi John-Paul,

> The actual node ordering appears to be correct. Regardless of the
> axis the nodes are returned in document order, only the position
> changes. Is this interpretation correct?

Sort of. Whenever you apply templates to a node set with
xsl:apply-templates to iterate over them with xsl:for-each, they are
processed in document order. The position() function shows you that

On the other hand, when you use a predicate in a step, the predicate
treats the nodes selected by the step in the order determined by the
axis used by the step.

So if you do:

  <xsl:for-each select="preceding::element">
    <xsl:if test="position() = 1">
      <xsl:value-of select="." />

then you will get the value of the first 'element' element in the
document (excluding ancestors), but if you do:

  <xsl:for-each select="preceding::element[1]">
    <xsl:value-of select="." />

then you will get the value of the 'element' element that occurs
immediately before the one you're currently on.

I hope that helps,


Jeni Tennison

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

Current Thread


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.
First Name
Last Name
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.