Hi All,

I've been trying to solve this problem for a while now and just can't
get my head around this weird XSL business (Who comes up with a
language that only allows you to assign to a variable once?).

Given XML looking something like:

<Modifications>
   <Modification>
      <changeNumber>123<changeNumber>
      <comment>changes for 123<comment>
      <file>file1.cpp</file>
   </Modification>
   <Modification>
      <changeNumber>123<changeNumber>
      <comment>changes for 123<comment>
      <file>file2.cpp</file>
   </Modification>
   <Modification>
      <changeNumber>124<changeNumber>
      <comment>changes for 124<comment>
      <file>file1.cpp</file>
   </Modification>
   <Modification>
      <changeNumber>125<changeNumber>
      <comment>changes for 125<comment>
      <file>file1.cpp</file>
   </Modification>
   <Modification>
      <changeNumber>125<changeNumber>
      <comment>changes for 125<comment>
      <file>file2.cpp</file>
   </Modification>
<Modifications>

I want to see a table looking like:

   123   changes for 123
   124   changes for 123
   125   changes for 125

and not:

   123   changes for 123
   123   changes for 123
   124   changes for 123
   125   changes for 125
   125   changes for 125


That is; I what to not render a row if the change number for the
current row being rendered is the same as that of the preceeding row.

The closest I have come in my solution so far is:


<xsl:for-each select="//modification">
   <xsl:sort select="changeNumber" order="descending" data-
type="text" />
   <xsl:if test="(position() = 1) or (changeNumber != preceding-
sibling::modification[1]/changeNumber)">
      <tr>
         <td class="table-text" valign="top"> <xsl:value-of
select="changeNumber"/> </td>
         <td class="table-text" valign="top"> <xsl:value-of select="comment"/
> </td>
      </tr>
   </xsl:if>
</xsl:for-each>

But this seems to skip entries when I have long lists of
modifications.

So the challenge is layed down! Come on clever cloggs!

Please help,
Shaun

Reply via email to