Codeman
Codeman

Reputation: 12375

How do I get the current date in XSLT 1.0?

I've found a couple references online, but nothing that works with vanilla XSLT 1.0.

Is there a reasonable way without extension methods/parameters to get the current year in an XSLT?

EDIT:

For other's reference, I used XSL Arguments to make this happen. .NET doesn't really have XSLT 2.0 support, so I ended up using params.

xslArg.AddParam("CurrentYear", "", DateTime.Now.Year);

<xsl:param name="CurrentYear"/>

<xsl:value-of select="$CurrentYear"/>

Upvotes: 3

Views: 2253

Answers (1)

MiMo
MiMo

Reputation: 11953

No, there is no standard way to get the current date-time in XSLT 1.0.

You need some kind of extension.

Upvotes: 2

Related Questions