Supported Version: 1 XML Definition: math.power.xml Source: math.power.template.xsl Source<xsl:template name="math:power">
<xsl:param name="base"
select="0" />
<xsl:param name="power"
select="1" />
<xsl:choose>
<xsl:when test="$power < 0 or contains(string($power), '.')">
<xsl:message terminate="yes">
The XSLT template math:power doesn't support negative or
fractional arguments.
</xsl:message>
<xsl:text>NaN</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="math:_power">
<xsl:with-param name="base"
select="$base" />
<xsl:with-param name="power"
select="$power" />
<xsl:with-param name="result"
select="1" />
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="math:_power">
<xsl:param name="base"
select="0" />
<xsl:param name="power"
select="1" />
<xsl:param name="result"
select="1" />
<xsl:choose>
<xsl:when test="$power = 0">
<xsl:value-of select="$result" />
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="math:_power">
<xsl:with-param name="base"
select="$base" />
<xsl:with-param name="power"
select="$power - 1" />
<xsl:with-param name="result"
select="$result * $base" />
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:template> Change HistorySubmitted: 2001-05-22 Creator: Jeni Tennison(http://www.jenitennison.com) Returns the result of raising a number to the power.Version | Modified | By | Details |
---|
1.1 | 2002-08-21 | Craig Stewart | Added 4XSLT and libxslt implementation to the list. | 1.2 | 2002-11-12 | Craig Stewart | Updated 4XSLT version to 0.12.0a3. | 1.3 | 2003-03-03 | Craig Stewart | Fixed a bug in the implementations, MSXSL is now correctly listed as the langauge used by math.power.msxsl.xsl |
|