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

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "displaying current date/time in xsl" Watch "displaying current date/time in xsl" New topic

displaying current date/time in xsl

Paula Allen

Joined: Mar 12, 2013
Posts: 1
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"
<xsl:value-of select="java:format(java:java.text.SimpleDateFormat.new('yyyy.MM.dd'), java:java.util.Date.new())" />

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: 499
...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.
Consider Paul's rocket mass heater.
subject: displaying current date/time in xsl
Similar Threads
about saxon xslt processor
Instantiating a JavaObject with the values from XML
Display current date/time in xsl
Call to extension function failed : http://exslt.org/strings
A Beginner's Question