[xsl] xsl Date Sorting referencing ID and data in a different Node

Subject: [xsl] xsl Date Sorting referencing ID and data in a different Node
From: "KUMAR NINGASHETTY" <kningashetty@xxxxxxxxxxxxxxxx>
Date: Tue, 07 May 2002 17:52:33 -0400

    Given a straight xml and with no ID and IDref's to refer i can Sort end result Datewise .
    IN the following XML i am having problem to sort by 'closedate' which is in  different node .
    In my XSL i use keys to group the data by Regions and display corresponding data beneath ..
    It seems to be little tricky to sort by <closedate> which is child of <stages> node by preserving 
    the exsiting key technique .
   Note : if the <closedate> is part of  /company/application then i am able to sort it though ...

  Any help appreciated ..

    Following is the XML and XSL i am having presently ...


 	<application id="768">
		<region_name><![CDATA[Region 4]]></region_name>
		<company_name><![CDATA[ABC Inc.]]></company_name>
	<application id="232">
             	<region_name><![CDATA[Region 4]]></region_name>
		<company_name><![CDATA[BBC Inc.]]></company_name>
	<application id="455">
             	<region_name><![CDATA[Region 4]]></region_name>
		<company_name><![CDATA[CCC Inc.]]></company_name>
	<application idref="768">
	<application idref="232">
	<application appsysidref="455">


<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>

<xsl:key name="distinct-region"  match="rep/company/application/region_name"  use="text()"/>

<xsl:template match="/">
<xsl:for-each select="rep/company/application/region_name[generate-id()=generate-id(key('distinct-region', text()))]">
    <xsl:value-of select="text()"/>
    <xsl:for-each select="key('distinct-region', text())">
        <xsl:variable name="appid" select="parent::application/@id"/>
    	<xsl:value-of select="parent::application/ssn"/>
    	<xsl:value-of select="ancestor::rep/stages/application[@idref=$appid]/closedate"/>
    	<xsl:value-of select="ancestor::rep/stages/application[@idref=$appid]/current"/>



Thanks in advance ..

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

Current Thread