RE: [xsl] Applying two transformations consecutively

Subject: RE: [xsl] Applying two transformations consecutively
From: "Schwartz, Rechell R, NLCIO" <rrschwartz@xxxxxxx>
Date: Wed, 27 Jun 2001 14:52:28 -0400

I tried your second approach (since sometimes I may have multiple rows of
and it did the trick. Thanks so much for the great solution!

Rechell Schwartz

-----Original Message-----
From: Jeni Tennison [mailto:mail@xxxxxxxxxxxxxxxx]
Sent: Monday, June 25, 2001 1:09 PM
To: Schwartz, Rechell R, NLCIO
Cc: 'xsl-list@xxxxxxxxxxxxxxxxxxxxxx'; Griebel, Peer
Subject: Re: [xsl] Applying two transformations consecutively

Hi Rechell,

> Thanks for your suggestions. One thing that may complicate things is
> that I do my sorting based on parameters that the user enters at
> run-time that specify the desired column to sort on, whether the
> column should be sorted as text or as a number and whether the sort
> is ascending or descending. I tried to incorporate your suggestions,
> but failed. Can you help me adjust my stylesheet so that I can get
> the TOTAL to stay on the bottom (and perhaps to keep the zero on the
> top until Apache fixes their bug)?

It sounds as if you always want the last row to appear at the bottom
of your table. In that case it's probably easier to have the
xsl:apply-templates work on all the rows save the last, with that
being sorted according to your parameters, and then output the result
of applying templates to the last row:

  <xsl:apply-templates select="row[position() != last()]">
     <xsl:sort select="*[name() = $sortcolumn]"
               data-type="{$sort_type}" order="{$sortorder}" />
  <xsl:apply-templates select="row[last()]" />

Otherwise, I think that it works out OK to just always sort on that
particular column, first boolean on whether it's a number, second by
number and finally by text. Note that the first sort is the other way
round from how I did it before, to get the text to sort after the
numbers rather than the other way around, but that this is fixed
rather than using the $sortorder parameter so that the TOTAL row is
always after the numerical ones, but this means that the sort order
for the rows might not be exactly what you want:

  <xsl:apply-templates select="row">
     <xsl:sort select="number(*[name() = $sortcolumn]) or
                       number(*[name() = $sortcolumn]) = 0"
               order="descending" />
     <xsl:sort select="*[name() = $sortcolumn]"
               data-type="number" order="{$sortorder}" />
     <xsl:sort select="*[name() = $sortcolumn]"
               data-type="text" order="{$sortorder}" />



Jeni Tennison

 XSL-List info and archive:

Current Thread