[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: grouping, sorting, splitting

Subject: RE: grouping, sorting, splitting
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Mon, 18 Apr 2005 13:41:06 +0100
xsl sort into groups
> Is that something I'd need XSLT2.0 for or am I misunderstanding the
> RTF thing from XSLT1.0?

You can do multiphase transformations in 1.0 provided your processor offers
the xx:node-set() extension.

Alternatively, you can do each phase using a separate stylesheet.

Michael Kay
http://www.saxonica.com/

> 
> On 4/18/05, Michael Kay <mike@xxxxxxxxxxxx> wrote:
> > You should do this as a pipelined (or multi-phase) 
> transformation. Put the
> > results of the first grouping/sorting operation in a 
> variable (a temporary
> > tree) and then apply another transformation to put the 
> elements into groups
> > of three.
> > 
> > Michael Kay
> > http://www.saxonica.com/
> > 
> > 
> > > -----Original Message-----
> > > From: beowulf [mailto:carisenda@xxxxxxxxx]
> > > Sent: 18 April 2005 11:12
> > > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> > > Subject:  grouping, sorting, splitting
> > >
> > > Hi,
> > >
> > > I have XML if the form:
> > >
> > > <page>
> > > <entry date="2005-04-15">
> > >  <title>foo</title>
> > > </entry>
> > > <entry date="2005-04-15">
> > >  <title>bar</title>
> > > </entry>
> > > <entry date="2005-02-05">
> > >  <title>baz</title>
> > > </entry>
> > > ...
> > > </page>
> > >
> > > Which I am trying to group by date, sort by tiltle and 
> then split into
> > > sets of 3, 3 being the number of columns in the HTML 
> TABLE element I
> > > am trying to produce as an end result.
> > >
> > > I've got the grouping and sorting:
> > > <xsl:for-each select="entry[key('days', @date) and 
> count(.|key('days',
> > > @date)[1])= 1]">
> > > <xsl:sort select="title"/>
> > >
> > > and I've even got the first item in each group of three from that
> > > grouped and sorted set:
> > > <xsl:for-each select="key('days', @date)[position() mod 3 = 1]">
> > >
> > > But I just can't seem to make the final leap to displaying the
> > > following siblings of the above, making the 3 cell rows. 
> Should I be
> > > doing this some other way or can someone help me where I am?
> > >
> > > Many thanks,
> > > Stephen
> > 
> > 
> 
> 
> -- 
> "Nothing spoils fun like learning how it builds character."
> Calvin, Calvin & Hobbes

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.