|
next
|
Subject: wanting help with xslt custom function & finding max yr of passed array of dates Author: James Durning Date: 24 Nov 2008 10:57 AM
|
Problem here:
<xsl:for-each select="$listdates">
<xsl:variable name="listyrs" select="string-after(string-after(string(.), '/'), '/')" />
</xsl:for-each>
<xsl:call-template name="MaxYr">
<xsl:with-param name="listdates" select="$listyrs" />
</xsl:call-template>
Every time through the loop, the listyrs variable gets redefined. When you exit the loop, the listyrs variable is deleted and no longer exists.
You need to form the variable in a different way, eg:
<xsl:variable name="listyrs">
<xsl:for-each select="$listdates">
<year>
<xsl:value-of select="string-after(string-after(string(.), '/'), '/')" />
</year>
</xsl:for-each>
</xsl:variable>
...
However, creating a variable in this way also creates problems, as it becomes a result-tree-fragment as opposed to a node-set. Solution depends on if you want to use a node-set() extension function, or rewrite your code to only compare nodes.
|
|
|