[exslt] template math:min

Mike Brown mike at skew.org
Mon Nov 28 18:12:53 MST 2005


Sterzl Christian wrote:
> Hello
>  
> If I am using the template math.min it produces only NaN.

It's working fine for me, although I did have to fix the 'math' namespace in 
math.min.template.xsl. It should be http://exslt.org/math, not 
http://www.exslt.org/math.

Here's my XML:

<data>
  <sampleResult label="a" time="9999"/>
  <sampleResult label="a" time="1234"/>
  <sampleResult label="a" time="999"/>
  <sampleResult label="a" time="99"/>
  <sampleResult label="a" time="5555"/>
</data>

Here's my stylesheet:

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:math="http://exslt.org/math">

  <xsl:import href="math.min.template.xsl"/>

  <xsl:output method="xml" indent="no"/>

  <xsl:template match="data">
    <xsl:apply-templates select="sampleResult[1]"/>
  </xsl:template>

  <xsl:template match="sampleResult">
    <xsl:call-template name="math:min">
      <xsl:with-param name="nodes" select="../sampleResult[@label = current()/@label]/@time"/>
    </xsl:call-template>
  </xsl:template>

</xsl:stylesheet>


The result was "99".

Perhaps when you're using the template, the context node is not what you think?

What processor are you using?



More information about the exslt mailing list