1<?xml version="1.0"?> 2<xsl:stylesheet version="1.0" 3 xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 4 xmlns:math="http://exslt.org/math" 5 extension-element-prefixes="math"> 6 7<!-- Test math:abs() --> 8 9<xsl:variable name="zero" select="0"/> 10<xsl:variable name="nzero" select="-0"/> 11<xsl:variable name="num1" select="1.99"/> 12<xsl:variable name="num2" select="3.1428475"/> 13<xsl:variable name="temp1" select="-7"/> 14<xsl:variable name="temp2" select="-9.99999"/> 15<xsl:variable name="rad1" select="1.0"/> 16<xsl:variable name="rad2" select="25"/> 17<xsl:variable name="rad3" select="0.253"/> 18<xsl:variable name="rad4" select="-0.888"/> 19<xsl:variable name="input1" select="number(//number[1])"/> 20<xsl:variable name="input2" select="number(//number[2])"/> 21<xsl:variable name="input3" select="$input1 div $zero"/> 22 23 24<xsl:template match="/"> 25 <out> 26 Absolute value of zero is: 27 <xsl:value-of select="math:abs($zero)"/><br/> 28 Absolute value of nzero is: 29 <xsl:value-of select="math:abs($nzero)"/><br/> 30 Absolute value of num1 is: 31 <xsl:value-of select="math:abs($num1)"/><br/> 32 Absolute value of num2 is: 33 <xsl:value-of select="math:abs($num2)"/><br/> 34 Absolute value of temp1 is: 35 <xsl:value-of select="math:abs($temp1)"/><br/> 36 Absolute value of temp2 is: 37 <xsl:value-of select="math:abs($temp2)"/><br/> 38 Absolute value of input1 number is: 39 <xsl:value-of select="math:abs($input1)"/><br/> 40 Absolute value of input2 number is: 41 <xsl:value-of select="math:abs($input2)"/><br/> 42 Absolute value of input3 number is: 43 <xsl:value-of select="math:abs($input3)"/> 44 45 </out> 46</xsl:template> 47 48 49 <!-- 50 * Licensed to the Apache Software Foundation (ASF) under one 51 * or more contributor license agreements. See the NOTICE file 52 * distributed with this work for additional information 53 * regarding copyright ownership. The ASF licenses this file 54 * to you under the Apache License, Version 2.0 (the "License"); 55 * you may not use this file except in compliance with the License. 56 * You may obtain a copy of the License at 57 * 58 * http://www.apache.org/licenses/LICENSE-2.0 59 * 60 * Unless required by applicable law or agreed to in writing, software 61 * distributed under the License is distributed on an "AS IS" BASIS, 62 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 63 * See the License for the specific language governing permissions and 64 * limitations under the License. 65 --> 66 67</xsl:stylesheet> 68