xsl-list
[Top] [All Lists]

Re: Problem2 date:format-date running EXSL

2003-07-29 01:58:29
There seems to be some error in your XSL.. as
specified at
http://www.exslt.org/date/functions/format-date/index.html

correct call to call-template will be ..

<xsl:call-template name="date:format-date">
   <xsl:with-param name="date-time" select="date"/>
   <xsl:with-param name="pattern" select="'MMM
dd,yyyy'"/>
</xsl:call-template>

the second parameter must be pattern and not format,
and the correct format string will be MMM dd,yyyy and
not MMM DD,yyyy (please note case of dd)..

i have tested the XSL with Xalan and MSXML.. it is
working fine with the above changes.

Regards,
Mukul


--- Rajendra S Rawat <rajsrawat(_at_)yahoo(_dot_)com> wrote:
Hi! Mukul

I'm facing similar problem with date:format-date.I
need to convert date in xml to some thing like 
"OCT 25, 03" 
I'm using XML Spy 5.

files are:

--------test.xml---------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<dates>
      <date>2003-10-25</date>
</dates>

-----------test.xsl------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
xmlns:date="http://exslt.org/dates-and-times";
extension-element-prefixes="date">
      <xsl:import href="date.format-date.template.xsl" />
      <xsl:output method="xml" version="1.0"
encoding="UTF-8" indent="yes"/>
      <xsl:template match="dates">
              <xsl:variable name="result">
                      <xsl:call-template name="date:format-date">
                              <xsl:with-param name="date-time" select="date"/>
                              <xsl:with-param name="format" select="'MMM DD,
yyyy'"/>
                      </xsl:call-template>
              </xsl:variable>
              <xsl:value-of select="$result"/>
      </xsl:template>
</xsl:stylesheet>
--------------------------------------------
I have following files in working directory:
str.padding.template.xsl
date.format-date.template.xsl
test.xml
test.xsl

NOTE:
str.padding.template.xsl
and date.format-date.template.xsl are downloaded
from
http://exslt.org
-----------------------------------------------
but with no result!

can someb'dy help?

Thanks & Regards
Raj



------------------------
 Mukul Gandhi <mukulw3(_at_)yahoo(_dot_)com> wrote:
i was able to run the EXSLT extension with Xalan..
In
EXSLT date.xsl file , lot of files are imported. i
deleted all imports except 
<import
href="functions/difference/date.difference.xsl"/>

which i needed. this made the transorm run
successfully.. the original date.xsl file probably
caused deep recursion, which caused StackOverflow
error..

Regards,
Mukul


--- Mukul Gandhi <mukulw3(_at_)yahoo(_dot_)com> wrote:
Hello ,
i am using xalan-j_2_5_D1.. i am trying to run
the
EXSL date:difference function in a XSL
stylesheet..
i
have downloaded the EXSL extensions from
www.exsl.org
and have placed them in proper path..

my xml file is
---------------
<?xml version="1.0" encoding="UTF-8"?>
<dates>
  <date>2003-07-25</date>
  <date>2003-07-23</date>
</dates>

and the xsl is below
--------------------
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
xmlns:date="http://exslt.org/dates-and-times";
extension-element-prefixes="date">
  <xsl:import href="date.xsl"/>
  <xsl:output method="text" version="1.0"
encoding="UTF-8" indent="yes"/>
  <xsl:template match="dates">
   <xsl:variable name="diff">
     <xsl:call-template name="date:difference">
       <xsl:with-param name="start"
select="date[1]"/>
       <xsl:with-param name="end"
select="date[2]"/>
     </xsl:call-template>
   </xsl:variable> 
   <xsl:value-of select="$diff"/> 
  </xsl:template>
</xsl:stylesheet>

when i apply the above XSL to XML , i get the
error
"XSLT Error(java.lang.StackOverflowError)"

As suggested here

http://xml.apache.org/xalan-j/faq.html#faq-N102B9

i have tried by increasing the stack size to
1MB,
but
still i am getting this error.. 

is it possible to run the above XSL with Xalan
2.5.1..
?

Regards,
Mukul


__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site
design software
http://sitebuilder.yahoo.com

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



__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site
design software
http://sitebuilder.yahoo.com

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



__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site
design software
http://sitebuilder.yahoo.com

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



__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

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