Re: current timestamp in XSLT 1.0
helix84 <[email protected]> Fri, 27 Apr 2012 01:58:22 +0200
| Newsgroups | gmane.text.xml.xslt.extensions |
|---|---|
| Message-ID | <CAGdvKqi8p=caE8YMjs2x+vx=NgeExQEDK8jBPP-gsFV-KTs7ag@mail.gmail.com> |
Thanks for your answer, Hermann. Thanks for pointing out that
date:seconds() without arguments returns unix timestamp, I overlooked
that. Your script for testing XPath expressions also seems generally
useful.
However, my XSLT processor seems to be Xalan 2.7.0 and it only
supports EXSLT core functions, i.e. not date:seconds(). OTOH, I found
out I can call Java functions easily, so this seems to be the simplest
solution in my case:
<xsl:template
name="test"
xmlns:java="http://xml.apache.org/xslt/java"
>
<xsl:value-of
select="round(java:java.lang.System.currentTimeMillis() div 1000)"/>
</xsl:template>
Regards,
~~helix84