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

RE: Node ordering question with preceding axis

Subject: RE: Node ordering question with preceding axis
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Sun, 27 Nov 2005 09:15:20 -0000
node ordering
The result of a path expression (an expression involving "/") is always in
document order.

I'm not sure exactly what you want, but you might be able to get it by
replacing

A/B

with
 
for $a in A return $a/B

which doesn't sort into document order.

Michael Kay
http://www.saxonica.com/


> -----Original Message-----
> From: Kenneth Stephen [mailto:marvin.the.cynical.robot@xxxxxxxxx] 
> Sent: 27 November 2005 01:43
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  Node ordering question with preceding axis
> 
> Hi,
> 
>     I have the following testcase:
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>         version="2.0">
> 
>         <xsl:output method="xml" omit-xml-declaration="yes" />
> 
>         <xsl:variable name="forest">
>                 <tree>One</tree>
>                 <tree>Two</tree>
>                 <tree><tree>Three</tree></tree>
>                 <tree><tree>Four</tree><tree>Five</tree></tree>
>                
> <tree><tree>Six</tree><tree>Seven</tree><tree>Eight</tree></tree>
>         </xsl:variable>
> 
>         <xsl:template match="/">
> 
>                 <xsl:value-of select="$forest//tree[text() =
> 'Eight']/preceding::*" />
>         </xsl:template>
> 
> </xsl:stylesheet>
> 
>     When run, this code produces:
> 
> One Two Three Three FourFive Four Five Six Seven
> 
>     I'm not entirely clear about the expected behaviour of preceding
> axis with temporary trees, but I was expecting that the for the last
> "forest" of nodes, the node ordering would be "Seven" followed by
> "Six"  since preceding is a reverse axis. What am I missing?
> 
> Thanks,
> Kenneth

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.