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:power() --> 8<xsl:variable name="base1" select="10"/> 9<xsl:variable name="base2" select="2.5"/> 10<xsl:variable name="base3" select="1"/> 11<xsl:variable name="base4" select="0"/> 12<xsl:variable name="base5" select="-10"/> 13<xsl:variable name="expon1" select="0"/> 14<xsl:variable name="expon2" select="-0"/> 15<xsl:variable name="expon3" select="10"/> 16<xsl:variable name="expon4" select="2.5"/> 17<xsl:variable name="expon5" select="-5"/> 18<xsl:variable name="input1" select="number(//number[1])"/> 19<xsl:variable name="input2" select="number(//number[2])"/> 20<xsl:variable name="input3" select="$input1 div $base4"/> 21 22<xsl:template match="/"> 23 <out> 24 Using variable bases with power 0:<br/> 25 <xsl:value-of select="$base1"/><xsl:text> to the power of </xsl:text><xsl:value-of select="$expon1"/><xsl:text> is </xsl:text> 26 <xsl:value-of select="math:power($base1,$expon1)"/><br/> 27 <xsl:value-of select="$base2"/><xsl:text> to the power of </xsl:text><xsl:value-of select="$expon1"/><xsl:text> is </xsl:text> 28 <xsl:value-of select="math:power($base2,$expon1)"/><br/> 29 <xsl:value-of select="$base3"/><xsl:text> to the power of </xsl:text><xsl:value-of select="$expon1"/><xsl:text> is </xsl:text> 30 <xsl:value-of select="math:power($base3,$expon1)"/><br/> 31 <xsl:value-of select="$base4"/><xsl:text> to the power of </xsl:text><xsl:value-of select="$expon1"/><xsl:text> is </xsl:text> 32 <xsl:value-of select="math:power($base4,$expon1)"/><br/> 33 <xsl:value-of select="$base5"/><xsl:text> to the power of </xsl:text><xsl:value-of select="$expon1"/><xsl:text> is </xsl:text> 34 <xsl:value-of select="math:power($base5,$expon1)"/><br/> 35 Using variable base with power -0: 36 <xsl:value-of select="$base1"/><xsl:text> to the power of </xsl:text><xsl:value-of select="$expon2"/><xsl:text> is </xsl:text> 37 <xsl:value-of select="math:power($base1,$expon2)"/><br/> 38 <xsl:value-of select="$base2"/><xsl:text> to the power of </xsl:text><xsl:value-of select="$expon2"/><xsl:text> is </xsl:text> 39 <xsl:value-of select="math:power($base2,$expon2)"/><br/> 40 <xsl:value-of select="$base3"/><xsl:text> to the power of </xsl:text><xsl:value-of select="$expon2"/><xsl:text> is </xsl:text> 41 <xsl:value-of select="math:power($base3,$expon2)"/><br/> 42 <xsl:value-of select="$base4"/><xsl:text> to the power of </xsl:text><xsl:value-of select="$expon2"/><xsl:text> is </xsl:text> 43 <xsl:value-of select="math:power($base4,$expon2)"/><br/> 44 <xsl:value-of select="$base5"/><xsl:text> to the power of </xsl:text><xsl:value-of select="$expon2"/><xsl:text> is </xsl:text> 45 <xsl:value-of select="math:power($base5,$expon2)"/><br/> 46 Using variable base with power 10: 47 <xsl:value-of select="$base1"/><xsl:text> to the power of </xsl:text><xsl:value-of select="$expon3"/><xsl:text> is </xsl:text> 48 <xsl:value-of select="math:power($base1,$expon3)"/><br/> 49 <xsl:value-of select="$base2"/><xsl:text> to the power of </xsl:text><xsl:value-of select="$expon3"/><xsl:text> is </xsl:text> 50 <xsl:value-of select="math:power($base2,$expon3)"/><br/> 51 <xsl:value-of select="$base3"/><xsl:text> to the power of </xsl:text><xsl:value-of select="$expon3"/><xsl:text> is </xsl:text> 52 <xsl:value-of select="math:power($base3,$expon3)"/><br/> 53 <xsl:value-of select="$base4"/><xsl:text> to the power of </xsl:text><xsl:value-of select="$expon3"/><xsl:text> is </xsl:text> 54 <xsl:value-of select="math:power($base4,$expon3)"/><br/> 55 <xsl:value-of select="$base5"/><xsl:text> to the power of </xsl:text><xsl:value-of select="$expon3"/><xsl:text> is </xsl:text> 56 <xsl:value-of select="math:power($base5,$expon3)"/><br/> 57 Using variable base with power 2: 58 <xsl:value-of select="$base1"/><xsl:text> to the power of </xsl:text><xsl:value-of select="$expon4"/><xsl:text> is </xsl:text> 59 <xsl:value-of select="math:power($base1,$expon4)"/><br/> 60 <xsl:value-of select="$base2"/><xsl:text> to the power of </xsl:text><xsl:value-of select="$expon4"/><xsl:text> is </xsl:text> 61 <xsl:value-of select="math:power($base2,$expon4)"/><br/> 62 <xsl:value-of select="$base3"/><xsl:text> to the power of </xsl:text><xsl:value-of select="$expon4"/><xsl:text> is </xsl:text> 63 <xsl:value-of select="math:power($base3,$expon4)"/><br/> 64 <xsl:value-of select="$base4"/><xsl:text> to the power of </xsl:text><xsl:value-of select="$expon4"/><xsl:text> is </xsl:text> 65 <xsl:value-of select="math:power($base4,$expon4)"/><br/> 66 <xsl:value-of select="$base5"/><xsl:text> to the power of </xsl:text><xsl:value-of select="$expon4"/><xsl:text> is </xsl:text> 67 <xsl:value-of select="math:power($base5,$expon4)"/><br/> 68 Using variable base with power -5: 69 <xsl:value-of select="$base1"/><xsl:text> to the power of </xsl:text><xsl:value-of select="$expon5"/><xsl:text> is </xsl:text> 70 <xsl:value-of select="math:power($base1,$expon5)"/><br/> 71 <xsl:value-of select="$base2"/><xsl:text> to the power of </xsl:text><xsl:value-of select="$expon5"/><xsl:text> is </xsl:text> 72 <xsl:value-of select="math:power($base2,$expon5)"/><br/> 73 <xsl:value-of select="$base3"/><xsl:text> to the power of </xsl:text><xsl:value-of select="$expon5"/><xsl:text> is </xsl:text> 74 <xsl:value-of select="math:power($base3,$expon5)"/><br/> 75 <xsl:value-of select="$base4"/><xsl:text> to the power of </xsl:text><xsl:value-of select="$expon5"/><xsl:text> is </xsl:text> 76 <xsl:value-of select="math:power($base4,$expon5)"/><br/> 77 <xsl:value-of select="$base5"/><xsl:text> to the power of </xsl:text><xsl:value-of select="$expon5"/><xsl:text> is </xsl:text> 78 <xsl:value-of select="math:power($base5,$expon5)"/><br/> 79 Using input as base with power <xsl:value-of select="$input1"/>: 80 <xsl:value-of select="$input1"/><xsl:text> to the power of </xsl:text><xsl:value-of select="$input1"/><xsl:text> is </xsl:text> 81 <xsl:value-of select="math:power($input1,$input1)"/><br/> 82 <xsl:value-of select="$input2"/><xsl:text> to the power of </xsl:text><xsl:value-of select="$input1"/><xsl:text> is </xsl:text> 83 <xsl:value-of select="math:power($input2,$input1)"/><br/> 84 <xsl:value-of select="$input3"/><xsl:text> to the power of </xsl:text><xsl:value-of select="$input1"/><xsl:text> is </xsl:text> 85 <xsl:value-of select="math:power($input3,$input1)"/><br/> 86 Using input as base with power <xsl:value-of select="$input2"/>: 87 <xsl:value-of select="$input1"/><xsl:text> to the power of </xsl:text><xsl:value-of select="$input2"/><xsl:text> is </xsl:text> 88 <xsl:value-of select="math:power($input1,$input2)"/><br/> 89 <xsl:value-of select="$input2"/><xsl:text> to the power of </xsl:text><xsl:value-of select="$input2"/><xsl:text> is </xsl:text> 90 <xsl:value-of select="math:power($input2,$input2)"/><br/> 91 <xsl:value-of select="$input3"/><xsl:text> to the power of </xsl:text><xsl:value-of select="$input2"/><xsl:text> is </xsl:text> 92 <xsl:value-of select="math:power($input3,$input2)"/><br/> 93 Using input as base with power <xsl:value-of select="$input3"/>: 94 <xsl:value-of select="$input1"/><xsl:text> to the power of </xsl:text><xsl:value-of select="$input3"/><xsl:text> is </xsl:text> 95 <xsl:value-of select="math:power($input1,$input3)"/><br/> 96 <xsl:value-of select="$input2"/><xsl:text> to the power of </xsl:text><xsl:value-of select="$input3"/><xsl:text> is </xsl:text> 97 <xsl:value-of select="math:power($input2,$input3)"/><br/> 98 <xsl:value-of select="$input3"/><xsl:text> to the power of </xsl:text><xsl:value-of select="$input3"/><xsl:text> is </xsl:text> 99 <xsl:value-of select="math:power($input3,$input3)"/><br/> 100 101 </out> 102</xsl:template> 103 104 105 <!-- 106 * Licensed to the Apache Software Foundation (ASF) under one 107 * or more contributor license agreements. See the NOTICE file 108 * distributed with this work for additional information 109 * regarding copyright ownership. The ASF licenses this file 110 * to you under the Apache License, Version 2.0 (the "License"); 111 * you may not use this file except in compliance with the License. 112 * You may obtain a copy of the License at 113 * 114 * http://www.apache.org/licenses/LICENSE-2.0 115 * 116 * Unless required by applicable law or agreed to in writing, software 117 * distributed under the License is distributed on an "AS IS" BASIS, 118 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 119 * See the License for the specific language governing permissions and 120 * limitations under the License. 121 --> 122 123</xsl:stylesheet> 124