Re: [xsl] Recursive teplate (sort)

Subject: Re: [xsl] Recursive teplate (sort)
From: "Giancarlo Rossi" <giancarlo_rossi@xxxxxxxxxx>
Date: Tue, 10 Oct 2006 13:35:17 +0200
I'm using xsl 1.0


I cant use <xsl:for-each select="/root/my_node/my_node_parallel">
Becouse the results will be not correct.


The real template is below:

<xsl:template> 
<xsl:variable name="eur_currency" 
select="number(document('valute1.xml')/CommandList/GetCurrencies/CurrencyLi-
st/Currency/Code[. 
='EUR']/following-sibling::UsdRate[1])"/> 
<xsl:for-each 
select="/CommandList/CheckRouting/RouterList/Router[Complete='true']/GroupL-
ist/Group" 


<xsl:variable name="prezzo_gruppo" select="Price/Amount" /> 
<xsl:variable name="valuta_gruppo" select="Price/Currency" /> 
<xsl:variable name="valore_gruppo" 
select="number(document('valute1.xml')/CommandList/GetCurrencies/CurrencyLi-
st/Currency/Code[. 
=$valuta_gruppo]/following-sibling::UsdRate[1])"/> 
<xsl:variable name="prezzo_unico" 
select="format-number((($prezzo_gruppo) div ($valore_gruppo)) * 
$eur_currency,'#.##')" /> 

<xsl:for-each select="OutwardList/Outward" > 


<xsl:for-each select="../../ReturnList/Return" > 

<xsl:variable name="valuta_ow" 
select="../../OutwardList/Outward[$pos]/Price/Currency" /> 
<xsl:variable name="valore_ow" 
select="number(document('valute1.xml')/CommandList/GetCurrencies/CurrencyLi-
st/Currency/Code[. 
=$valuta_ow]/following-sibling::UsdRate[1])"/> 
<xsl:variable name="valuta_rt" 
select="../../ReturnList/Return[$posrt]/Price/Currency" /> 
<xsl:variable name="valore_rt" 
select="number(document('valute1.xml')/CommandList/GetCurrencies/CurrencyLi-
st/Currency/Code[.=$valuta_rt]/following-sibling::UsdRate[1])"/> 
<xsl:variable name="valuta_un" 
select="../../ReturnList/Return[$posrt]/Price/Currency" /> 
<xsl:variable name="valore_un" 
select="number(document('valute1.xml')/CommandList/GetCurrencies/CurrencyLi-
st/Currency/Code[.=$valuta_rt]/following-sibling::UsdRate[1])"/> 
<xsl:variable name="prezzo_ow" 
select="format-number(((../../OutwardList/Outward[$pos]/Price/Amount) 
div ($valore_ow)) * ($eur_currency),'#.##')"/> 
<xsl:variable name="prezzo_rt" 
select="format-number(((../../ReturnList/Return[$posrt]/Price/Amount) 
div ($valore_rt)) * ($eur_currency),'#.##')"/> 


<xsl:variable name="totale_finale" > 
<xsl:choose> 
<xsl:when test="Price/Amount"> 
<xsl:value-of select="($prezzo_ow) + ($prezzo_rt)" /> 
</xsl:when> 
<xsl:otherwise> 
<xsl:value-of select="$prezzo_unico" /> 
</xsl:otherwise> 
</xsl:choose> 
</xsl:variable> 


<xsl:value-of select="format-number($totale_finale,'#.##')" /> 


</xsl:template> 

Current Thread