The xml file is having the following structure
<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="TestFile.xsl"?>
<RootElement>
<Date FileModified="7/2/2010 12:54:53 PM" />
<Child Name="A"/>
<Child Name="B"/>
<Child Name="C"/>
<Child Name="D"/>
<Child Name="E"/>
</RootElement>
I need to read the date attribute value from the file and pass the to
var d=new Date( date );
Here is my 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>
<head></head>
<body>
<center>
<b>
<script type="text/javascript">
var d_names = new Array("Sunday", "Monday", "Tuesday","Wednesday", "Thursday", "Friday", "Saturday");
var m_names = new Array("January", "February", "March","April", "May", "June", "July", "August","September","October","November", "December");
var d = new Date(-----------); // here i need to get the date from the xsl file
var curr_day = d.getDay();
var curr_date = d.getDate();
var sup = "";
if (curr_date == 1 || curr_date == 21 || curr_date ==31)
{
sup = "st";
}
else if (curr_date == 2 || curr_date == 22)
{
sup = "nd";
}
else if (curr_date == 3 || curr_date == 23)
{
sup = "rd";
}
else
{
sup = "th";
}
var curr_month = d.getMonth();
var curr_year = d.getFullYear();
var curr_hour=d.getHours();
var curr_period="AM"
if(curr_hour>12)
{
curr_hour=curr_hour-12;
curr_period="PM"
}
document.write(d_names[curr_day]+ "     " +curr_date + "<sup>"+ sup + " </sup> " + m_names[curr_month] + "  " + curr_year+ "      "+curr_hour+" : "+d.getMinutes()+" : "+d.getSeconds()+" "+curr_period);
</script>
</b>
<xsl:choose>
<xsl:when test="//Child">
<br/>
<br/>
<br/>
<b>SampleTable</b>
<br/>
<br/>
<table border="1">
<tr bgcolor="RGB(0,0,127)" >
<th width="5">
<font color="white">S.No</font>
</th>
<th width="250">
<font color="white"> Name</font>
</th>
</tr>
<xsl:for-each select ="//Child">
<tr>
<td>
<xsl:number value="position()" format="01"/>
</td>
<td>
<xsl:value-of select="@Name"/>
</td>
</tr>
</xsl:for-each>
</table>
</xsl:when >
<xsl:otherwise ></xsl:otherwise>
</xsl:choose >
</center>
</body >
</html>
</xsl:template>
</xsl:stylesheet>
Is there any way to do this