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

RE: nesting sort/order-by statements

Subject: RE: nesting sort/order-by statements
From: Jonathan Marsh <jmarsh@xxxxxxxxxxxxx>
Date: Tue, 4 Apr 2000 14:15:54 -0700
xsl sort multiple criteria
You can specify multiple sort criteria (multiple xsl:sort elements in XSLT)
by semicolon-delimited list of patterns:

  <xsl:apply-templates select="BOOK" order-by="@CATEGORY ; @AUTHOR"/>

Ascending or descending is indicated by preceding each criteria by +
(optional) or -.  As you can see the ultimate of this approach is an
elaborate new string-based syntax.  I feel that the move to <xsl:sort> for
denoting sort criteria in XSLT is an improvement.

- Jonathan Marsh
  Microsoft

> -----Original Message-----
> From: Carlos Araya [mailto:elrond@xxxxxxxxxxxxxxxx]
> Sent: Tuesday, April 04, 2000 2:15 PM
> To: xsl-list@xxxxxxxxxxxxxxxx
> Subject: nesting sort/order-by statements
> 
> 
> Good afternoon:
> 
> I have the following IE5 XSL stylesheet and have a question.
> 
> 1. I am already sorting by ctegories (attribute of the BOOK 
> tag) I would
> like to sort the results of each category by author. Is that 
> possible with
> IE's XSL implementation. 
> 
> <?xml version="1.0"?> 
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">
> 
> <xsl:template match="/">
> 	<xsl:apply-templates select="BIBLIOGRAPHY"/>
> </xsl:template>
> 
> <xsl:template match="BIBLIOGRAPHY">        
> 	<html>
> 
> 	<head>
> 		<title>Annotated bibliography</title>
> 	</head>
> 
> 	<body>
> 		<h1>Annotated Bibliography</h1>
> 
> 		<h2>Table View of Titles, Author(s) and Comnets</h2>
> 
> 		<h3>Books</h3>
> 			<table border="2" padding="4" width="100%">
> 
> 			        <tr>
> 					<th>Category</th>
> 					<th>Title</th>
>         				<th>Author(s)</th>
> 					<th>Coment(s)</th>
> 				</tr>
> 			             	<xsl:apply-templates 
> select="BOOK" order-by="@CATEGORY"/>
> 			</table>
> 	<hr />
> 	<p>if you have any questions about this page, please contact
> Carlos Araya (<A 
> HREF="mailto:elrond@xxxxxxxxxxxxxxxx";>elrond@xxxxxxxxxxxxxxxx</A>)</p>
> 	</body>
> 	</html>
> </xsl:template>
> 
> 
> <xsl:template match="BOOK">
> 
> 	<tr>
> 		<td width="25%"><xsl:value-of select="@CATEGORY" /></td>
> 	
> 		<td width="25%"><span style="font-style: 
> italic;"><xsl:value-of select="TITLE"/></span></td>
> 
> 		<td width="20%">
> 		<xsl:for-each select="AUTHOR">		
> 			<xsl:value-of select="."/><br/>	
> 		</xsl:for-each>	
> 		</td>
> 
> 		<td width="30%">
> 		<xsl:for-each select="COMENT">		
> 			<xsl:value-of select="."/><br/>	
> 		</xsl:for-each>	
> 		</td>
> 
> 	</tr>
> 
> </xsl:template>
> </xsl:stylesheet>
> 
> --
> Carlos E. Araya
> WebCT Project Coordinator - New Media Specialist
> Alquist Center for Instrucctional Development
> San Jose State University
> 
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> 


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


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.