[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] Sorting and Grouping revisited


Subject: Re: [xsl] Sorting and Grouping revisited
From: Jeni Tennison <mail@xxxxxxxxxxxxxxxx>
Date: Thu, 19 Apr 2001 08:39:09 +0100

Hi Mike,

> This isn't really a question, other than to ask, 'am I crazy for
> expecting XSLT to be able to handle sorting and grouping
> gracefully?'

No, you're not.  XSLT handles *sorting* fairly well, but it doesn't
handle grouping at all well, and won't until XSLT 2.0.  There are
techniques for doing grouping that work OK, but they're not
particularly easy to get to grips with - see
http://www.jenitennison.com/xslt/grouping for more details.

> It seems to me the best bet for accomplishing what I need to do is
> to restructure my XML. As another member of this group noted, this
> is changing the data subtly for a presentation reason. This seems
> wrong.

It's 'wrong' if you change the *underlying* XML to suit the
presentation. However, you could have a preprocessing stylesheet that
takes the XML data and sorts it, before the data is then passed on to
the presentational stylesheet. This isn't 'wrong' at all - in fact
it's a good approach to the problem, better than performing the
complex transformation in a single step.

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/



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



Current Thread
Keywords