xref: /aosp_15_r20/external/apache-xml/test/tests/contrib/var/var01.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<!-- var01.xsl: variations on a theme:Bugzilla#4218; input .xml is ignored-->
6
7<!-- Theme: passing with-param, somehow variable stack frame gets messed up -->
8<xsl:template match="/">
9    <out>
10      <!-- Variables declared at same level as call-template -->
11      <xsl:variable name="v1" select="'abc-should-appear-once'"/>
12      <xsl:variable name="v2" select="'def-should-appear-once'"/>
13      <!-- Extraneous variable decl -->
14      <xsl:variable name="v3" select="'ghi-should-appear-once'"/>
15
16      <xsl:call-template name="template1">
17        <!-- Param name is same in all cases -->
18        <xsl:with-param name="param1">
19          <xsl:call-template name="template2">
20            <xsl:with-param name="param1" select="$v1"/>
21          </xsl:call-template>
22          <xsl:value-of select="$v2"/>
23        </xsl:with-param>
24      </xsl:call-template>
25    </out>
26  </xsl:template>
27
28  <xsl:template name="template1">
29    <xsl:param name="param1" select="'error'"/>
30    <template1><xsl:value-of select="$param1"/></template1>
31  </xsl:template>
32
33  <xsl:template name="template2">
34    <xsl:param name="param1" select="'error'"/>
35    <template2><xsl:value-of select="$param1"/></template2>
36  </xsl:template>
37
38  <!--
39   * Licensed to the Apache Software Foundation (ASF) under one
40   * or more contributor license agreements. See the NOTICE file
41   * distributed with this work for additional information
42   * regarding copyright ownership. The ASF licenses this file
43   * to you under the Apache License, Version 2.0 (the  "License");
44   * you may not use this file except in compliance with the License.
45   * You may obtain a copy of the License at
46   *
47   *     http://www.apache.org/licenses/LICENSE-2.0
48   *
49   * Unless required by applicable law or agreed to in writing, software
50   * distributed under the License is distributed on an "AS IS" BASIS,
51   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
52   * See the License for the specific language governing permissions and
53   * limitations under the License.
54  -->
55
56</xsl:stylesheet>
57