Re: [xsl] Relative path

Subject: Re: [xsl] Relative path
From: Abel Braaksma <abel.online@xxxxxxxxx>
Date: Thu, 07 Sep 2006 13:52:57 +0200
Hi Giancarlo,

I'd like to help you, but your document on http://www.lastminutesud.it/TEST/rt_test.xml gives a 404 error. Also, please update your clock: your messages to the list have a date of 2003-09-06, about 3 years back (two other posts from you had the same prb). Ending up below in the inbox as a result of a date so far back, may make that people cannot find/see your posts.

<xsl:value-of select="../..//ReturnList/Return/Id"/>

You move up two levels, then you say "descendant-or-self" (expensive operation), which means that on any level, no matter how deep, starting from ../.. you request for all paths having ReturnList/Return/Id. And from this parent path, you end up requesting only the first. Suppose the path is inside your $rootOW, and you want the first of those, this might be better:

<xsl:value-of select="ReturnList/Return/Id"/>

But I need to see the XML for that.

Cheers,

Abel Braaksma
http://abelleba.metacarpus.com





Giancarlo Rossi wrote:
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/OutwardL
ist/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.

Current Thread