1<?xml version="1.0"?> 2<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> 3 4 <!-- FileName: namedtemplate08 --> 5 <!-- Document: http://www.w3.org/TR/xslt --> 6 <!-- DocVersion: 19991116 --> 7 <!-- Section: 6 Named Templates --> 8 <!-- Creator: David Marston --> 9 <!-- Purpose: Test of nested template calls. --> 10 <!-- Output should not have pvarN default data --> 11 12<xsl:template match="doc"> 13 <out> 14 <xsl:variable name="RTF"> 15 <xsl:value-of select="a"/> 16 </xsl:variable> 17 <xsl:call-template name="tmplt1"> 18 <xsl:with-param name="pvar1" select="$RTF"/> 19 </xsl:call-template> 20 </out> 21</xsl:template> 22 23<xsl:template name="tmplt1"> 24 <xsl:param name="pvar1">pvar1 default data</xsl:param> 25 <xsl:value-of select="$pvar1"/><xsl:text>,</xsl:text> 26 <xsl:call-template name="tmplt2"> 27 <xsl:with-param name="pvar2" select="555"/> 28 </xsl:call-template> 29 <xsl:text> 30Back to first template.</xsl:text> 31</xsl:template> 32 33<xsl:template name="tmplt2"> 34 <xsl:param name="pvar2">pvar2 default data</xsl:param> 35 <xsl:variable name="subnode"> 36 <xsl:value-of select="b"/> 37 </xsl:variable> 38 <!-- pvar2 won't be in scope in next template, so pass it in via new variable. --> 39 <xsl:variable name="passto3"> 40 <xsl:value-of select="number($pvar2)"/> 41 </xsl:variable> 42 43 <xsl:value-of select="$passto3"/><xsl:text>,</xsl:text> 44 <xsl:call-template name="tmplt3"> 45 <xsl:with-param name="pvar3" select="$subnode"/> 46 <xsl:with-param name="t1num" select="$passto3"/> 47 </xsl:call-template> 48 <xsl:text> 49Back to template 2.</xsl:text> 50</xsl:template> 51 52<xsl:template name="tmplt3"> 53 <xsl:param name="pvar3">pvar3 default data</xsl:param> 54 <xsl:param name="t1num">t1num default data</xsl:param> 55 <xsl:value-of select="$pvar3"/><xsl:text>,</xsl:text> 56 <xsl:value-of select="444 + $t1num"/><xsl:text>,</xsl:text> 57</xsl:template> 58 59 60 <!-- 61 * Licensed to the Apache Software Foundation (ASF) under one 62 * or more contributor license agreements. See the NOTICE file 63 * distributed with this work for additional information 64 * regarding copyright ownership. The ASF licenses this file 65 * to you under the Apache License, Version 2.0 (the "License"); 66 * you may not use this file except in compliance with the License. 67 * You may obtain a copy of the License at 68 * 69 * http://www.apache.org/licenses/LICENSE-2.0 70 * 71 * Unless required by applicable law or agreed to in writing, software 72 * distributed under the License is distributed on an "AS IS" BASIS, 73 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 74 * See the License for the specific language governing permissions and 75 * limitations under the License. 76 --> 77 78</xsl:stylesheet> 79