xref: /aosp_15_r20/external/apache-xml/test/tests/conf/match/match30.xsl (revision 1212f9a0ffdc28482b8821715d2222bf16dc14e2)
1<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
2
3  <!-- FileName: match30 -->
4  <!-- Document: http://www.w3.org/TR/xslt -->
5  <!-- DocVersion: 19991116 -->
6  <!-- Section: 5.2 -->
7  <!-- Purpose: Use multiple levels of child axis in match patterns.
8     Intermix 'child::' and default, but only with child:: in the middle. -->
9  <!-- Creator: Henry Zongaro -->
10
11<xsl:output method="xml" encoding="UTF-8" indent="no"/>
12
13  <xsl:template match="/">
14    <out>
15      <xsl:apply-templates/><!-- rely on some built-ins -->
16    </out>
17  </xsl:template>
18
19  <xsl:template match="doc/l1/v2">
20    <xsl:text>
21</xsl:text>
22    <match>
23      <xsl:text>Rule doc/l1/v2; value of matched node:  </xsl:text>
24      <xsl:value-of select='.'/>
25    </match>
26  </xsl:template>
27
28  <xsl:template match="doc/l1//v3">
29    <xsl:text>
30</xsl:text>
31    <match>
32      <xsl:text>Rule doc/l1//v3; value of matched node:  </xsl:text>
33      <xsl:value-of select='.'/>
34    </match>
35  </xsl:template>
36
37  <xsl:template match="doc//l2/w3">
38    <xsl:text>
39</xsl:text>
40    <match>
41      <xsl:text>Rule doc//l2/w3; value of matched node:  </xsl:text>
42      <xsl:value-of select='.'/>
43    </match>
44  </xsl:template>
45
46  <xsl:template match="doc//l2//v4">
47    <xsl:text>
48</xsl:text>
49    <match>
50      <xsl:text>Rule doc//l2//v4; value of matched node:  </xsl:text>
51      <xsl:value-of select='.'/>
52    </match>
53  </xsl:template>
54
55  <xsl:template match="doc/child::l1/x2">
56    <xsl:text>
57</xsl:text>
58    <match>
59      <xsl:text>Rule doc/child::l1/x2; value of matched node:  </xsl:text>
60      <xsl:value-of select='.'/>
61    </match>
62  </xsl:template>
63
64  <xsl:template match="doc/child::l1//x3">
65    <xsl:text>
66</xsl:text>
67    <match>
68      <xsl:text>Rule doc/child::l1//x3; value of matched node:  </xsl:text>
69      <xsl:value-of select='.'/>
70    </match>
71  </xsl:template>
72
73  <xsl:template match="doc//child::l2/y3">
74    <xsl:text>
75</xsl:text>
76    <match>
77      <xsl:text>Rule doc//child::l2/y3; value of matched node:  </xsl:text>
78      <xsl:value-of select='.'/>
79    </match>
80  </xsl:template>
81
82  <xsl:template match="doc//child::l2//x4">
83    <xsl:text>
84</xsl:text>
85    <match>
86      <xsl:text>Rule doc//child::l2//x4; value of matched node:  </xsl:text>
87      <xsl:value-of select='.'/>
88    </match>
89  </xsl:template>
90
91  <xsl:template match='text()'/><!-- squelch direct replay of text -->
92
93
94  <!--
95   * Licensed to the Apache Software Foundation (ASF) under one
96   * or more contributor license agreements. See the NOTICE file
97   * distributed with this work for additional information
98   * regarding copyright ownership. The ASF licenses this file
99   * to you under the Apache License, Version 2.0 (the  "License");
100   * you may not use this file except in compliance with the License.
101   * You may obtain a copy of the License at
102   *
103   *     http://www.apache.org/licenses/LICENSE-2.0
104   *
105   * Unless required by applicable law or agreed to in writing, software
106   * distributed under the License is distributed on an "AS IS" BASIS,
107   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
108   * See the License for the specific language governing permissions and
109   * limitations under the License.
110  -->
111
112</xsl:stylesheet>
113