[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Xalan Java TransformerException?

Subject: Re: Xalan Java TransformerException?
From: "Sudhir Malhotra" <sudhirmalhotra123@xxxxxxxxxxx>
Date: Thu, 17 May 2001 00:16:10 -0500
java transformerexception
I am adding clarifications to my original question.

The formatter and the requestMap *have*
to be params in this case.  I pass the formatter and the requestMap using

1. Transformer.setParameter("formatter", formatter) and
2. Transformer.setParameter("requestMap", requestMap)

in my java code.

3. I then get the value stored with AnalyticsStartTime key
in the requestMap ( which is type java.Util.HashMap )

4. Lastly, I format the above value according to the formatter
and store the value in the AnalyticsStartTime  variable for use
later in the in the xsl.



<!-- 1. formatter is type java.text.SimpleDateFormat -->
<xsl:param name="formatter"/>
<!-- 2. requestMap is type java.Util.HashMap -->
<xsl:param name="requestMap"/>
<!-- 3. -->
<xsl:variable name="StartTime" select="java:get($requestMap,'AnalyticsStartTime')"/>
<!-- 4. -->
<xsl:variable name="AnalyticsStartTime" select="java:format($formatter, $StartTime)"/>




Hope this clarifies. Thanks.


-----Original question------- I am getting the following exception:

javax.xml.transform.TransformerException: For extension function, could not
find method java.lang.String.format([ExpressionContext,] #UNKNOWN
(java.util.Date))

For the following XSL fragment :
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:java="http://xml.apache.org/xslt/java"
extension-element-prefixes="java"
exclude-result-prefixes="java">

<!-- formatter is type java.text.SimpleDateFormat -->
<xsl:param name="formatter"/>
<!-- request is type java.Util.HashMap -->
<xsl:param name="requestMap"/>

<xsl:variable name="StartTime"
select="java:get($requestMap,'AnalyticsStartTime')"/>
<xsl:variable name="AnalyticsStartTime" select="java:format($formatter,
$StartTime)"/>


Questions: 1. Why does the XSL complier think format() is being called for a String?

When I resolve format() completely as follows:
<xsl:variable name="AnalyticsStartTime"
select="java:java.text.SimpleDateFormat.format($formatter,  $StartTime)"/>

The exception is:
For extension function, could not find method static
java.text.SimpleDateFormat.format([ExpressionContext,] #STRING, #UNKNOWN
(java.util.Date)).


2. How can I fix this?


Thanks a lot for your help and suggestions.

Sudhir

_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com


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



Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.