Skip to Main Content

DevOps, CI/CD and Automation

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Get Current Datetime in an XSL

166410Mar 12 2002
How do I add a current Datetime to an XSL document? The following sample works in XALAN but not ORAXSL. date:new() returns nothing!?

<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
xmlns:date="http://www.oracle.com/XSL/Transform/java/java.util.Date" exclude-result-prefixes="date">
...
<xsl:template name="createCurrentDATETIME">
<xsl:variable name="today" select="date:new()"/>
<xsl:variable name="len" select="string-length(normalize-space($today))"/>
<xsl:choose>
<xsl:when test="$len &gt; 0">
<xsl:element name="DATETIME">
<xsl:element name="YEAR">
<xsl:value-of select="substring($today,$len - 4,$len)"/>
</xsl:element>
....
</xsl:element>
</xsl:when>
<xsl:otherwise>
<xsl:element name="DATETIME">
<xsl:element name="YEAR">2002</xsl:element>
</xsl:element>
....
</xsl:otherwise>
</xsl:choose>
...
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 9 2002
Added on Mar 12 2002
1 comment
733 views