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

[xsl] Sorting Issue


Subject: [xsl] Sorting Issue
From: "SHEIKH Sajjad" <Sajjad.SHEIKH@xxxxxxxxxxx>
Date: Wed, 21 Jan 2004 15:56:53 +0100

Hi all,

Following style sheet processes multiple xml documents (lets say
file1.xml, file5.xml and file8.xml).
It will sort all the results by modificationDate seperately and will
output the results as following.

link1	021203	(From File1)
link2	011203	(From File1)
link3	101103	(From File5)
link4	031203	(From File8)
link5	091103	(From File8)


I want to sort everything together.  For example,

link4	031203	(From File8)
link1	021203	(From File1)
link2	011203	(From File1)
link3	101103	(From File5)
link5	091103	(From File8)

Any suggestions?
Regards,
/s


<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template match="/">
  <xsl:apply-templates select="/someURIs/file"/>
</xsl:template>

<xsl:template match="file">
  <xsl:variable name="copy_current_file" select="document(string(.))"/>
    <table><xsl:apply-templates select="$copy_current_file/ll"/></table>
</xsl:template>

<xsl:template match="ll">

	<xsl:variable name="find_file">
<xsl:for-each select="loc">
 <xsl:if test="position()=last()-1">(From <b><xsl:value-of
select="."/></b>)</xsl:if>
</xsl:for-each>
	</xsl:variable>

 <xsl:for-each select="*//lln">
  <xsl:sort select="@modificationDate" order="descending"/>
      <xsl:choose>
       <xsl:when test="@objectname='Folder'">
	<tr>
	 <td>
		<a href="{@docname}/l.shtml">
	  	 <xsl:value-of select="n/@docname"/>
		</a>	
	 </td>
	 <td>
      		<xsl:value-of select="@identity"/>
	 </td>
	 <td>
      		<xsl:value-of select="@modificationDate"/>
	 </td>

		<td><xsl:value-of select="$find_file"/></td>

	</tr>	
       </xsl:when>
      </xsl:choose>
 </xsl:for-each>
</xsl:template>

</xsl:stylesheet>

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



Current Thread
Keywords
xml