 |
 |
 |
As Michael pointed out, please post XSLT related questions at the
xsl-list hosted by www.mulberrytech.com.
To answer your present question, I would like to suggest a simple way
to implement abs() functionality in XSLT 1.0 (XSLT 2.0 has it
built-in, so no need to worry with XSLT 2.0).
Write a named template for this..
Here is the code:
<xsl:template name="abs">
<xsl:param name="n" />
<xsl:choose>
<xsl:when test="$n >= 0">
<xsl:value-of select="$n" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="0 - $n" />
</xsl:otherwise>
</xsl:choose>
</xsl:template>
Call this as:
1)
<xsl:call-template name="abs">
<xsl:with-param name="n" select="3" />
</xsl:call-template>
Will produce output: 3
2)
<xsl:call-template name="abs">
<xsl:with-param name="n" select="-10" />
</xsl:call-template>
Will produce output: 10
Regards,
Mukul
On 7/6/06, Webmaster <Webmaster@c...> wrote:
> Hello. I'm using Saxon 6.5.3 and am trying to get the abs function to work.
> I tried math: and fn: but I'm getting the error: "unknown system function".
> I've tried several name spaces, with out any success.
>
> It seems to me that maybe saxon doesn't with it? my xsl namespace is:
> http://www.w3.org/1999/XSL/Transform
>
> At this point I'm kinda lost and not really knowing what I need. So how do I
> find a libary of math functions? do I have to download some files? do I have
> to update the xsl namespace?
>
> Thanks!
> LN
|
 | 

|  |
These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.
|  |
| |
 |
 |
 |