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:constant() --> 8 9<xsl:variable name="cstant1" select='"PI"'/> 10<xsl:variable name="cstant2" select='"E"'/> 11<xsl:variable name="cstant3" select='"SQRRT2"'/> 12<xsl:variable name="cstant4" select='"LN2"'/> 13<xsl:variable name="cstant5" select='"LN10"'/> 14<xsl:variable name="cstant6" select='"LOG2E"'/> 15<xsl:variable name="cstant7" select='"SQRT1_2"'/> 16 17<xsl:variable name="precision1" select="0"/> 18<xsl:variable name="precision2" select="1"/> 19<xsl:variable name="precision3" select="2"/> 20<xsl:variable name="precision4" select="3"/> 21<xsl:variable name="precision5" select="10"/> 22<xsl:variable name="precision6" select="25"/> 23<xsl:variable name="precision7" select="50"/> 24 25<xsl:variable name="precision8" select="number(//number[1])"/> 26<xsl:variable name="precision9" select="number(//number[2])"/> 27<xsl:variable name="precision10" select="$precision8 div $precision1"/> 28 29<xsl:template match="/"> 30 <group1> 31 These are for PI: 32 <xsl:value-of select="math:constant($cstant1,$precision1)"/>, 33 <xsl:value-of select="math:constant($cstant1,$precision2)"/>, 34 <xsl:value-of select="math:constant($cstant1,$precision3)"/>, 35 <xsl:value-of select="math:constant($cstant1,$precision4)"/>, 36 <xsl:value-of select="math:constant($cstant1,$precision5)"/>, 37 <xsl:value-of select="math:constant($cstant1,$precision6)"/>, 38 <xsl:value-of select="math:constant($cstant1,$precision7)"/>, 39 <xsl:value-of select="math:constant($cstant1,$precision8)"/>, 40 <xsl:value-of select="math:constant($cstant1,$precision9)"/>, 41 <xsl:value-of select="math:constant($cstant1,$precision10)"/> 42 43 </group1> 44 <group2> 45 These are for E: 46 <xsl:value-of select="math:constant($cstant2,$precision1)"/>, 47 <xsl:value-of select="math:constant($cstant2,$precision2)"/>, 48 <xsl:value-of select="math:constant($cstant2,$precision3)"/>, 49 <xsl:value-of select="math:constant($cstant2,$precision4)"/>, 50 <xsl:value-of select="math:constant($cstant2,$precision5)"/>, 51 <xsl:value-of select="math:constant($cstant2,$precision6)"/>, 52 <xsl:value-of select="math:constant($cstant2,$precision7)"/>, 53 <xsl:value-of select="math:constant($cstant2,$precision8)"/>, 54 <xsl:value-of select="math:constant($cstant2,$precision9)"/>, 55 <xsl:value-of select="math:constant($cstant2,$precision10)"/>, 56 57 </group2> 58 <group3> 59 These are for SQRRT2 60 <xsl:value-of select="math:constant($cstant3,$precision1)"/>, 61 <xsl:value-of select="math:constant($cstant3,$precision2)"/>, 62 <xsl:value-of select="math:constant($cstant3,$precision3)"/>, 63 <xsl:value-of select="math:constant($cstant3,$precision4)"/>, 64 <xsl:value-of select="math:constant($cstant3,$precision5)"/>, 65 <xsl:value-of select="math:constant($cstant3,$precision6)"/>, 66 <xsl:value-of select="math:constant($cstant3,$precision7)"/>, 67 <xsl:value-of select="math:constant($cstant3,$precision8)"/>, 68 <xsl:value-of select="math:constant($cstant3,$precision9)"/>, 69 <xsl:value-of select="math:constant($cstant3,$precision10)"/>, 70 71 </group3> 72 <group4> 73 These are for LN2 74 <xsl:value-of select="math:constant($cstant4,$precision1)"/>, 75 <xsl:value-of select="math:constant($cstant4,$precision2)"/>, 76 <xsl:value-of select="math:constant($cstant4,$precision3)"/>, 77 <xsl:value-of select="math:constant($cstant4,$precision4)"/>, 78 <xsl:value-of select="math:constant($cstant4,$precision5)"/>, 79 <xsl:value-of select="math:constant($cstant4,$precision6)"/>, 80 <xsl:value-of select="math:constant($cstant4,$precision7)"/>, 81 <xsl:value-of select="math:constant($cstant4,$precision8)"/>, 82 <xsl:value-of select="math:constant($cstant4,$precision9)"/>, 83 <xsl:value-of select="math:constant($cstant4,$precision10)"/>, 84 85 </group4> 86 <group5> 87 These are for LN10 88 <xsl:value-of select="math:constant($cstant5,$precision1)"/>, 89 <xsl:value-of select="math:constant($cstant5,$precision2)"/>, 90 <xsl:value-of select="math:constant($cstant5,$precision3)"/>, 91 <xsl:value-of select="math:constant($cstant5,$precision4)"/>, 92 <xsl:value-of select="math:constant($cstant5,$precision5)"/>, 93 <xsl:value-of select="math:constant($cstant5,$precision6)"/>, 94 <xsl:value-of select="math:constant($cstant5,$precision7)"/>, 95 <xsl:value-of select="math:constant($cstant5,$precision8)"/>, 96 <xsl:value-of select="math:constant($cstant5,$precision9)"/>, 97 <xsl:value-of select="math:constant($cstant5,$precision10)"/>, 98 99 </group5> 100 <group6> 101 These are for LOG2E 102 <xsl:value-of select="math:constant($cstant6,$precision1)"/>, 103 <xsl:value-of select="math:constant($cstant6,$precision2)"/>, 104 <xsl:value-of select="math:constant($cstant6,$precision3)"/>, 105 <xsl:value-of select="math:constant($cstant6,$precision4)"/>, 106 <xsl:value-of select="math:constant($cstant6,$precision5)"/>, 107 <xsl:value-of select="math:constant($cstant6,$precision6)"/>, 108 <xsl:value-of select="math:constant($cstant6,$precision7)"/>, 109 <xsl:value-of select="math:constant($cstant6,$precision8)"/>, 110 <xsl:value-of select="math:constant($cstant6,$precision9)"/>, 111 <xsl:value-of select="math:constant($cstant6,$precision10)"/>, 112 113 </group6> 114 115 <group7> 116 These are for SQRT1_2 117 <xsl:value-of select="math:constant($cstant7,$precision1)"/>, 118 <xsl:value-of select="math:constant($cstant7,$precision2)"/>, 119 <xsl:value-of select="math:constant($cstant7,$precision3)"/>, 120 <xsl:value-of select="math:constant($cstant7,$precision4)"/>, 121 <xsl:value-of select="math:constant($cstant7,$precision5)"/>, 122 <xsl:value-of select="math:constant($cstant7,$precision6)"/>, 123 <xsl:value-of select="math:constant($cstant7,$precision7)"/>, 124 <xsl:value-of select="math:constant($cstant7,$precision8)"/>, 125 <xsl:value-of select="math:constant($cstant7,$precision9)"/>, 126 <xsl:value-of select="math:constant($cstant7,$precision10)"/>, 127 128 </group7> 129 130</xsl:template> 131 132 133 <!-- 134 * Licensed to the Apache Software Foundation (ASF) under one 135 * or more contributor license agreements. See the NOTICE file 136 * distributed with this work for additional information 137 * regarding copyright ownership. The ASF licenses this file 138 * to you under the Apache License, Version 2.0 (the "License"); 139 * you may not use this file except in compliance with the License. 140 * You may obtain a copy of the License at 141 * 142 * http://www.apache.org/licenses/LICENSE-2.0 143 * 144 * Unless required by applicable law or agreed to in writing, software 145 * distributed under the License is distributed on an "AS IS" BASIS, 146 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 147 * See the License for the specific language governing permissions and 148 * limitations under the License. 149 --> 150 151</xsl:stylesheet> 152