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

Re: How to sort and compare with different element val

Subject: Re: How to sort and compare with different element value in XSL
From: "Martin Honnen martin.honnen@xxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 9 Sep 2016 09:38:04 -0000
Re:  How to sort and compare with different element val
On 09.09.2016 11:25, Rahul Singh rahulsinghindia15@xxxxxxxxx wrote:
I have only one XML. and there <Nid> contains same data like 892828740.
I want get the Id,LastModifiedDate,Nid for Contact based on updated
LastModifiedDate if <Nid> has more then one same kind of data. Below is
my Input data, XSL, expected output. But my code is not working fine

Here is an enhancement of the stylesheet David posted after your last question:


<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema">

<xsl:output method="xml" indent="yes" omit-xml-declaration="no"/>

<xsl:strip-space elements="*"/>

<xsl:template match="objects">
<xsl:copy>
<xsl:for-each-group select="Contact" group-by="Nid">
<xsl:for-each select="current-group()">
<xsl:sort select="xs:dateTime(LastModifiedDate)" order="descending"/>
<xsl:if test="position() eq 1">
<xsl:copy-of select="."/>
</xsl:if>
</xsl:for-each>
</xsl:for-each-group>
</xsl:copy>
</xsl:template>

</xsl:stylesheet>


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.