C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Forums » .NET » XML »

Sort date using .xsl


Posted Date: 29 Sep 2009      Posted By: preethi m      Member Level: Silver     Points: 1   Responses: 1



Hi ,

How to sort dates in xml file using .xsl file
Eg: following is the testxml.xml

<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/xsl" href="testxsl.xsl"?>
<catalog>
<cd>
<title>Empire Burlesque</title>
<artist>Bob Dylan</artist>
<country>USA</country>
<company>Columbia</company>
<price>10.90</price>
<year>1999</year>
<startdate>20011110</startdate>
</cd>
<cd>
<title>Hide your heart</title>
<artist>Bonnie Tyler</artist>
<country>UK</country>
<company>CBS Records</company>
<price>9.90</price>
<year>1998</year>
<startdate>20041130</startdate>
</cd>
<cd>
<title>Empire Burlesque</title>
<artist>Bob Dylan</artist>
<country>USA</country>
<company>Columbia</company>
<price>10.90</price>
<year>24</year>
<startdate>1981111</startdate>
</cd>
</catalog>

and following is the testxsl.xsl file:

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

<xsl:template match="/">
<html>
<body>
<h2>Max num</h2>
<table border="1">
<tr bgcolor="#9acd32">
<th>age</th>
</tr>
<xsl:for-each select="catalog/cd">
<xsl:sort data-type="text" select="startdate" order ="descending"/>
<tr>
<td><xsl:value-of select="startdate"/></td>
</tr>
</xsl:for-each>
</table>http://www.dotnetspider.com/forum/PostForum.aspx
</body>
</html>
</xsl:template>
</xsl:stylesheet>

I've tried above code but not getting correct result.

Thanks





Responses

Author: Umar    02 Oct 2009Member Level: GoldRating: 2 out of 52 out of 5     Points: 2

what is ur exact problem
u want to sort xml file data
or .xls file data

Thanks & Regards
Umar Daraj
umardaraj07@gmail.com
Software Engineer(Jaipur)



Post Reply
You must Sign In to post a response.
Next : Min and max
Previous : Getting node values by passing two parameters to the xml document
Return to Discussion Forum
Post New Message
Category: XML

Related Messages



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use