Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries [Thread Prev] >Thread Next - Re: Sorting and eliminating duplicates Sorting and eliminating duplicatesTo: NULL Date: 4/6/2006 8:01:00 AM
Hi all.
I have xsl document that transforms an xml document. My xml looks like
this:
<Data>
<Country Key='001' Name='Afghanistan'>
<Indicator KEY='001' FootnoteKEY='3' Footnote='Test3'></Indicator>
<Indicator KEY='002' FootnoteKEY='' Footnote=''></Indicator>
<Indicator KEY='003' FootnoteKEY='' Footnote=''></Indicator>
<Indicator KEY='004' FootnoteKEY='2' Footnote='Test2'></Indicator>
</Country>
<Country Key='002' Name='US'>
<Indicator KEY='005 FootnoteKEY='3' Footnote='Test3'></Indicator>
<Indicator KEY='006' FootnoteKEY='' Footnote=''></Indicator>
<Indicator KEY='007' FootnoteKEY='' Footnote=''></Indicator>
<Indicator KEY='008' FootnoteKEY='1' Footnote='Test1'></Indicator>
</Country>
</Data>
The output I'm looking for is:
Footnotes:
1 Test1
2 Test2
3 Test3
My XSL is:
<table>
<xsl:for-each select="//Country[@KEY = $istCountry]">
<xsl:for-each select="Indicator[@KEY = $lstIndicator]">
<xsl:sort select="@FootnoteKEY"/>
<xsl:if test="normalize-space(@FootnoteKEY)">
<tr>
<td>
<xsl:value-of select="FootnoteKEY"/>
</td>
<td>
<xsl:value-of select="Footnote"/>
</td>
</tr>
</xsl:if>
</xsl:for-each>
<xsl:for-each>
</table>
This gives the output that you would expect:
Footnotes:
2 Test2
3 Test3
1 Test1
3 Test3
I have two problems, duplicate footnotes, and the order is not correct.
Can anyone offer some advise? The duplicates thing, I can probably
figure out eventually, but the order, because they are in two different
for-each loops, I can't seem to grasp. I think I need to put them in
the same for-each loop somehow, but I'm passing two parameters, a list
of countries to return and a list of indicators to return.
Thanks,
- Mark
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
