XML Editor
Sign up for a WebBoard account Sign Up Keyword Search Search More Options... Options
Chat Rooms Chat Help Help News News Log in to WebBoard Log in Not Logged in
Conferences Close Tree View
+ Stylus Studio Feature Requests (1192)
+ Stylus Studio Technical Forum (14621)
+ Website Feedback (249)
- XSLT Help and Discussion (7625)
-> + get the current position as pa... (2)
-> - unable to get Parameter from x... (1)
-> + get key value from xslt to jav... (2)
-> + Xpath insensitive search? (3)
-> - relative path 2 (10)
-> ->relative path 2
-> ->relative path 2
-> ->relative path 2
-> ->relative path 2
-> ->relative path 2
-> ->relative path 2
-> ->relative path 2
-> ->relative path 2
-> ->relative path 2
-> + sum and group attrs, list only... (3)
-> - Simple multiplication.... but ... (1)
-> + .NET issue (2)
-> + Grouping items (9)
-> + Group Move (4)
-> + Problem with DateTime manipula... (2)
-> + xls fo positioning in block (2)
-> + Filtering with XSLT not workin... (3)
-> + Petri net to BPEL model transf... (3)
-> + Selecting specific child eleme... (2)
-> + Grouping and summing ... (3)
-> + XSL-FO question: can't get ext... (2)
-> + for each with a parallel nodel... (3)
-> + unable to load schmea with tar... (5)
-> + Translating svg path data to x... (5)
-- Previous [1321-1340] [1341-1360] [1361-1380] Next
+ XQuery Help and Discussion (2017)
+ Stylus Studio FAQs (159)
+ Stylus Studio Code Samples & Utilities (364)
+ Stylus Studio Announcements (113)
Topic  
Postnext
giancarlo rossiSubject: relative path 2
Author: giancarlo rossi
Date: 06 Sep 2006 11:15 AM
Hi Guys I'm becoming crazy about get a relative path
in a for each cycle.

I have this root:="/CommandList/CheckRouting/RouterList/Router/GroupList/Group

group could contain the following childnode:

OutwardList/Outward and ReturnList/Return

In this cycle I need to display all the Outward/Id and the relative value in Return/Id

But I get this values:

Outward/Id --- Return/Id
OSJS0EYYLYIA8CW7 --- 6BD4GM0RZ7EFPAON
4XF58J3G9795GQAO --- 6BD4GM0RZ7EFPAON
FB9ZW0FDS0RJ0RXI --- 6BD4GM0RZ7EFPAON
XA848KQXPOI76WM5 --- 6BD4GM0RZ7EFPAON


The Return/Id are the same for all the cycle.
It's wrong.


The code is:

<xsl:variable name="rootOW" select="/CommandList/CheckRouting/RouterList/Router/GroupList/Group/OutwardList/Outward" />
<xsl:for-each select="$rootOW" >
<xsl:sort select="Price/Amount" data-type="number" order="ascending" />
<xsl:value-of select="Id"/> --- <xsl:value-of select="../..//ReturnList/Return/Id"/><br/>
</xsl:for-each>

the document xml

www.lastminutesud.it/TEST/rt_test.xml

I hope you can help me.

Postnext
James DurningSubject: relative path 2
Author: James Durning
Date: 06 Sep 2006 01:37 PM
have you tried not using the variable? Also, using "//" is probably bad.

<xsl:for-each select="/CommandList/CheckRouting/RouterList/Router/GroupList/Group/OutwardList/Outward" >
<xsl:sort select="Price/Amount" data-type="number" order="ascending" />
<xsl:value-of select="Id"/> --- <xsl:value-of select="../../ReturnList/Return/Id"/><br/>
</xsl:for-each>

Postnext
giancarlo rossiSubject: relative path 2
Author: giancarlo rossi
Date: 06 Sep 2006 04:47 PM
no :|

I have the same results...

OSJS0EYYLYIA8CW7 --- 6BD4GM0RZ7EFPAON
4XF58J3G9795GQAO --- 6BD4GM0RZ7EFPAON
FB9ZW0FDS0RJ0RXI --- 6BD4GM0RZ7EFPAON
XA848KQXPOI76WM5 --- 6BD4GM0RZ7EFPAON

