xsl-list
[Top] [All Lists]

RE: Sorting by one of many

2004-06-24 06:21:46
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(_dot_)isuls(_at_)nls(_dot_)fi] 
Sent: 24 June 2004 11:50
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
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(_at_)lists(_dot_)mulberrytech(_dot_)com>
--+--





<Prev in Thread] Current Thread [Next in Thread>