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

RE: [xsl] Sorting by one of many


Subject: RE: [xsl] Sorting by one of many
From: "Michael Kay" <mhk@xxxxxxxxx>
Date: Thu, 24 Jun 2004 14:21:46 +0100

If you know that date1 precedes date2 in document order, and so on, you can
write

<xsl:sort select="(date1|date2|date3|date4)[1]"/>

In XSLT 2.0, you can do it whether or not the dates are in document order,
by writing

<xsl:sort select="(date1,date2,date3,date4)[1]"/>

Michael Kay 

> -----Original Message-----
> From: Isuls Matts [mailto:matts.isuls@xxxxxx] 
> Sent: 24 June 2004 11:50
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: [xsl] Sorting by one of many 
> 
> Hi
> 
> Challenging sort problem for me. The rows can hold one to 
> four dates and output should be sorted by only one. date1 
> being primary and if that is missing date2 and so on. How can 
> this be efficiently done?  
> 
> 
> <root>
> 	<row>
> 		<name>A</name>
> 		<date2>20040101</date2>
> 	</row>
> 	<row>
> 		<name>C</name>
> 		<date3>20040103</date3>
> 		<date4>20040109</date4>
> 	</row>
> 	<row>
> 		<name>B</name>
> 		<date1>20040102</date1>
> 		<date3>20040101</date3>
> 	</row>
> </root>
> 
> 
> //matts
> 
> 
> --+------------------------------------------------------------------
> 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@xxxxxxxxxxxxxxxxxxxxxx>
> --+--
> 
> 



Current Thread
Keywords