Postnext
(Deleted User) Subject: relative path 2
Author: (Deleted User)
Date: 07 Sep 2006 05:04 AM
We would need to see a sample of the input data, but it seem like the Group element probably has more than one OutwardList/Outward element, and more than one ReturnList/Return element.

That would generate the results you are seeing.

- clyde

Postnext
giancarlo rossiSubject: relative path 2
Author: giancarlo rossi
Date: 07 Sep 2006 08:00 AM
Yes there are different outward and different return nodes
Perhaps you mean the xml ?
see below...


<GroupList>
<Group>
<Id>NKI56H6IKP0G1K27</Id>
<OutwardList>
<Outward>
<Id>OSJS0EYYLYIA8CW7</Id>
<CacheInfo>
<CacheDataAgeSeconds>0</CacheDataAgeSeconds>
</CacheInfo>
<Price>
<Amount>93.68</Amount>
<Currency>EUR</Currency>
<PriceIncludesTax>true</PriceIncludesTax>
<TaxIsEstimated>false</TaxIsEstimated>
</Price>
<Duration>135</Duration>
<SegmentList>
<Segment>
<Origin>
<Type>airport</Type>
<Code>FCO</Code>
</Origin>
<Destination>
<Type>airport</Type>
<Code>MAD</Code>
</Destination>
<DepartDate>20/09/2006-21:15</DepartDate>
<ArriveDate>20/09/2006-23:30</ArriveDate>
<Duration>135</Duration>
<Operator>
<Name>vueling</Name>
<Code>VY</Code>
</Operator>
<VendingOperator>
<Name>vueling</Name>
<Code>VY</Code>
</VendingOperator>
<FlightId>
<Code>VY6873</Code>
<Number>6873</Number>
</FlightId>
<TravelClass>
<TfClass>Economy With Restrictions</TfClass>
<SupplierClass>Economy With Restrictions</SupplierClass>
</TravelClass>
<SegmentMayEndWithAStop>false</SegmentMayEndWithAStop>
</Segment>
</SegmentList>
<Vendor>
<Name>Vueling</Name>
<Url>http://www.vueling.com</Url>
</Vendor>
</Outward>
<Outward>
<Id>FB9ZW0FDS0RJ0RXI</Id>
<CacheInfo>
<CacheDataAgeSeconds>0</CacheDataAgeSeconds>
</CacheInfo>
<Price>
<Amount>103.68</Amount>
<Currency>EUR</Currency>
<PriceIncludesTax>true</PriceIncludesTax>
<TaxIsEstimated>false</TaxIsEstimated>
</Price>
<Duration>135</Duration>
<SegmentList>
<Segment>
<Origin>
<Type>airport</Type>
<Code>FCO</Code>
</Origin>
<Destination>
<Type>airport</Type>
<Code>MAD</Code>
</Destination>
<DepartDate>21/09/2006-11:25</DepartDate>
<ArriveDate>21/09/2006-13:40</ArriveDate>
<Duration>135</Duration>
<Operator>
<Name>vueling</Name>
<Code>VY</Code>
</Operator>
<VendingOperator>
<Name>vueling</Name>
<Code>VY</Code>
</VendingOperator>
<FlightId>
<Code>VY6033</Code>
<Number>6033</Number>
</FlightId>
<TravelClass>
<TfClass>Economy With Restrictions</TfClass>
<SupplierClass>Economy With Restrictions</SupplierClass>
</TravelClass>
<SegmentMayEndWithAStop>false</SegmentMayEndWithAStop>
</Segment>
</SegmentList>
<Vendor>
<Name>Vueling</Name>
<Url>http://www.vueling.com</Url>
</Vendor>
</Outward>
<Outward>
<Id>4XF58J3G9795GQAO</Id>
<CacheInfo>
<CacheDataAgeSeconds>0</CacheDataAgeSeconds>
</CacheInfo>
<Price>
<Amount>93.68</Amount>
<Currency>EUR</Currency>
<PriceIncludesTax>true</PriceIncludesTax>
<TaxIsEstimated>false</TaxIsEstimated>
</Price>
<Duration>135</Duration>
<SegmentList>
<Segment>
<Origin>
<Type>airport</Type>
<Code>FCO</Code>
</Origin>
<Destination>
<Type>airport</Type>
<Code>MAD</Code>
</Destination>
<DepartDate>21/09/2006-21:15</DepartDate>
<ArriveDate>21/09/2006-23:30</ArriveDate>
<Duration>135</Duration>
<Operator>
<Name>vueling</Name>
<Code>VY</Code>
</Operator>
<VendingOperator>
<Name>vueling</Name>
<Code>VY</Code>
</VendingOperator>
<FlightId>
<Code>VY6873</Code>
<Number>6873</Number>
</FlightId>
<TravelClass>
<TfClass>Economy With Restrictions</TfClass>
<SupplierClass>Economy With Restrictions</SupplierClass>
</TravelClass>
<SegmentMayEndWithAStop>false</SegmentMayEndWithAStop>
</Segment>
</SegmentList>
<Vendor>
<Name>Vueling</Name>
<Url>http://www.vueling.com</Url>
</Vendor>
</Outward>
<Outward>
<Id>XA848KQXPOI76WM5</Id>
<CacheInfo>
<CacheDataAgeSeconds>0</CacheDataAgeSeconds>
</CacheInfo>
<Price>
<Amount>113.68</Amount>
<Currency>EUR</Currency>
<PriceIncludesTax>true</PriceIncludesTax>
<TaxIsEstimated>false</TaxIsEstimated>
</Price>
<Duration>135</Duration>
<SegmentList>
<Segment>
<Origin>
<Type>airport</Type>
<Code>FCO</Code>
</Origin>
<Destination>
<Type>airport</Type>
<Code>MAD</Code>
</Destination>
<DepartDate>22/09/2006-21:15</DepartDate>
<ArriveDate>22/09/2006-23:30</ArriveDate>
<Duration>135</Duration>
<Operator>
<Name>vueling</Name>
<Code>VY</Code>
</Operator>
<VendingOperator>
<Name>vueling</Name>
<Code>VY</Code>
</VendingOperator>
<FlightId>
<Code>VY6873</Code>
<Number>6873</Number>
</FlightId>
<TravelClass>
<TfClass>Economy With Restrictions</TfClass>
<SupplierClass>Economy With Restrictions</SupplierClass>
</TravelClass>
<SegmentMayEndWithAStop>false</SegmentMayEndWithAStop>
</Segment>
</SegmentList>
<Vendor>
<Name>Vueling</Name>
<Url>http://www.vueling.com</Url>
</Vendor>
</Outward>
</OutwardList>
<ReturnList>
<Return>
<Id>6BD4GM0RZ7EFPAON</Id>
<CacheInfo>
<CacheDataAgeSeconds>0</CacheDataAgeSeconds>
</CacheInfo>
<Price>
<Amount>77.46</Amount>
<Currency>EUR</Currency>
<PriceIncludesTax>true</PriceIncludesTax>
<TaxIsEstimated>false</TaxIsEstimated>
</Price>
<Duration>130</Duration>
<SegmentList>
<Segment>
<Origin>
<Type>airport</Type>
<Code>MAD</Code>
</Origin>
<Destination>
<Type>airport</Type>
<Code>FCO</Code>
</Destination>
<DepartDate>28/09/2006-07:20</DepartDate>
<ArriveDate>28/09/2006-09:30</ArriveDate>
<Duration>130</Duration>
<Operator>
<Name>vueling</Name>
<Code>VY</Code>
</Operator>
<VendingOperator>
<Name>vueling</Name>
<Code>VY</Code>
</VendingOperator>
<FlightId>
<Code>VY6032</Code>
<Number>6032</Number>
</FlightId>
<TravelClass>
<TfClass>Economy With Restrictions</TfClass>
<SupplierClass>Economy With Restrictions</SupplierClass>
</TravelClass>
<SegmentMayEndWithAStop>false</SegmentMayEndWithAStop>
</Segment>
</SegmentList>
<Vendor>
<Name>Vueling</Name>
<Url>http://www.vueling.com</Url>
</Vendor>
</Return>
<Return>
<Id>ZLTLT42PPT20VMM1</Id>
<CacheInfo>
<CacheDataAgeSeconds>0</CacheDataAgeSeconds>
</CacheInfo>
<Price>
<Amount>77.46</Amount>
<Currency>EUR</Currency>
<PriceIncludesTax>true</PriceIncludesTax>
<TaxIsEstimated>false</TaxIsEstimated>
</Price>
<Duration>130</Duration>
<SegmentList>
<Segment>
<Origin>
<Type>airport</Type>
<Code>MAD</Code>
</Origin>
<Destination>
<Type>airport</Type>
<Code>FCO</Code>
</Destination>
<DepartDate>28/09/2006-18:10</DepartDate>
<ArriveDate>28/09/2006-20:20</ArriveDate>
<Duration>130</Duration>
<Operator>
<Name>vueling</Name>
<Code>VY</Code>
</Operator>
<VendingOperator>
<Name>vueling</Name>
<Code>VY</Code>
</VendingOperator>
<FlightId>
<Code>VY6857</Code>
<Number>6857</Number>
</FlightId>
<TravelClass>
<TfClass>Economy With Restrictions</TfClass>
<SupplierClass>Economy With Restrictions</SupplierClass>
</TravelClass>
<SegmentMayEndWithAStop>false</SegmentMayEndWithAStop>
</Segment>
</SegmentList>
<Vendor>
<Name>Vueling</Name>
<Url>http://www.vueling.com</Url>
</Vendor>
</Return>
<Return>
<Id>0GCK4LLOVATZRJVP</Id>
<CacheInfo>
<CacheDataAgeSeconds>0</CacheDataAgeSeconds>
</CacheInfo>
<Price>
<Amount>77.46</Amount>
<Currency>EUR</Currency>
<PriceIncludesTax>true</PriceIncludesTax>
<TaxIsEstimated>false</TaxIsEstimated>
</Price>
<Duration>130</Duration>
<SegmentList>
<Segment>
<Origin>
<Type>airport</Type>
<Code>MAD</Code>
</Origin>
<Destination>
<Type>airport</Type>
<Code>FCO</Code>
</Destination>
<DepartDate>29/09/2006-18:10</DepartDate>
<ArriveDate>29/09/2006-20:20</ArriveDate>
<Duration>130</Duration>
<Operator>
<Name>vueling</Name>
<Code>VY</Code>
</Operator>
<VendingOperator>
<Name>vueling</Name>
<Code>VY</Code>
</VendingOperator>
<FlightId>
<Code>VY6857</Code>
<Number>6857</Number>
</FlightId>
<TravelClass>
<TfClass>Economy With Restrictions</TfClass>
<SupplierClass>Economy With Restrictions</SupplierClass>
</TravelClass>
<SegmentMayEndWithAStop>false</SegmentMayEndWithAStop>
</Segment>
</SegmentList>
<Vendor>
<Name>Vueling</Name>
<Url>http://www.vueling.com</Url>
</Vendor>
</Return>
<Return>
<Id>O9MDS1GSQZY82PTI</Id>
<CacheInfo>
<CacheDataAgeSeconds>0</CacheDataAgeSeconds>
</CacheInfo>
<Price>
<Amount>87.46</Amount>
<Currency>EUR</Currency>
<PriceIncludesTax>true</PriceIncludesTax>
<TaxIsEstimated>false</TaxIsEstimated>
</Price>
<Duration>130</Duration>
<SegmentList>
<Segment>
<Origin>
<Type>airport</Type>
<Code>MAD</Code>
</Origin>
<Destination>
<Type>airport</Type>
<Code>FCO</Code>
</Destination>
<DepartDate>30/09/2006-07:20</DepartDate>
<ArriveDate>30/09/2006-09:30</ArriveDate>
<Duration>130</Duration>
<Operator>
<Name>vueling</Name>
<Code>VY</Code>
</Operator>
<VendingOperator>
<Name>vueling</Name>
<Code>VY</Code>
</VendingOperator>
<FlightId>
<Code>VY6032</Code>
<Number>6032</Number>
</FlightId>
<TravelClass>
<TfClass>Economy With Restrictions</TfClass>
<SupplierClass>Economy With Restrictions</SupplierClass>
</TravelClass>
<SegmentMayEndWithAStop>false</SegmentMayEndWithAStop>
</Segment>
</SegmentList>
<Vendor>
<Name>Vueling</Name>
<Url>http://www.vueling.com</Url>
</Vendor>
</Return>
<Return>
<Id>G7OXJX6MPSBDDF72</Id>
<CacheInfo>
<CacheDataAgeSeconds>0</CacheDataAgeSeconds>
</CacheInfo>
<Price>
<Amount>97.46</Amount>
<Currency>EUR</Currency>
<PriceIncludesTax>true</PriceIncludesTax>
<TaxIsEstimated>false</TaxIsEstimated>
</Price>
<Duration>130</Duration>
<SegmentList>
<Segment>
<Origin>
<Type>airport</Type>
<Code>MAD</Code>
</Origin>
<Destination>
<Type>airport</Type>
<Code>FCO</Code>
</Destination>
<DepartDate>30/09/2006-18:10</DepartDate>
<ArriveDate>30/09/2006-20:20</ArriveDate>
<Duration>130</Duration>
<Operator>
<Name>vueling</Name>
<Code>VY</Code>
</Operator>
<VendingOperator>
<Name>vueling</Name>
<Code>VY</Code>
</VendingOperator>
<FlightId>
<Code>VY6857</Code>
<Number>6857</Number>
</FlightId>
<TravelClass>
<TfClass>Economy With Restrictions</TfClass>
<SupplierClass>Economy With Restrictions</SupplierClass>
</TravelClass>
<SegmentMayEndWithAStop>false</SegmentMayEndWithAStop>
</Segment>
</SegmentList>
<Vendor>
<Name>Vueling</Name>
<Url>http://www.vueling.com</Url>
</Vendor>
</Return>
</ReturnList>
<Price>
<PriceIncludesTax>true</PriceIncludesTax>
<TaxIsEstimated>false</TaxIsEstimated>
</Price>
</Group>
</GroupList>

