|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Accessing a Java Object after instatiating as a v
Why don't you pass the current date (and all the required formating) as a parameter to the
stylesheet? This way, you will have a platform compatible stylesheet (it will work in any
compliant XSLT processor).
--- cfisher@xxxxxxx wrote:
> After reading Michael Kay's Xalan Chapter in the second edition of XSLT,
> backwards and forwards, I have finally been able to instantiate a
> SimpleDateFormat object. My problem is how to access the object after it
> is in variable form. Can this be done? There are component and script
> elements available, however I am unsure as to their final implementation.
>
> Here is a portion of my stylesheet:
>
> <xsl:stylesheet version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> xmlns:fo="http://www.w3.org/1999/XSL/Format"
> xmlns:fox="http://xml.apache.org/fop/extensions"
> xmlns:xalan="http://xml.apache.org/xslt"
> xmlns:Math="xalan://java.lang.Math"
> xmlns:date="http://xml.apache.org/xalan/java/java.util.Date" --->
> Importing the date class into the namespace and declaring a prefix
> xmlns:java_lang="http://xml.apache.org/xalan/java/java.lang" --->
> Importing the lang package into the namespace and declaring a prefix
> xmlns:format="xalan://java/java.text.SimpleDateFormat"> --->
> Importing the text package into the namespace and declaring a prefix
>
>
> <xsl:variable name="dNow" select="date:new()"/>
> ---> Successfully creating a date object
> <xsl:variable name="formatter" select="format:SimpleDateFormat.new('E
> yyyy.MM.dd hh:mm:ss a zz')"/> ---> Successfully creating a
> SimpleDateFormat object with my own special format
> <xsl:variable name="dateToday" select="format:format($dNow)"/>
> ---> Unsuccessfully creating a formatted date (it has the
> standard formatting applied)
>
> The reason is because the $dateToday variable is created with a
> SimpleDateFormat object that is derived from the standard class and not the
> class I created with the new('format') string. Without the formatting
> string applied in the constructor the format looks like this; 12/16/04
> 12:32 PM, which is my local setting. I don't know how to access the
> instance functions in my created object.
>
> If someone could shed some light on the manner in which the component and
> script elements can be used with Xalan, then this might be the ticket for
> many extensions which would be useful. I know they can be used, but I have
> yet to find an example that I can get my mind around...
>
> Thanks,
>
> Curtis Fisher
>
>
=====
Marian
http://www.utdallas.edu/~mgo031000/
__________________________________
Do you Yahoo!?
Yahoo! Mail - 250MB free storage. Do more. Manage less.
http://info.mail.yahoo.com/mail_250
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








