cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From conrad.cramp...@kent.police.uk
Subject Java named constants in method calls
Date Fri, 04 Jan 2002 12:30:19 GMT


Hi,
I am very new to XSL and Cocoon but I don't think that this is too stupid   
a question so here is the problem...

I have instantiated a new java GregorianCalendar object

<xsl:variable name="cal" select="java:java.util.GregorianCalendar.new()"   
/>

which works fine. I can also get the date from this using the getTime()   
method

... select="java:getTime($cal)" />

what I can't work out is how to use other methods of the   
GregorianCalendar class where named constants are used. For example I   
want to get the last day of the current month using the getMaximum method   
which in java would be
cal.getMaximum(DAY_OF_MONTH), however, I passing the args of DAY_OF_MONTH   
using the java extended syntax doesn't work. I can get the method to   
return something when I use an integer value for the args, but not the   
named constant.

... select="java.getMaximum($cal, DAY_OF_MONTH)" />   doesn't work (ie.   
returns 0)
... select="java.getMaximum($cal, 6)" /> ----- returns 366 so presumably   
6 is the integer for YEAR


I imagine I could get hold of the source code for GregorianCalendar and   
establish what the integer values are from there but surely there must be   
a way of using the named constant?

Any help would be very much appreciated.
Conrad

---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <cocoon-users-unsubscribe@xml.apache.org>
For additional commands, e-mail: <cocoon-users-help@xml.apache.org>


Mime
View raw message