This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: XSLT Java Extensions


Johannes,
         Thanks for the approach using 
"xmlns:xalan://java.util.GregorianCalendar" as the namespace. The example 
works like a charm. I was able to figure out the numeric values for the 
other constants and really appreciate your help.

Garvin


>From: "Garvin Franco" <garvin_franco@hotmail.com>
>Reply-To: xsl-list@lists.mulberrytech.com
>To: xsl-list@lists.mulberrytech.com
>Subject: Re: [xsl] XSLT Java Extensions
>Date: Mon, 15 Apr 2002 12:40:43 -0400
>
>Johannes,
>I tried using
>
><xsl:value-of select="java:java.util.Calendar.get($tmp, 1)">
>
>, but I got the following error on the line where I made the call.
>I used the -TS option in Xalan to get results in the console
>
>Line #37, Column #41: value-of, select=''           '':
>Line #39, Column #76: variable,
>select='java:java.util.Calendar.getInstance()':
>java.util.GregorianCalendar[time=1018888
>758479,areFieldsSet=true,areAllFieldsSet=true,lenient=true,zone=java.util.SimpleTimeZone[id=America/New_York,offset=-180
>00000,dstSavings=3600000,useDaylight=true,startYear=0,startMode=3,startMonth=3,startDay=1,startDayOfWeek=1,startTime=720
>0000,startTimeMode=0,endMode=2,endMonth=9,endDay=-1,endDayOfWeek=1,endTime=7200000,endTimeMode=0],firstDayOfWeek=1,minim
>alDaysInFirstWeek=1,ERA=1,YEAR=2002,MONTH=3,WEEK_OF_YEAR=16,WEEK_OF_MONTH=3,DAY_OF_MONTH=15,DAY_OF_YEAR=105,DAY_OF_WEEK=
>2,DAY_OF_WEEK_IN_MONTH=3,AM_PM=1,HOUR=0,HOUR_OF_DAY=12,MINUTE=39,SECOND=18,MILLISECOND=479,ZONE_OFFSET=-18000000,DST_OFF
>SET=3600000]
>file:///C:/xalan-j_2_0_D07/intact.xsl; Line 40; Column 63
>Parser error: TRaX Transform Throwable
>
>XSLT Error (javax.xml.transform.TransformerException): TRaX Transform
>Throwable
>
>C:\xalan-j_2_0_D07>
>
>Any ideas?
>
>Garvin
>
>
>>From: Johannes Döbler <jd@aztecrider.com>
>>Reply-To: xsl-list@lists.mulberrytech.com
>>To: xsl-list@lists.mulberrytech.com
>>Subject: Re: [xsl] XSLT Java Extensions
>>Date: Mon, 15 Apr 2002 09:49:40 +0200
>>
>><xsl:value-of select="java:java.util.Calendar.get(YEAR)"/>
>>
>>will invoke the static (non-existent) method "get" in class
>>java.util.Calendar and pass as parameter the result of evaluating the
>>child-axis-expression YEAR.
>>
>>Try instead:
>>
>><xsl:value-of select="java:java.util.Calendar.get($tmp, 1)">
>>
>>This will invoke the non-static method "get" on the Calendar object stored
>>in variable $tmp and pass number 1 as parameter, which is the value of
>>constant Calendar.YEAR.
>>
>>regards,
>>Johannes
>>
>>
>>At 19:28 14.04.2002 -0400, you wrote:
>>>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
>>
>>
>>XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
>>
>
>
>_________________________________________________________________
>MSN Photos is the easiest way to share and print your photos:
>http://photos.msn.com/support/worldwide.aspx
>
>
>XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
>




_________________________________________________________________
Send and receive Hotmail on your mobile device: http://mobile.msn.com


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]