xref: /aosp_15_r20/external/apache-xml/test/tests/conf/namedtemplate/namedtemplate02.xsl (revision 1212f9a0ffdc28482b8821715d2222bf16dc14e2)
1<?xml version="1.0"?>
2<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
3
4  <!-- FileName: namedtemplate02 -->
5  <!-- Document: http://www.w3.org/TR/xslt -->
6  <!-- DocVersion: 19991116 -->
7  <!-- Section: 6 -->
8  <!-- Creator: Paul Dick -->
9  <!-- Purpose: Test for xsl:call-template of one that has both match and name. -->
10
11  <!-- Also verifies that xsl:call-template does not change
12       the current node or the current node list resulting in
13       'top-level-a' being printed twice during the first
14       instantiation of the named template. -->
15
16<xsl:template match="doc">
17  <out>
18    <xsl:variable name="X1">
19      <xsl:value-of select="a"/>
20    </xsl:variable>
21
22    <xsl:call-template name="ntmp1">
23      <xsl:with-param name="pvar1" select="'Call-template'"/>
24      <xsl:with-param name="pvar2" select="$X1"/>
25    </xsl:call-template>
26
27    <xsl:text>&#010;</xsl:text>
28
29    <xsl:apply-templates select="doc1">
30      <xsl:with-param name="pvar1" select="'Apply-templates'"/>
31      <xsl:with-param name="pvar2" select="$X1"/>
32    </xsl:apply-templates>
33  </out>
34</xsl:template>
35
36<xsl:template name="ntmp1" match="doc1">
37  <xsl:param name="pvar1">Default text in pvar1</xsl:param>
38  <xsl:param name="pvar2">Default text in pvar2</xsl:param>
39
40  <xsl:value-of select="$pvar1"/><xsl:text>,</xsl:text>
41  <xsl:value-of select="$pvar2"/><xsl:text>,</xsl:text>
42  <xsl:value-of select="a"/><xsl:text>,</xsl:text>
43</xsl:template>
44
45
46  <!--
47   * Licensed to the Apache Software Foundation (ASF) under one
48   * or more contributor license agreements. See the NOTICE file
49   * distributed with this work for additional information
50   * regarding copyright ownership. The ASF licenses this file
51   * to you under the Apache License, Version 2.0 (the  "License");
52   * you may not use this file except in compliance with the License.
53   * You may obtain a copy of the License at
54   *
55   *     http://www.apache.org/licenses/LICENSE-2.0
56   *
57   * Unless required by applicable law or agreed to in writing, software
58   * distributed under the License is distributed on an "AS IS" BASIS,
59   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
60   * See the License for the specific language governing permissions and
61   * limitations under the License.
62  -->
63
64</xsl:stylesheet>
65