Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Sorting and eliminating duplicates

From: "Mark" <mfreeman@--------.--->
To: 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



transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent