xref: /aosp_15_r20/external/apache-xml/test/tests/conf/axes/axes15.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: AXES15 -->
5  <!-- Document: http://www.w3.org/TR/xpath -->
6  <!-- DocVersion: 19991116 -->
7  <!-- Section: 2.2 -->
8  <!-- Purpose: Test for completion of tree using all axes. -->
9
10<xsl:template match="/">
11  <out>
12    <xsl:text>From root:
13</xsl:text>
14    <xsl:call-template name="show-four-directions"/>
15    <xsl:for-each select="descendant-or-self::*">
16       <xsl:text>
17------------------------------------------------
18</xsl:text>
19<xsl:variable name="ename">
20       <xsl:text>From-</xsl:text>
21       <xsl:value-of select="name()"/>
22</xsl:variable>
23<xsl:element name="{$ename}"><xsl:text>&#10;</xsl:text>
24       <xsl:call-template name="show-four-directions"/>
25</xsl:element>
26    </xsl:for-each>
27  </out>
28</xsl:template>
29
30<xsl:template name="show-four-directions">
31  <xsl:text>ancestors: </xsl:text>
32  <xsl:for-each select="ancestor::*">
33    <xsl:value-of select="name()"/><xsl:text> </xsl:text>
34  </xsl:for-each><xsl:text>
35</xsl:text>
36  <xsl:text>preceding: </xsl:text>
37  <xsl:for-each select="preceding::*">
38    <xsl:value-of select="name()"/><xsl:text> </xsl:text>
39  </xsl:for-each><xsl:text>
40</xsl:text>
41  <xsl:text>self: </xsl:text>
42  <xsl:for-each select="self::*">
43    <xsl:value-of select="name()"/><xsl:text> </xsl:text>
44  </xsl:for-each><xsl:text>
45</xsl:text>
46  <xsl:text>descendant: </xsl:text>
47  <xsl:for-each select="descendant::*">
48    <xsl:value-of select="name()"/><xsl:text> </xsl:text>
49  </xsl:for-each><xsl:text>
50</xsl:text>
51  <xsl:text>following: </xsl:text>
52  <xsl:for-each select="following::*">
53    <xsl:value-of select="name()"/><xsl:text> </xsl:text>
54  </xsl:for-each>
55</xsl:template>
56
57
58  <!--
59   * Licensed to the Apache Software Foundation (ASF) under one
60   * or more contributor license agreements. See the NOTICE file
61   * distributed with this work for additional information
62   * regarding copyright ownership. The ASF licenses this file
63   * to you under the Apache License, Version 2.0 (the  "License");
64   * you may not use this file except in compliance with the License.
65   * You may obtain a copy of the License at
66   *
67   *     http://www.apache.org/licenses/LICENSE-2.0
68   *
69   * Unless required by applicable law or agreed to in writing, software
70   * distributed under the License is distributed on an "AS IS" BASIS,
71   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
72   * See the License for the specific language governing permissions and
73   * limitations under the License.
74  -->
75
76</xsl:stylesheet>
77