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

Re: xsl Date Sorting referencing ID and data in a diff

Subject: Re: xsl Date Sorting referencing ID and data in a differentNode
From: Joerg Heinicke <joerg.heinicke@xxxxxx>
Date: Wed, 08 May 2002 01:57:00 +0200
xsl date diff
Hello Kumar,

you can add a further key to easily access the application-elements with closedate:

<xsl:key name="app-refs" match="stages/application" use="@idref"/>

With this key it's a bit easier to access the nodes, with which you want to sort your application-elements.

And I would change your first key so, that you are directly getting the application-element. I think the region_name is more or less uninteresting, it's only for grouping.

At the end the stylesheet looks like:

<xsl:key name="distinct-region" match="company/application" use="region_name"/>
<xsl:key name="app-refs" match="stages/application" use="@idref"/>


<xsl:template match="/">
<xsl:for-each select="rep/company/application[generate-id()=generate-id(key('distinct-region', region_name))]">
<xsl:value-of select="region_name"/>
<xsl:for-each select="key('distinct-region', region_name)">
<xsl:sort select="key('app-refs',@id)/closedate"/>
<xsl:value-of select="ssn"/>
<xsl:value-of select="key('app-refs',@id)/closedate"/>
<xsl:value-of select="key('app-refs',@id)/current"/>
</xsl:for-each>
</xsl:for-each>
</xsl:template>


Regards,

Joerg

XSL:

<?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"/>
</xsl:for-each>


</xsl:for-each>
</xsl:stylesheet>

</xsl:template>


Thanks in advance .. -Kumar


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


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.