xref: /aosp_15_r20/external/apache-xml/test/tests/conf/variable/variable49.xsl (revision 1212f9a0ffdc28482b8821715d2222bf16dc14e2)
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<xsl:output method="xml" indent="no" encoding="UTF-8"/>
6
7  <!-- FileName: variable49 -->
8  <!-- Document: http://www.w3.org/TR/xslt -->
9  <!-- DocVersion: 19991116 -->
10  <!-- Section: 11.5 -->
11  <!-- Purpose: Show that one param (p2) can be set to value of another (p1)
12    equally well in apply and call template invocations. -->
13  <!-- Author: Scott Boag -->
14
15<xsl:template match="/">
16  <out>
17    <xsl:apply-templates select="*"/>
18    <xsl:text>&#10;== apply above, call below ==&#10;</xsl:text>
19    <xsl:for-each select="//*">
20      <xsl:call-template name="matchElem"/>
21    </xsl:for-each>
22  </out>
23</xsl:template>
24
25<xsl:template match="*">
26  <xsl:param name="p1" select="@id"/>
27  <xsl:param name="p2" select="$p1"/>
28  <xsl:value-of select="$p1"/>,  <xsl:value-of select="$p2"/>
29  <xsl:text>&#10;</xsl:text>
30  <xsl:apply-templates select="*"/><!-- Recursively visit all children -->
31</xsl:template>
32
33<xsl:template name="matchElem">
34  <xsl:param name="p1" select="@id"/>
35  <xsl:param name="p2" select="$p1"/>
36  <xsl:value-of select="$p1"/>,  <xsl:value-of select="$p2"/>
37  <xsl:text>&#10;</xsl:text>
38</xsl:template>
39
40
41  <!--
42   * Licensed to the Apache Software Foundation (ASF) under one
43   * or more contributor license agreements. See the NOTICE file
44   * distributed with this work for additional information
45   * regarding copyright ownership. The ASF licenses this file
46   * to you under the Apache License, Version 2.0 (the  "License");
47   * you may not use this file except in compliance with the License.
48   * You may obtain a copy of the License at
49   *
50   *     http://www.apache.org/licenses/LICENSE-2.0
51   *
52   * Unless required by applicable law or agreed to in writing, software
53   * distributed under the License is distributed on an "AS IS" BASIS,
54   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
55   * See the License for the specific language governing permissions and
56   * limitations under the License.
57  -->
58
59</xsl:stylesheet>
60