Topic: Bug of ignoring of repeating nodes using xslt (Page 1 of 1) 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 (Page 1 of 1)" rel="nofollow" >Topic: Bug of ignoring of repeating nodes using xslt <span class="small">(Page 1 of 1)</span>\

 
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: Remember Me On This Computer
 
Your Text:
Loading...
Options: Show Signature
Enable Slimies
Enable Linkwords

« BackwardsOnwards »

Show Forum Drop Down Menu