[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: "Oleg Tkachenko" <olegt@xxxxxxxxxxxxx>
Date: Fri, 3 Aug 2001 20:29:26 +0200
xslt preceding axis
Hello John-Paul !

I think you don't take into account <xsl:apply-templates> element's default sorting behaviour - unless you specify children <xsl:sort> elements, it processes selected set of nodes in document order.
http://www.w3.org/TR/xslt.html#section-Applying-Template-Rules

---
Oleg Tkachenko,
Multiconn International 

> -----Original Message-----
> From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx 
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of 
> John-Paul Sicotte
> Sent: Friday, August 03, 2001 7:00 PM
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  Interpretation of preceding axis 
> (preceding-sibling in particular)
> 
> 
> 
> Hi,
> 
>    I have read several of the threads on the preceding axes and looked 
> at the FAQ but I am still not 100% sure what should be returned.  I 
> have built a stylesheet and an input file to illustrate the issue. It 
> tests the actual node set returned as well as the position of those 
> nodes.
> 
> xslt file
> ==========
> 
> <?xml version="1.0" encoding="ISO-8859-1"?>
> 
> <xsl:stylesheet version = "1.0"
>   xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
> 
> <xsl:template match = "/document" >
>   <xsl:apply-templates select="element[1]"  mode = "siblings"/>
>   <xsl:apply-templates select="element[5]"  mode = "siblings"/>
>   <xsl:apply-templates select="element[10]" mode = "siblings"/>
> </xsl:template>
> 
> <xsl:template match = "element" mode = "siblings">
>   <xsl:call-template name = "siblings"/>
> </xsl:template>
> 
> 
> <xsl:template match = "element" mode = "position"><xsl:value-of 
> select = "position()"/></xsl:template>
> 
> <xsl:template name = "siblings">
> Context Node:         <xsl:value-of select = "."/>
> Preceeding Siblings:  <xsl:apply-templates 
> select="preceding-sibling::element"/>
> Preceeding Position:  <xsl:apply-templates 
> select="preceding-sibling::element" mode = "position"/>
> Following Siblings:   <xsl:apply-templates 
> select="following-sibling::element"/>
> Following Position:   <xsl:apply-templates 
> select="following-sibling::element" mode = "position"/>
> </xsl:template>
> 
> </xsl:stylesheet>
> --------------------
> 
> xml file
> 
> <?xml version = "1.0" standalone = "yes" ?>
> <document>
>   <element pos = "1">1</element>
>   <element pos = "2">2</element>
>   <element pos = "3">3</element>
>   <element pos = "4">4</element>
>   <element pos = "5">5</element>
>   <element pos = "6">6</element>
>   <element pos = "7">7</element>
>   <element pos = "8">8</element>
>   <element pos = "9">9</element>
>   <element pos = "10">0</element>
> </document>
> 
> --------------------------------------
> 
> I got the following output from XT
> 
> Context Node:         1
> Preceeding Siblings:
> Preceeding Position:
> Following Siblings:   234567890
> Following Position:   123456789
> 
> Context Node:         5
> Preceeding Siblings:  1234
> Preceeding Position:  1234
> Following Siblings:   67890
> Following Position:   12345
> 
> Context Node:         0
> Preceeding Siblings:  123456789
> Preceeding Position:  123456789
> Following Siblings:
> Following Position:
> 
> This position values seem incorrect to me.  I would have expected the 
> positions to be reversed (ie 4321 and 987654321).  It seems clear to me
> that the reverse axes are counted from the context node backwards.  The 
> immediately previous node should be 1.  
> 
> 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?
> 
> 						John-Paul
> 
> ----------------------
> John-Paul Sicotte
> Software Composer
> MessagingDirect
> mailto:John-Paul.Sicotte@xxxxxxxxxxxxxxxxxxx
> 
> 
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> 


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


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.