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