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

RE: custom xsl sorting

Subject: RE: custom xsl sorting
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Thu, 8 Sep 2005 17:28:52 +0100
xsl custom sort
As well as the solution using keys, an alternative using XSLT 2.0 if the
number of periods is small is

<xsl:sort select="index-of(('bronze', 'byzantine', 'roman', 'islamic'),
@period)"/>

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

> -----Original Message-----
> From: srinivas vemuri [mailto:s_vas98@xxxxxxxxx] 
> Sent: 08 September 2005 04:01
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  custom xsl sorting
> 
> Hi,
> 
> I have to perform xsl sorting based on time period
> instead of regular ascii or integer based sorting. For
> ex: According to ascii, BYZANTINE  comes before MIDDLE
> BRONZE. But, according to this sort(time period):
> MIDDLE BRONZE comes before BYZANTINE. 
> 
> My initial idea is like this. A separate xml:
> 'period.xml' has this period to ascii mapping.
> <entry period="middlebronze">1</entry>
> <entry period="byzantine">2</entry>
> <entry period="Roman">3</entry>
> <entry period="islamic">4</entry>
> ......
> ----------------------------------------
> Now, my stylesheet should be applied to a dynamic xml
> page & should order period values occur in that page.
> 
> <dynamicpage>
> <val>Roman</val>
> <val>Islamic</val>
> <val> byzantine </val>
> </dynamicpage>
> 
> desired output after xslt application:
> 
> byzantine,  Roman, Islamic
> 
> Please help regarding how xslt should look like?
> 
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around 
> http://mail.yahoo.com 

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.