I am using xalan 2.7.0 on a windows box. I tried to use the standard date-time library and ran into some problems with a "variable accessed before it is bound" error. I was able to reproduce the problem in the following piece of code:

 <xsl:template name="format-date">
   <xsl:param name="date-time"/>
   <xsl:param name="format"/>
 <xsl:call-template name="dt:format-date-time">
   <xsl:with-param name="year">
     <xsl:call-template name='dt:get-xsd-datetime-year'>
       <xsl:with-param name='xsd-date-time' select='$date-time'/>
     </xsl:call-template>
   </xsl:with-param>
   <xsl:with-param name='month'>
     <xsl:call-template name='dt:get-xsd-datetime-month'>
       <xsl:with-param name='xsd-date-time' select='$date-time'/>
     </xsl:call-template>
   </xsl:with-param>
   <xsl:with-param name='day'>
     <xsl:call-template name='dt:get-xsd-datetime-day'>
       <xsl:with-param name='xsd-date-time' select='$date-time'/>
     </xsl:call-template>
   </xsl:with-param>
   <xsl:with-param name='hour'>
     <xsl:call-template name='dt:get-xsd-datetime-hour'>
       <xsl:with-param name='xsd-date-time' select='$date-time'/>
     </xsl:call-template>
   </xsl:with-param>
   <xsl:with-param name='minute'>
     <xsl:call-template name='dt:get-xsd-datetime-minute'>
       <xsl:with-param name='xsd-date-time' select='$date-time'/>
     </xsl:call-template>
   </xsl:with-param>
   <xsl:with-param name="format" select="$format"/>
 </xsl:call-template>
   <xsl:message><xsl:value-of select="$date-time"/></xsl:message>
 </xsl:template>

with the call

<xsl:call-template name="format-date"><xsl:with-param name="date-time" select="'2005-08-19T15:30'"/><xsl:with-param name="format" select="'%a %b %e %i:%M'"/>
</xsl:call-template>

Strangely, it gets the error on the second reference to the date-time parameter ($date-time) in the body of the template above.

A call to the dt:format-date-time template in the date-time.xsl library with the parameter xsd-date-time set to an appropriate value causes a recursive call of the form I've written in my template above. xalan blows up on the same line with the same error in that code.

Is there a bug here or am I being stupid?

Thanks in advance,

Jeff
----




Reply via email to