Subject: RE: [xsl] XSLT Java Extensions From: "Michael Kay" <michael.h.kay@xxxxxxxxxxxx> Date: Mon, 15 Apr 2002 09:42:33 +0100 |
In the Java API for the Calendar class, the field names such as YEAR are actually symbolic constants defined as static properties of the Calendar object. Since you can't access properties of Java objects from XSLT (only methods), you will have to discover the integer values of these constants and supply these instead. For example, you might find that Calendar.YEAR is actually 7. To find out the numeric values of the constants, write a Java application that prints them out! Michael Kay Software AG home: Michael.H.Kay@xxxxxxxxxxxx work: Michael.Kay@xxxxxxxxxxxxxx > -----Original Message----- > From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx > [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of > Garvin Franco > Sent: 15 April 2002 00:28 > To: XSL-List@xxxxxxxxxxxxxxxxxxxxxx > Subject: [xsl] XSLT Java Extensions > > > Hello ladies/gents, I am trying to use extensions in XSLT to > get the current > date/time for textual output, but I don't know how to > retrieve specific data > from the object returned. > > Below is a sample of the xsl file that makes the extension call: > > <?xml version="1.0"?> > <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" > version="1.0" > xmlns:java="http://xml.apache.org/xslt/java"> > > .. > .. > <!-- I am making this call inside the template: --> > <xsl:variable name="tmp" select="java:java.util.Calendar.new()"/> > <xsl:value-of select="$tmp" /> > .. > </xsl:stylesheet> > > The problem with this is that, when I instantiate the > Calendar object it > returns a GregorianCalendar object with a great deal of > information that I > don't want. So when I write it to output, the entire object > is returned. > All I need on the text output is YYYYMMDDHHMMSS. These > details are stored in > the attributes of the Class. > YEAR MONTH DAY_OF_MONTH HOUR_OF_DAY MINUTE SECOND > > I tried using > "<xsl:value-of select="java:java.util.Calendar.get(YEAR)" />" > etc., but I > got error messages when the processor tried to process these lines. > > Can someone give me some pointers on this? > > Thanks > Garvin > > _________________________________________________________________ > Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp. XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] XSLT Java Extensions, Johannes Döbler | Thread | Re: [xsl] XSLT Java Extensions, Garvin Franco |
Re: [xsl] XSLT Java Extensions, Johannes Döbler | Date | RE: [xsl] non-existing file in docu, Michael Kay |
Month |