Topic: Bug of ignoring of repeating nodes using xslt Pages that link to <a href="https://ozoneasylum.com/backlink?for=30456" title="Pages that link to Topic: Bug of ignoring of repeating nodes using xslt" rel="nofollow" >Topic: Bug of ignoring of repeating nodes using xslt\

 
Author Thread
posdnyaa
Neurotic (0) Inmate
Newly admitted

From:
Insane since: Aug 2008

IP logged posted posted 08-02-2008 17:30 Edit Quote

I?ve got the problem.
I have xml:

code:
<root>
<Info Currency="USD" Denomination="20" amount="21" />
<Info Currency="RUB" Denomination="10" amount="12" />
<Info Currency="RUB" Denomination="10" amount="22" />
<Info Currency="RUB" Denomination="100" amount="12" />
<Info Currency="RUB" Denomination="500" amount="91" />
<Info Currency="RUB" Denomination="10" amount="521" />
<Info Currency="USD" Denomination="100" amount="21" />
</root>



I want to get sorted ascending list of denominations where Currency="RUB" (I mean 10 100 500).
I can do it using xslt:

code:
<xsl:for-each select="root/Info[(not(@Denomination=preceding-sibling::Info/@Denomination)) and @Currency='RUB']">
<xsl:sort select="@Denomination" data-type="number" order="ascending" />
<xsl:value-of select="@Denomination"/> &#1088;&#1091;&#1073;.<br/>
</xsl:for-each>



BUT if Denomination in the first line of xml replace by 10
<Info Currency="USD" Denomination="10" amount="21" />
the condition
[(not(@Denomination=preceding-sibling::Info/@Denomination)) and @Currency='RUB']
will see this line and as result the list of denominations wil be 100 500 (instead of 10 100 500).
10 is absent.
Why does not it work. Where is the mistake?

posdnyaa
Obsessive-Compulsive (I) Inmate

From:
Insane since: Aug 2008

IP logged posted posted 08-02-2008 19:15 Edit Quote

Solution has found

[(not(@Denom=preceding-sibling::Info[@Currency='RUB']/@Denom)) and @Currency='RUB']



Post Reply
 
Your User Name:
Your Password:
Login Options:
 
Your Text:
Loading...
Options:


« BackwardsOnwards »

Show Forum Drop Down Menu