Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries >Thread Prev - Re: xsl Current-DateTime >Thread Next - Re: xsl Current-DateTime Re: xsl Current-DateTimeTo: NULL Date: 7/8/2009 7:54:00 AM >On Jul 8, 5:56=A0am, Martin Honnen <mahotr...@yahoo.de> wrote:
>..... Your only chance there to access the current date and/or
> time in a stylesheet is to define a global parameter in your stylesheet
> and set that before you run the transformation.
>
> --
>
> =A0 =A0 =A0 =A0 Martin Honnen --- MVP XML
> =A0 =A0 =A0 =A0http://msmvps.com/blogs/martin_honnen/
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
I just tried your suggestion and still no results... what do I need to
correct in here?
<?xml version=3D"1.0" encoding=3D"ISO-8859-1"?>
<xsl:stylesheet version=3D"1.0"
xmlns:xsl=3D"http://www.w3.org/1999/XSL/Transform"
xmlns:date=3D"http://www.cafeconleche.org/ns/date">
<xsl:script
implements-prefix=3D"date"
language=3D"javascript">
function returnDate()
{ var d, s;
d =3D new Date();
s +=3D (d.getMonth() + 1) + "/";
s +=3D d.getDate() + "/";
s +=3D d.getYear();
return(s);
}
</xsl:script>
<xsl:variable name=3D"color" select=3D"'yellow'" />
<xsl:variable name=3D"Now" select=3D"date:returnDate()" />
<xsl:template match=3D"/">
<html>
<body>
<h2>Current Date</h2>
<table border=3D"1">
<tr bgcolor=3D"#9acd32">
<th>Color</th>
<th>Current date time</th>
</tr>
<tr>
<td><xsl:value-of select=3D"$color" /></td>
<td><xsl:value-of select=3D"$Now" /></td>
</tr>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
