Page 1 of 1

format-date

Posted: Tue Jan 15, 2019 5:23 pm
by tAnd
Hello

I have created a 1.0 stylesheet but i need the IssueDate to be in the form of YYYY-MM-DD. Now it is YYYYMMDD.
I have tried using

Code: Select all


<xsl:template match="IssueDate">
<td>
<xsl:value-of select="format-date(.,'[Y0001]-[M01]-[D01]')"/>
</td>
</xsl:template>
but it doesent work.

Anyone who knows what to do?
Thank you in advance.

Re: format-date

Posted: Wed Jan 16, 2019 4:03 pm
by Radu
Hi,

I'm not sure what you mean by "it does not work" but "format-date()" is an XSLT 2.0 function:

https://www.w3.org/TR/xslt20/#function-format-date

so you cannot use it in an XSLT 1.0 stylesheet.

Regards,
Radu

Re: format-date

Posted: Wed Jan 16, 2019 4:22 pm
by tAnd
Yes i figured that out. But the question is then - how should i do it in xslt 1.0?

Re: format-date

Posted: Wed Jan 16, 2019 4:25 pm
by Radu
Hi,

You need to do it the hard way using substring-before, substring-after and so on.
I found a stackoverflow post about this:

https://stackoverflow.com/questions/164 ... n-xslt-1-0

Regards,
Radu