xref: /aosp_15_r20/external/apache-xml/test/tests/contrib/var/var02.xsl (revision 1212f9a0ffdc28482b8821715d2222bf16dc14e2)
1<?xml version="1.0" encoding="utf-8"?>
2<xsl:stylesheet
3  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
4  version="1.0">
5<!-- var02.xsl: variations on a theme:Bugzilla#4218 related stylesheets-->
6
7<xsl:template match="doc">
8    <out>
9      <!-- Variables declared at same level as call-template -->
10      <xsl:variable name="v1" select="'abc-should-appear-once'"/>
11      <xsl:variable name="v2" select="'def-should-appear-once'"/>
12
13      <xsl:call-template name="template1">
14        <!-- Param name is same in all cases -->
15        <xsl:with-param name="param1">
16          <!-- Theme change: apply-templates instead of call-template -->
17          <xsl:apply-templates select="list[@number='1']">
18            <xsl:with-param name="param1" select="$v1"/>
19          </xsl:apply-templates>
20          <xsl:value-of select="$v2"/>
21        </xsl:with-param>
22      </xsl:call-template>
23    </out>
24  </xsl:template>
25
26  <xsl:template name="template1">
27    <xsl:param name="param1" select="'error'"/>
28    <template1><xsl:value-of select="$param1"/></template1>
29  </xsl:template>
30
31  <xsl:template name="template2" match="list">
32    <xsl:param name="param1" select="'error'"/>
33    <template2><xsl:value-of select="$param1"/></template2>
34  </xsl:template>
35
36  <!--
37   * Licensed to the Apache Software Foundation (ASF) under one
38   * or more contributor license agreements. See the NOTICE file
39   * distributed with this work for additional information
40   * regarding copyright ownership. The ASF licenses this file
41   * to you under the Apache License, Version 2.0 (the  "License");
42   * you may not use this file except in compliance with the License.
43   * You may obtain a copy of the License at
44   *
45   *     http://www.apache.org/licenses/LICENSE-2.0
46   *
47   * Unless required by applicable law or agreed to in writing, software
48   * distributed under the License is distributed on an "AS IS" BASIS,
49   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
50   * See the License for the specific language governing permissions and
51   * limitations under the License.
52  -->
53
54</xsl:stylesheet>
55