Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Help - To eliminate duplicate information in selected sorted rows

From: "Matt B" <matt.bourkeNOT@------.--->
To: NULL
Date: 10/7/2005 9:57:00 PM
Can somebody help me with this please...

I have an xml file along the lines of

<results>
    <result status="Pass">
      <person name="Fred"/>
      <subject name="English" />
    </result>
    <result status="Pass">
      <person name="Harry"/>
      <subject name="Maths" />
    </result>
    <result status="Fail">
      <person name="Fred"/>
      <subject name="History" />
    </result>
    <result status="Fail">
      <person name="Harry"/>
      <subject name="English" />
    </result>
    <result status="Pass">
      <person name="Fred"/>
      <subject name="Maths" />
    </result>
    <result status="Pass">
      <person name="Harry"/>
      <subject name="History" />
    </result>
</results>

And need to generate html for all result staus="Passes" sorted and displayed
like this:

Passes:
Name Subject
------ --------
Fred   English
-         Maths
Harry History
-         Maths

My best attempt so far is:

...
<xsl:for-each select="results/result[@status='Pass']">
  <xsl:sort select="person/@name"/>
  <tr>
    <td>
      <xsl:value-of select="person/@name"/>
      <xsl:value-of select="subject/@name"/>
    </td>
   </tr>
</xsl:for-each>
...

Which gives:

Passes:
Name Subject
------ --------
Fred   English
Fred   Maths
Harry History
Harry  Maths

The problems as I see it are that the output is a sub-set af the whole data,
and it is sorted.

Any ideas on how to remove the duplicate entries in the first column would
be very welcome.

-- 
Matt




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