Postnext
(Deleted User) Subject: relative path 2
Author: (Deleted User)
Date: 07 Sep 2006 10:32 AM
Within 1 Group element, you have 4 OutwardList/Outward elements and
5 ReturnList/Return elements. You seem to be trying to match an Outward
element with a Return element by walking upward with ../.. to the Group
element, then back down to the Return element, but your code contains
nothing to tell the xslt which of the several Return elements you want.

First, you need to clarify to yourself, exactly what is the nature of
the data, and what is the goal of the xslt, then you should be able
to write the correct .xslt

Hope this helps
clyde

Postnext
giancarlo rossiSubject: relative path 2
Author: giancarlo rossi
Date: 07 Sep 2006 11:20 AM
my target is join the first outward with the first return
and so on the second outward with the second return.

It doesnt matter if have one more return Item, becouse the for each is based on outward.

I need only the right way able to get the outward[1] and its related return[1] or following:

outward[2]with return[2]
outward[3]with return[3]

Postnext
(Deleted User) Subject: relative path 2
Author: (Deleted User)
Date: 07 Sep 2006 11:53 AM
You will need to use the position() of the Outward element within the OutwardList element, to select the correct Return element from the ReturnList.
To do this you need one for-each to iterate over all the Group elements, and within that, something like this:
<xsl:for-each OutwardList/Outward>
<xsl:variable name="pos" select="position()"/>
<xsl:value-of select="../../ReturnList/Return[$pos]"/>
</xsl:for-each>

