I am looking at some reference to sort on date in the format that's in
my XML. From below XML I need to sort on filing, then state and then
rxTimestamp. Below are the details:
1. xml file;
<body>
<ns2:getMessages xmlns:ns2="http://www.abc.com/wsdl/v">
<ret>
<Msg>
<cid>103850015_0_1219420995471</cid>
<fid>41</fid>
<filing>IS</filing>
<State>PENDING</State>
<rxTimestamp>2008-08-25T16:54:55.839-07:00</rxTimestamp>
<details>
<Error>
<Problem>Its pending</Problem>
</Error>
</details>
</Msg>
</ret>
<ret>
<CustMsg>
<cid>103850015_0_1219420995471</cid>
<fid>42</fid>
<filing>IS</filing>
<State>PENDING</State>
<rxTimestamp>2008-08-25T16:54:55.838-07:00</rxTimestamp>
<details>
<Error>
<Problem>Its pending</Problem>
</Error>
</details>
</CustMsg>
</ret>
</ns2:getMessages>
</body>
2. xsl file
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
exclude-result-prefixes="xmlns:ns2 ns2 xmlns">
<xsl:output method="xml" indent="yes" />
<xsl:variable name="file2" select="document('EFF')" />
<xsl:key name='PENDING' match='statusMsg' use='./State'/>
<xsl:template match="/">
<xsl:choose>
<xsl:when test="not(//State='PENDING')
and not(//State='SUCCEDED')">
<ret>
<xsl:copy-of select="//ret/*" />
</ret>
</xsl:when>
<xsl:when test="not($file2//State='PENDING')
and not($file2//State='SUCCEDED')">
<ret>
<xsl:copy-of select="$file2//ret/*" />
</ret>
</xsl:when>
<xsl:otherwise>
<xsl:for-each select="//ret/*">
<ret>
<xsl:element name="{name()}" namespace="{namespace-uri()}">
<xsl:apply-templates select="*"/>
</xsl:element>
</ret>
</xsl:for-each>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="ret">
<xsl:apply-templates select="*"/>
</xsl:template>
<xsl:template match="*">
<xsl:element name="{name()}" namespace="{namespace-uri()}">
<xsl:choose>
<xsl:when test=".='PENDING'">
<xsl:text>1</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:choose>
<xsl:when test="*">
<xsl:apply-templates select="*"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="." />
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
</xsl:element>
</xsl:template>
</xsl:stylesheet>
--~------------------------------------------------------------------
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>
--~--