RE: [xsl] FW: Troubleshooting a sort

Subject: RE: [xsl] FW: Troubleshooting a sort
From: "Andreas L. Delmelle" <a_l.delmelle@xxxxxxxxxx>
Date: Thu, 19 Feb 2004 20:23:13 +0100
> -----Original Message-----
> From: Grant, Kathryn
>
> Thanks for the idea--unfortunately, it didn't work. The first
> four sorts still worked fine, but this time the Status sort
> simply repeated the status of the first record for all the
> records. I guess this is one of those //-related bugs you were
> talking about :)
>
> If anyone has any other ideas, I'd welcome them.
>

Hi,

I have a vague suspicion that the culprit of your little problem is actually
the use of the last() function... (in combo with the sorted for-each)

What exactly do you need to achieve there?

If you need the last status element of the current SAVEIdea, you could try
something like the following :

change the last table-cell to

  <td style="font-size:8pt" valign="top">
    <xsl:apply-templates select="status_history">
      <xsl:sort select="{sort-on}" />
    </xsl:apply-templates>
  </td>

and add the following template to your stylesheet

<xsl:template match="status_history">
  <xsl:value-of select="status[last()]" />
</xsl:template>

This way, the context for the last() function will be correctly switched to
the sorted set of status elements in the current SAVEIdea being processed,
rather than the last one in the node-set you are processing with the
for-each.

Hope this helps!

Cheers,

Andreas


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread