ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> xsl-list
xsl-list
RE: [xsl] grouping, sorting, splitting
by Michael Kay other posts by this author
Apr 18 2005 3:28AM messages near this date
[xsl] grouping, sorting, splitting | RE: [xsl] xsl sort: using element attribute as sort key!
& XSLT 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@[...].com] 
>  Sent: 18 April 2005 11:12
>  To: xsl-list@[...].com
>  Subject: [xsl] 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
>  
>  --~------------------------------------------------------------------
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
>  To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
>  or e-mail: <mailto:xsl-list-unsubscribe@[...].com>
>  --~--
>  
>  



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe@[...].com> 
--~--
Thread:
Beowulf
Michael Kay

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved