1<?xml version='1.0' encoding='utf-8' ?> 2 3<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> 4 5<xsl:output method="text" indent="no"/> 6 7 8 9 <!-- FileName: compare.xsl --> 10 11 <!-- Creator: John Li, Schemasoft --> 12 13 <!-- Purpose: Compare values of numerical parameters that are set using "select" and by child --> 14 15 16 17 <xsl:template match="/"> 18 19 <xsl:call-template name="compare"> 20 21 <xsl:with-param name="a" select="3"/> 22 23 <xsl:with-param name="b">1</xsl:with-param> 24 25 <xsl:with-param name="x">3</xsl:with-param> 26 27 </xsl:call-template> 28 29 </xsl:template> 30 31 32 33 <xsl:template name="compare"> 34 35 <xsl:param name="a"/> 36 37 <xsl:param name="b"/> 38 39 <xsl:param name="x"/> 40 41a = <xsl:value-of select="$a"/> 42 43b = <xsl:value-of select="$b"/> 44 45x = <xsl:value-of select="$x"/> 46 47a > b<xsl:if test="not($a > $b)"> fail</xsl:if> 48 49b < a<xsl:if test="not($b < $a)"> fail</xsl:if> 50 51a == x<xsl:if test="not($a = $x)"> fail</xsl:if> 52 53a <= x<xsl:if test="not($a <= $x)"> fail</xsl:if> 54 55a >= x<xsl:if test="not($a >= $x)"> fail</xsl:if> 56 57b <= a<xsl:if test="not($b <= $a)"> fail</xsl:if> 58 59a >= b<xsl:if test="not($a >= $b)"> fail</xsl:if> 60 61 </xsl:template> 62 63 <!-- 64 * Licensed to the Apache Software Foundation (ASF) under one 65 * or more contributor license agreements. See the NOTICE file 66 * distributed with this work for additional information 67 * regarding copyright ownership. The ASF licenses this file 68 * to you under the Apache License, Version 2.0 (the "License"); 69 * you may not use this file except in compliance with the License. 70 * You may obtain a copy of the License at 71 * 72 * http://www.apache.org/licenses/LICENSE-2.0 73 * 74 * Unless required by applicable law or agreed to in writing, software 75 * distributed under the License is distributed on an "AS IS" BASIS, 76 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 77 * See the License for the specific language governing permissions and 78 * limitations under the License. 79 --> 80 81</xsl:stylesheet> 82