This is a bug. Can you open a bug report for it? Thanks.

Morris Kwan
XSLT Development
IBM Toronto Lab
Tel: (905)413-3729
Email: [EMAIL PROTECTED]



                                                                                
                                                    
                      <Stefan.Kaesberg@                                         
                                                    
                      avinci.de>               To:       <[EMAIL PROTECTED]>    
                                         
                                               cc:                              
                                                    
                      01/23/2003 01:19         Subject:  XSLTC + Extension - 
error using  SimpleDateFormat with Locale              
                      PM                                                        
                                                    
                                                                                
                                                    
                                                                                
                                                    



Dear Xalan users,

i try to use java.util.Date, java.text.SimpleDateFormat and
java.util.Locale to generate a
language-dependend Timestamp. Therefore i use the following stylesheet:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; xmlns:xalan="
http://xml.apache.org/xalan";
xmlns:date="http://xml.apache.org/xalan/java/java.util.Date";
xmlns:dateFormat="
http://xml.apache.org/xalan/java/java.text.SimpleDateFormat";
xmlns:locale="http://xml.apache.org/xalan/java/java.util.Locale";
xmlns:java_lang="http://xml.apache.org/xalan/java/java.lang";
exclude-result-prefixes ="date locale dateFormat java_lang xalan">

<xsl:template match="/">
<xsl:variable name="dateObject" select="date:new()"/>
<xsl:variable name="localeObject" select="locale:new('fr','')"/>
<xsl:variable name="dateFormatObject" select="dateFormat:new('dd. MMMM yyyy
HH:mm:ss zzzz', $localeObject)"/>
<xsl:variable name="date-time" select="dateFormat:format
($dateFormatObject,$dateObject)"/>
<out>
<xsl:value-of select="$date-time"/>
</out>
</xsl:template>
</xsl:stylesheet>

for input i used only:
<?xml version="1.0" encoding="UTF-8"?>
<foo/>

Xalan does it right:
<?xml version="1.0" encoding="UTF-8"?>
<out>23. janvier 2003 18:59:54 GMT+01:00</out>

but XSLTC throws a compilation error when i created a Templates-Object:

ERROR:
'Cannot convert argument/return type in call to method
'java.text.SimpleDateFormat.new(string, object)''
javax.xml.transform.TransformerConfigurationException:
Could not compile stylesheet
at
org.apache.xalan.xsltc.trax.TransformerFactoryImpl.newTemplates(TransformerFactoryImpl.java:662)


I use jdk 1.3.1, Xalan 2.4.1
Can anyone help me out ?
Stefan




Reply via email to