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
Show tree view Topic
Topic Page 1 2 3 4 5 6 7 8 9 Go to previous topicPrev TopicGo to next topicNext Topic
Postnext
giancarlo rossiSubject: for each with a parallel nodelist
Author: giancarlo rossi
Date: 31 Aug 2006 12:31 PM
Hi...

I have this situation:

<xsl:for-each select="/CommandList/CheckRouting/RouterList/Router[Complete='true']/GroupList/Group/OutwardList/Outward" > <xsl:variable name="root" select="/CommandList/CheckRouting/RouterList/Router[Complete='true']/GroupList/Group/ReturnList/Return" />


<xsl:variable name="totale">
<xsl:choose>
<xsl:when test="Price/Amount">
<xsl:value-of select="number(Price/Amount)"/> + <xsl:value-of select="number($root/Price/Amount)"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="//Group/Price/Amount/text()"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>

<xsl:for-each>

The problem is <xsl:value-of select="number($root/Price/Amount)"/>

Return the same results...
It should be following for each order and display the relative result.

The document: www.lastminutesud.it/test/901968736.xml

Postnext
Ivan PedruzziSubject: for each with a parallel nodelist
Author: Ivan Pedruzzi
Date: 01 Sep 2006 12:09 AM
Giancarlo,

The variable $root is assigned to an absolute expression that is not influenced by the context.

/CommandList/CheckRouting/RouterList/Router[Complete='true']/GroupList/Group/ReturnList/Return"

Considering that your context element is "Outward" may be you want
<xsl:variable name="root" select="../ReturnList/Return" />

Hope this helps
Ivan Pedruzzi
Stylus Studio Team

Posttop
giancarlo rossiSubject: for each with a parallel nodelist
Author: giancarlo rossi
Date: 01 Sep 2006 06:14 PM
Yes it works but now I found a sort problem...
It possible to sort by <xsl:variable name="totale"> ?

<xsl:variable name="rootOW" select="/CommandList/CheckRouting/RouterList/Router[Complete='true']/GroupList/Group/OutwardList/Outward" />
<xsl:for-each select="$rootOW" >
<xsl:variable name="root" select="../../ReturnList/Return" />

<xsl:variable name="totale">
<xsl:choose>
<xsl:when test="Price/Amount">
<xsl:value-of select="format-number(number(Price/Amount)+number($root/Price/Amount),'#.##')"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="//Group/Price/Amount/text()"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>


'my code..

</xsl:for-each>

 
Topic Page 1 2 3 4 5 6 7 8 9 Go to previous topicPrev TopicGo to next topicNext Topic
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.