xref: /aosp_15_r20/external/apache-xml/test/tests/api/trax/ParameterTest.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: ParameterTest.xsl -->
5  <!-- Document: http://www.w3.org/TR/xslt -->
6  <!-- DocVersion: 19990922 -->
7  <!-- Section: 11.2 Values of Variables and Parameters  -->
8  <!-- Purpose: Functional test of various usages of parameters in transforms -->
9
10<!-- Declare one of each flavor of common global param statements -->
11<xsl:param name="p1">
12    <B>ABC</B>
13</xsl:param>
14
15<xsl:param name="p2"><B>DEF</B></xsl:param>
16
17<xsl:param name="t1">notset</xsl:param>
18
19<xsl:param name="s1" select="'s1val'">
20</xsl:param>
21
22<xsl:param name="s2" select="'s2val'"></xsl:param>
23
24<xsl:template match="doc">
25  <xsl:param name="p3"><B>GHI</B></xsl:param>
26  <xsl:param name="s3" select="'s3val'"></xsl:param>
27
28  <outp>
29    <xsl:value-of select="$p1"/><xsl:text>,</xsl:text><xsl:copy-of select="$p1"/><xsl:text>; </xsl:text>
30    <xsl:value-of select="$p2"/><xsl:text>,</xsl:text><xsl:copy-of select="$p2"/><xsl:text>; </xsl:text>
31    <xsl:value-of select="$p3"/><xsl:text>,</xsl:text><xsl:copy-of select="$p3"/><xsl:text>; </xsl:text>
32  </outp>
33  <xsl:text>:
34  </xsl:text>
35  <outs>
36    <xsl:value-of select="$s1"/><xsl:text>,</xsl:text><xsl:copy-of select="$s1"/><xsl:text>; </xsl:text>
37    <xsl:value-of select="$s2"/><xsl:text>,</xsl:text><xsl:copy-of select="$s2"/><xsl:text>; </xsl:text>
38    <xsl:value-of select="$s3"/><xsl:text>,</xsl:text><xsl:copy-of select="$s3"/><xsl:text>; </xsl:text>
39  </outs>
40  <xsl:text>:
41  </xsl:text>
42
43  <outt>
44    <xsl:value-of select="$t1='notset'"/><xsl:text>-notset,</xsl:text>
45    <xsl:value-of select="$t1=''"/><xsl:text>-blank,</xsl:text>
46    <xsl:value-of select="$t1='a'"/><xsl:text>-a,</xsl:text>
47    <xsl:value-of select="$t1='1'"/><xsl:text>-1,</xsl:text>
48    <xsl:value-of select="$t1"/>
49  </outt>
50  <xsl:apply-templates/>
51
52  <!-- @todo Should also call a template and pass a param as well -->
53</xsl:template>
54
55<xsl:template match="item[text() = '2']">
56  <xsl:text>Item-2-found</xsl:text>
57</xsl:template>
58
59
60  <!--
61   * Licensed to the Apache Software Foundation (ASF) under one
62   * or more contributor license agreements. See the NOTICE file
63   * distributed with this work for additional information
64   * regarding copyright ownership. The ASF licenses this file
65   * to you under the Apache License, Version 2.0 (the  "License");
66   * you may not use this file except in compliance with the License.
67   * You may obtain a copy of the License at
68   *
69   *     http://www.apache.org/licenses/LICENSE-2.0
70   *
71   * Unless required by applicable law or agreed to in writing, software
72   * distributed under the License is distributed on an "AS IS" BASIS,
73   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
74   * See the License for the specific language governing permissions and
75   * limitations under the License.
76  -->
77
78</xsl:stylesheet>
79