Hi Birgit,
That's an interesting one... Try calling this template (lines might wrap
around):
<xsl:template name="GetMaxValue">
<xsl:param name="startIndex" select="1"/>
<xsl:param name="maxValue" select="0"/>
<xsl:variable name="leftOver" select="count (index/entry) -
$startIndex"/>
<xsl:choose>
<xsl:when test="$leftOver < 1">
<xsl:variable name="lastNumber" select="document (concat (string
(index/entry[position () = last ()]/xml), '.xml'))/entry/item/@number"/>
<xsl:choose>
<xsl:when test="$maxValue > $lastNumber">
<xsl:value-of select="$maxValue"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$lastNumber"/>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
<xsl:variable name="currentValue" select="document (concat
(string (index/entry[position () = $startIndex]/xml),
'.xml'))/entry/item/@number"/>
<xsl:call-template name="GetMaxValue">
<xsl:with-param name="startIndex" select="$startIndex + 1"/>
<xsl:with-param name="maxValue">
<xsl:choose>
<xsl:when test="$maxValue > $currentValue">
<xsl:value-of select="$maxValue"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$currentValue"/>
</xsl:otherwise>
</xsl:choose>
</xsl:with-param>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
HTH:
Andras Babos.
-----Original Message-----
From: birgit(_dot_)zimmermann(_at_)fh-rosenheim(_dot_)de
[mailto:birgit(_dot_)zimmermann(_at_)fh-
rosenheim.de]
Sent: 2004. november 2. 21:39
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] Get the maximum of a set of values
Hello,
I've got the following problem:
I've got an index xml file that refers to some other xml files like
that:
...
But my problem is, that I want to find the maximum of the attribute
number
/ the
variable vNumber!