stevecrozz
IS-IT--Management
I'm using EXSLT date:day-in-week function here, but the question is very general. Here I have a short template, and in the middle of it I declare a variable "dayOfTheWeek", and also call the template to parse that date into a number representing the day of the week. The value of the variable is "2006-07-19" as you can see from the output. And if I place that value directly into the external template call
(like this)
<xsl:call-template name="date:day-in-week">
<xsl:with-param name="date-time" select="'2006-07-24'" />
</xsl:call-template>
I get the number 2 returned representing Monday. But the following code returns NaN (not a number). Any idea why the value of my variable is not getting passed to the external template the same way as when I just type it in like above?
Output::
(like this)
<xsl:call-template name="date:day-in-week">
<xsl:with-param name="date-time" select="'2006-07-24'" />
</xsl:call-template>
I get the number 2 returned representing Monday. But the following code returns NaN (not a number). Any idea why the value of my variable is not getting passed to the external template the same way as when I just type it in like above?
Code:
<xsl:template name="date-time">
<xsl:for-each select="time-layout">
<xsl:if test="layout-key = 'k-p24h-n8-1'">
<xsl:for-each select="start-valid-time">
<xsl:variable name="dayOfTheWeek">
<xsl:value-of select="substring(.,1,10)"/>
</xsl:variable>
<text stuff="{$dayOfTheWeek}"></text>
<xsl:call-template name="date:day-in-week">
<xsl:with-param name="date-time" select="'{$dayOfTheWeek}'" />
</xsl:call-template>
</xsl:for-each>
</xsl:if>
</xsl:for-each>
</xsl:template>
Output::
Code:
<text stuff="2006-07-19"></text>NaN
<text stuff="2006-07-20"></text>NaN
<text stuff="2006-07-21"></text>NaN
<text stuff="2006-07-22"></text>NaN
<text stuff="2006-07-23"></text>NaN