GeeCON Prague 2014*
The moose likes XML and Related Technologies and the fly likes displaying current date/time in xsl Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "displaying current date/time in xsl" Watch "displaying current date/time in xsl" New topic
Author

displaying current date/time in xsl

Paula Allen
Greenhorn

Joined: Mar 12, 2013
Posts: 1
Hi,
I'm trying to find a way to display the current date. I found this code on this site and have tried it:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:java="http://xml.apache.org/xslt/java"
exclude-result-prefixes="java">
...
<xsl:value-of select="java:format(java:java.text.SimpleDateFormat.new('yyyy.MM.dd'), java:java.util.Date.new())" />
...
</xsl:stylesheet>

I'm using xslt 1 and stylesheet version 1 and translating to a pdf. I think it will work but my FO processor "can't find the script or external object that implements the prefix 'http://xml.apache.org/xslt/java'. I also tried the date-and-times extender and got similar results. What am I doing wrong? I also read something about third party extenders where you put in a line like <xsl:import href='date.xsl'> Hope someone can help.
Thank you, Paula
g tsuji
Ranch Hand

Joined: Jan 18, 2011
Posts: 520
    
    3
...but my FO processor "can't find the script or external object that implements the prefix 'http://xml.apache.org/xslt/java'

The extension element/function is entirely implementation-dependent. So, basically, you should consult the documentation of "your" FO processor.
 
GeeCON Prague 2014
 
subject: displaying current date/time in xsl