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

Re: Relative path

Subject: Re: Relative path
From: Abel Braaksma <abel.online@xxxxxxxxx>
Date: Fri, 08 Sep 2006 14:35:31 +0200
xml relative path
Hi Giancarlo,

Here's a summary of your XML, and some comments:

<CommandList>
   <CheckRouting millis="78">
       <RouterList>
           <Router>
               <GroupList>
                   <Group>
                       <Id>NKI56H6IKP0G1K27</Id>
                       <OutwardList>
                           <Outward>
>>>> Outward ID needed <<<<<
                               <Id>OSJS0EYYLYIA8CW7</Id>
                               <Price>
>>>> Price you want to sort <<<<<
                                   <Amount>93.68</Amount>
                               </Price>
                           </Outward>
                           <Outward>
                               <Id>FB9ZW0FDS0RJ0RXI</Id>
                               <Price>
                                   <Amount>103.68</Amount>
                               </Price>
                           </Outward>
                       </OutwardList>
                       <ReturnList>
                           <Return>
>>>> Return ID needed <<<<<
                               <Id>6BD4GM0RZ7EFPAON</Id>
                           </Return>
                           <Return>
                               <Id>ZLTLT42PPT20VMM1</Id>
                           </Return>
                       </ReturnList>
                   </Group>
               </GroupList>
           </Router>
       </RouterList>
   </CheckRouting>
</CommandList>


This means that you were almost correct with your statement. The node <ReturnList> is outside your <OutwardList>, the latter being the scope of the for-each.You always request the first <Id> in the <ReturnList>, because you do not specify any limiting requirements. I have to make a guess that the element you want in the <ReturnList> node actually should have the same position as the element in the <OutwardList> node, counting from the List as a starting point. But that is a guess. If I remember my lessons correctly, you could do that by so:


<xsl:variable name="pos"><xsl:number /></xsl:variable>
<xsl:value-of select="../../ReturnList/Return[position() = $pos]/Id" />

The number is the actual number of the traversal before sorting. In effect that stores the node position of the OutwardList items. Using that number in your ReturnList items, and comparing that against the node position of the context node (here: Return), you will retrieve the matching Return/Id values you need.

Cheers,
Abel



Giancarlo Rossi wrote:
HI Abel ,
Sorry for the clock.

The right url is: http://www.lastminutesud.it/TEST/test_rt.xml

I test your advice <xsl:value-of select="ReturnList/Return/Id"/>

But it doesnt display any value...

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-2011 All Rights Reserved.