You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xalan.apache.org by Jeffrey Van Baalen <jv...@uwyo.edu> on 2005/08/19 21:24:56 UTC

Problems with param/with-param

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
----





Re: Problems with param/with-param

Posted by Joanne Tong <jo...@ca.ibm.com>.
Hi Jeffrey,

Please open a JIRA issue against 2.7.0 and attach a complete XML input 
source and stylesheet that can reproduce this problem.  We will inform you 
through JIRA if this is indeed a bug. 

thank-you

Joanne Tong
Software Developer, XSLT Development, IBM Toronto Lab


Jeffrey Van Baalen <jv...@uwyo.edu> wrote on 08/19/2005 03:24:56 PM:

> 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
> ----
> 
> 
> 
>