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