The outer for-each will create a big node list which you can assign to a variable and then sort to get your desired sort order.

Hope this helps
- clyde

Postnext
Andy GalvanSubject: relative path 2
Author: Andy Galvan
Date: 11 Sep 2006 06:30 PM
Or, use use the position of the Outward element when referencing the Return element, within the same for-each...

<xsl:variable name="rootOW" select="/GroupList/Group/OutwardList/Outward"/>
<xsl:for-each select="$rootOW">
<xsl:sort select="Price/Amount" data-type="number" order="ascending"/>
<xsl:variable name="pos" select="count(preceding-sibling::Outward)+1"/>
<br><xsl:value-of select="Id"/> --- <xsl:value-of select="../../ReturnList/Return[$pos]/Id"/></br>
</xsl:for-each>

Posttop
giancarlo rossiSubject: relative path 2
Author: giancarlo rossi
Date: 12 Sep 2006 06:43 AM
I solved this ..
thanks a lot.

   
Download A Free Trial of Stylus Studio 6 XML Professional Edition Today! Powered by Stylus Studio, the world's leading XML IDE for XML, XSLT, XQuery, XML Schema, DTD, XPath, WSDL, XHTML, SQL/XML, and XML Mapping!  
go

Log In Options

Site Map | Privacy Policy | Terms of Use | Trademarks
Stylus Scoop XML Newsletter:
W3C Member
Stylus Studio® and DataDirect XQuery ™are from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2016 All Rights Reserved.