This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Getting the Date
- To: "'xsl-list at lists dot mulberrytech dot com'" <xsl-list at lists dot mulberrytech dot com>
- Subject: [xsl] Getting the Date
- From: Mark Swardstrom <mark at nimble dot com>
- Date: Tue, 20 Feb 2001 09:50:54 -0800
- Reply-To: xsl-list at lists dot mulberrytech dot com
I'm trying to get the date into XSL via java extensions with the following
code...
<xsl:template name="show-date" xmlns:java="http://xml.apache.org/xslt/java">
<xsl:variable name="calendar"
select="java:java.util.Calendar.getInstance()"/>
<xsl:variable name="day"
select="java:java.util.Calendar.get($calendar,
java:java.util.Calendar.DAY_OF_MONTH)"/>
<xsl:value-of select="$day"/>
</xsl:template>
/* I'll expand this once I start getting something back */
Does anyone have a thought what I am doing wrong? The following is the
error I'm receiving...
Call to extension function failed: method call/new failed:
java.lang.NoSuchMethodException: static java.util.Calendar.get(java.uti
l.GregorianCalendar,java.lang.Double) -- no signature match
The get function is expecting an Integer (not a Double), but I can't seem to
find a way to force the integer case (I tried round() with no luck).
If you've tried this, or found another way to get the month, day-of-month,
and year, I'd appreciate your thoughts. One other thing, I haven't been
able to use the example in Mike Kay's book, I'm using java 1.3 and the date
class isn't available.
Thanks.
- Mark
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list