xref: /aosp_15_r20/external/apache-xml/test/tests/conf/axes/axes113.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: axes113 -->
5  <!-- Document: http://www.w3.org/TR/xpath -->
6  <!-- DocVersion: 19991116 -->
7  <!-- Section: 2.2 -->
8  <!-- Purpose: Comprehensive test of all axes -->
9  <!-- Author: Dave Haffner -->
10
11<xsl:strip-space elements="*"/>
12
13<xsl:template match="//a[@id='36']">
14<out>
15   <xsl:text>matched on node </xsl:text>
16   <xsl:value-of select="./@id"/>
17   <xsl:text>: </xsl:text>
18
19   <xsl:call-template name="displayNodes">
20      <xsl:with-param name="nodeList" select="parent::*" />
21      <xsl:with-param name="axisName" select="'parent::*'" />
22   </xsl:call-template>
23
24   <xsl:call-template name="displayNodes">
25      <xsl:with-param name="nodeList" select="following::*" />
26      <xsl:with-param name="axisName" select="'following::*'" />
27   </xsl:call-template>
28
29   <xsl:call-template name="displayNodes">
30      <xsl:with-param name="nodeList" select="following-sibling::*" />
31      <xsl:with-param name="axisName" select="'following-sibling::*'" />
32   </xsl:call-template>
33
34   <xsl:call-template name="displayNodes">
35      <xsl:with-param name="nodeList" select="preceding::*" />
36      <xsl:with-param name="axisName" select="'preceding::*'" />
37   </xsl:call-template>
38
39   <xsl:call-template name="displayNodes">
40      <xsl:with-param name="nodeList" select="preceding-sibling::*" />
41      <xsl:with-param name="axisName" select="'preceding-sibling::*'" />
42   </xsl:call-template>
43
44   <xsl:call-template name="displayNodes">
45      <xsl:with-param name="nodeList" select="child::*" />
46      <xsl:with-param name="axisName" select="'child::*'" />
47   </xsl:call-template>
48
49   <xsl:call-template name="displayNodes">
50      <xsl:with-param name="nodeList" select="descendant::*" />
51      <xsl:with-param name="axisName" select="'descendant::*'" />
52   </xsl:call-template>
53
54   <xsl:call-template name="displayNodes">
55      <xsl:with-param name="nodeList" select="descendant-or-self::*" />
56      <xsl:with-param name="axisName" select="'descendant-or-self::*'" />
57   </xsl:call-template>
58
59   <xsl:call-template name="displayNodes">
60      <xsl:with-param name="nodeList" select="ancestor::*" />
61      <xsl:with-param name="axisName" select="'ancestor::*'" />
62   </xsl:call-template>
63
64   <xsl:call-template name="displayNodes">
65      <xsl:with-param name="nodeList" select="ancestor-or-self::*" />
66      <xsl:with-param name="axisName" select="'ancestor-or-self::*'" />
67   </xsl:call-template>
68
69  <!-- Special handling for attribute axis. -->
70  <xsl:text>&#10;     Axis: attribute::* (sorted):  </xsl:text>
71  <xsl:for-each select="attribute::*" >
72    <xsl:sort select="name()"/>
73    <xsl:value-of select="name()"/>
74    <xsl:text>: </xsl:text>
75    <xsl:value-of select="."/>
76    <xsl:text>, </xsl:text>
77  </xsl:for-each>
78</out>
79</xsl:template>
80
81<xsl:template name="displayNodes">
82   <xsl:param name="nodeList" select="/.."/>
83   <xsl:param name="axisName" select="''" />
84     Axis: <xsl:value-of select="$axisName"/>
85     <xsl:text>:  </xsl:text>
86        <xsl:for-each select="$nodeList" >
87            <xsl:value-of select="@id"/>
88            <xsl:text>,</xsl:text>
89        </xsl:for-each>
90</xsl:template>
91
92
93  <!--
94   * Licensed to the Apache Software Foundation (ASF) under one
95   * or more contributor license agreements. See the NOTICE file
96   * distributed with this work for additional information
97   * regarding copyright ownership. The ASF licenses this file
98   * to you under the Apache License, Version 2.0 (the  "License");
99   * you may not use this file except in compliance with the License.
100   * You may obtain a copy of the License at
101   *
102   *     http://www.apache.org/licenses/LICENSE-2.0
103   *
104   * Unless required by applicable law or agreed to in writing, software
105   * distributed under the License is distributed on an "AS IS" BASIS,
106   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
107   * See the License for the specific language governing permissions and
108   * limitations under the License.
109  -->
110
111</xsl:stylesheet>
112