xref: /aosp_15_r20/external/apache-xml/test/tests/extensions/library/libraryNodeset07.xsl (revision 1212f9a0ffdc28482b8821715d2222bf16dc14e2)
1*1212f9a0SAndroid Build Coastguard Worker<?xml version="1.0"?>
2*1212f9a0SAndroid Build Coastguard Worker<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
3*1212f9a0SAndroid Build Coastguard Worker                xmlns:ex="http://xml.apache.org/xalan"
4*1212f9a0SAndroid Build Coastguard Worker                extension-element-prefixes="ex">
5*1212f9a0SAndroid Build Coastguard Worker
6*1212f9a0SAndroid Build Coastguard Worker  <!-- FileName: libraryNodeset07 -->
7*1212f9a0SAndroid Build Coastguard Worker  <!-- Document: http://www.w3.org/TR/xslt -->
8*1212f9a0SAndroid Build Coastguard Worker  <!-- DocVersion: 19991116 -->
9*1212f9a0SAndroid Build Coastguard Worker  <!-- Section: 11.4 -->
10*1212f9a0SAndroid Build Coastguard Worker  <!-- Creator: Joe Kesselman -->
11*1212f9a0SAndroid Build Coastguard Worker  <!-- Purpose: Try paths from nodeset of global RTF; ensure we get the right one. -->
12*1212f9a0SAndroid Build Coastguard Worker  <!-- Theoretically, we should repeat the whole Axes suite for variables. -->
13*1212f9a0SAndroid Build Coastguard Worker
14*1212f9a0SAndroid Build Coastguard Worker<xsl:output method="xml" indent="no" encoding="UTF-8"/>
15*1212f9a0SAndroid Build Coastguard Worker
16*1212f9a0SAndroid Build Coastguard Worker<xsl:variable name="top1">
17*1212f9a0SAndroid Build Coastguard Worker<t1-far-north>
18*1212f9a0SAndroid Build Coastguard Worker  <t1-north>
19*1212f9a0SAndroid Build Coastguard Worker    <t1-near-north>
20*1212f9a0SAndroid Build Coastguard Worker      <t1-far-west/>
21*1212f9a0SAndroid Build Coastguard Worker      <t1-west/>
22*1212f9a0SAndroid Build Coastguard Worker      <t1-near-west/>
23*1212f9a0SAndroid Build Coastguard Worker      <center center-attr-1="c1" xmlns:n="http://example.com">Wrong variable, can you dig it?
24*1212f9a0SAndroid Build Coastguard Worker        <t1-near-south>
25*1212f9a0SAndroid Build Coastguard Worker          <t1-south>
26*1212f9a0SAndroid Build Coastguard Worker            <t1-far-south/>
27*1212f9a0SAndroid Build Coastguard Worker          </t1-south>
28*1212f9a0SAndroid Build Coastguard Worker        </t1-near-south>
29*1212f9a0SAndroid Build Coastguard Worker      </center>
30*1212f9a0SAndroid Build Coastguard Worker      <t1-near-east/>
31*1212f9a0SAndroid Build Coastguard Worker      <t1-east/>
32*1212f9a0SAndroid Build Coastguard Worker      <t1-far-east/>
33*1212f9a0SAndroid Build Coastguard Worker    </t1-near-north>
34*1212f9a0SAndroid Build Coastguard Worker  </t1-north>
35*1212f9a0SAndroid Build Coastguard Worker</t1-far-north>
36*1212f9a0SAndroid Build Coastguard Worker</xsl:variable>
37*1212f9a0SAndroid Build Coastguard Worker
38*1212f9a0SAndroid Build Coastguard Worker<xsl:variable name="top2">
39*1212f9a0SAndroid Build Coastguard Worker<t2-far-north>
40*1212f9a0SAndroid Build Coastguard Worker  <t2-north>
41*1212f9a0SAndroid Build Coastguard Worker    <t2-near-north>
42*1212f9a0SAndroid Build Coastguard Worker      <t2-far-west/>
43*1212f9a0SAndroid Build Coastguard Worker      <t2-west/>
44*1212f9a0SAndroid Build Coastguard Worker      <t2-near-west/>
45*1212f9a0SAndroid Build Coastguard Worker      <center center-attr-1="c2" xmlns:n="http://example.com">Dig we must!
46*1212f9a0SAndroid Build Coastguard Worker        <t2-near-south>
47*1212f9a0SAndroid Build Coastguard Worker          <t2-south>
48*1212f9a0SAndroid Build Coastguard Worker            <t2-far-south/>
49*1212f9a0SAndroid Build Coastguard Worker          </t2-south>
50*1212f9a0SAndroid Build Coastguard Worker        </t2-near-south>
51*1212f9a0SAndroid Build Coastguard Worker      </center>
52*1212f9a0SAndroid Build Coastguard Worker      <t2-near-east/>
53*1212f9a0SAndroid Build Coastguard Worker      <t2-east/>
54*1212f9a0SAndroid Build Coastguard Worker      <t2-far-east/>
55*1212f9a0SAndroid Build Coastguard Worker    </t2-near-north>
56*1212f9a0SAndroid Build Coastguard Worker  </t2-north>
57*1212f9a0SAndroid Build Coastguard Worker</t2-far-north>
58*1212f9a0SAndroid Build Coastguard Worker</xsl:variable>
59*1212f9a0SAndroid Build Coastguard Worker
60*1212f9a0SAndroid Build Coastguard Worker<xsl:template match="/">
61*1212f9a0SAndroid Build Coastguard Worker  <out>
62*1212f9a0SAndroid Build Coastguard Worker    <!-- First, force evaluation of each variable -->
63*1212f9a0SAndroid Build Coastguard Worker    <junk>
64*1212f9a0SAndroid Build Coastguard Worker      <xsl:text>$top1 summary: </xsl:text>
65*1212f9a0SAndroid Build Coastguard Worker      <xsl:value-of select="$top1"/>
66*1212f9a0SAndroid Build Coastguard Worker      <xsl:text>
67*1212f9a0SAndroid Build Coastguard Worker</xsl:text>
68*1212f9a0SAndroid Build Coastguard Worker      <xsl:text>$top2 summary: </xsl:text>
69*1212f9a0SAndroid Build Coastguard Worker      <xsl:value-of select="$top2"/>
70*1212f9a0SAndroid Build Coastguard Worker    </junk>
71*1212f9a0SAndroid Build Coastguard Worker
72*1212f9a0SAndroid Build Coastguard Worker    <!-- Now, traverse some axes -->
73*1212f9a0SAndroid Build Coastguard Worker    <xsl:apply-templates select="ex:nodeset($top2)//t2-north"/>
74*1212f9a0SAndroid Build Coastguard Worker  </out>
75*1212f9a0SAndroid Build Coastguard Worker</xsl:template>
76*1212f9a0SAndroid Build Coastguard Worker
77*1212f9a0SAndroid Build Coastguard Worker<xsl:template match="t2-north">
78*1212f9a0SAndroid Build Coastguard Worker  <!-- DS means the location path is optimizable as a single descendant iterator. -->
79*1212f9a0SAndroid Build Coastguard WorkerDS   1. AC: <xsl:value-of select="name(/descendant-or-self::t2-north)"/>
80*1212f9a0SAndroid Build Coastguard WorkerDS   2. AD: <xsl:value-of select="name(/descendant::t2-near-north)"/>
81*1212f9a0SAndroid Build Coastguard WorkerDS   3. BC: <xsl:value-of select="name(self::node()/descendant-or-self::t2-north)"/>
82*1212f9a0SAndroid Build Coastguard WorkerDS   4. BD: <xsl:value-of select="name(self::node()/descendant::t2-near-north)"/>
83*1212f9a0SAndroid Build Coastguard WorkerNDS  5. CC: <xsl:value-of select="name(descendant-or-self::t2-north/descendant-or-self::t2-north)"/>
84*1212f9a0SAndroid Build Coastguard WorkerNDS  6. CD: <xsl:value-of select="name(descendant-or-self::t2-north/descendant::t2-near-north)"/>
85*1212f9a0SAndroid Build Coastguard WorkerNDS  7. CE: <xsl:value-of select="name(descendant-or-self::t2-north/child::t2-near-north)"/>
86*1212f9a0SAndroid Build Coastguard WorkerNDS  8. DC: <xsl:value-of select="name(descendant::t2-near-north/descendant-or-self::t2-near-north)"/>
87*1212f9a0SAndroid Build Coastguard WorkerNDS  9. DD: <xsl:value-of select="name(descendant::t2-near-north/descendant::t2-far-west)"/>
88*1212f9a0SAndroid Build Coastguard Worker
89*1212f9a0SAndroid Build Coastguard WorkerNDS 10. ACC: <xsl:value-of select="name(/descendant-or-self::t2-north/descendant-or-self::t2-north)"/>
90*1212f9a0SAndroid Build Coastguard WorkerNDS 11. ACE: <xsl:value-of select="name(/descendant-or-self::t2-north/child::t2-near-north)"/>
91*1212f9a0SAndroid Build Coastguard WorkerNDS 12. ADC: <xsl:value-of select="name(/descendant::t2-near-north/descendant-or-self::t2-near-north)"/>
92*1212f9a0SAndroid Build Coastguard WorkerNDS 13. BCC: <xsl:value-of select="name(self::node()/descendant-or-self::t2-north/descendant-or-self::t2-north)"/>
93*1212f9a0SAndroid Build Coastguard WorkerNDS 14. BCE: <xsl:value-of select="name(self::node()/descendant-or-self::t2-north/child::t2-near-north)"/>
94*1212f9a0SAndroid Build Coastguard WorkerNDS 15. BDC: <xsl:value-of select="name(self::node()/descendant::t2-near-north/descendant-or-self::t2-far-west)"/>
95*1212f9a0SAndroid Build Coastguard WorkerNDS 16. BDE: <xsl:value-of select="name(self::node()/descendant::t2-near-north/child::t2-far-west)"/>
96*1212f9a0SAndroid Build Coastguard WorkerNDS 17. CCC: <xsl:value-of select="name(descendant-or-self::t2-north/descendant-or-self::t2-north/descendant-or-self::t2-north)"/>
97*1212f9a0SAndroid Build Coastguard WorkerNDS 18. CCE: <xsl:value-of select="name(descendant-or-self::t2-north/descendant-or-self::t2-north/child::t2-near-north)"/>
98*1212f9a0SAndroid Build Coastguard WorkerNDS 19. CDC: <xsl:value-of select="name(descendant-or-self::t2-north/descendant::t2-near-north/descendant-or-self::t2-near-north)"/>
99*1212f9a0SAndroid Build Coastguard WorkerNDS 20. CDE: <xsl:value-of select="name(descendant-or-self::t2-north/descendant::t2-near-north/child::t2-far-west)"/>
100*1212f9a0SAndroid Build Coastguard WorkerNDS 21. CEC: <xsl:value-of select="name(descendant-or-self::t2-north/child::t2-near-north/descendant-or-self::t2-near-north)"/>
101*1212f9a0SAndroid Build Coastguard WorkerNDS 22. CEE: <xsl:value-of select="name(descendant-or-self::t2-north/child::t2-near-north/child::t2-far-west)"/>
102*1212f9a0SAndroid Build Coastguard WorkerNDS 23. DCC: <xsl:value-of select="name(descendant::t2-near-north/descendant-or-self::t2-near-north/descendant-or-self::t2-near-north)"/>
103*1212f9a0SAndroid Build Coastguard WorkerNDS 24. DCE: <xsl:value-of select="name(descendant::t2-near-north/descendant-or-self::t2-near-north/child::t2-far-west)"/>
104*1212f9a0SAndroid Build Coastguard WorkerNDS 25. DDC: <xsl:value-of select="name(descendant::t2-near-north/descendant::t2-far-west/descendant-or-self::t2-far-west)"/>
105*1212f9a0SAndroid Build Coastguard Worker
106*1212f9a0SAndroid Build Coastguard WorkerDS  26. CC: <xsl:value-of select="name(descendant-or-self::node()/descendant-or-self::t2-north)"/>
107*1212f9a0SAndroid Build Coastguard WorkerDS  27. CD: <xsl:value-of select="name(descendant-or-self::node()/descendant::t2-near-north)"/>
108*1212f9a0SAndroid Build Coastguard WorkerDS  28. CE: <xsl:value-of select="name(descendant-or-self::node()/child::t2-near-north)"/>
109*1212f9a0SAndroid Build Coastguard WorkerDS  29. DC: <xsl:value-of select="name(descendant::node()/descendant-or-self::t2-near-north)"/>
110*1212f9a0SAndroid Build Coastguard WorkerDS  30. DD: <xsl:value-of select="name(descendant::node()/descendant::t2-far-west)"/>
111*1212f9a0SAndroid Build Coastguard Worker
112*1212f9a0SAndroid Build Coastguard WorkerDS  31. ACC: <xsl:value-of select="name(/descendant-or-self::node()/descendant-or-self::t2-north)"/>
113*1212f9a0SAndroid Build Coastguard WorkerDS  32. ACE: <xsl:value-of select="name(/descendant-or-self::node()/child::t2-near-north)"/>
114*1212f9a0SAndroid Build Coastguard WorkerDS  33. ADC: <xsl:value-of select="name(/descendant::node()/descendant-or-self::t2-near-north)"/>
115*1212f9a0SAndroid Build Coastguard WorkerDS  34. BCC: <xsl:value-of select="name(self::node()/descendant-or-self::node()/descendant-or-self::t2-north)"/>
116*1212f9a0SAndroid Build Coastguard WorkerDS  35. BCE: <xsl:value-of select="name(self::node()/descendant-or-self::node()/child::t2-near-north)"/>
117*1212f9a0SAndroid Build Coastguard WorkerDS  36. BDC: <xsl:value-of select="name(self::node()/descendant::node()/descendant-or-self::t2-far-west)"/>
118*1212f9a0SAndroid Build Coastguard WorkerDS  37. BDE: <xsl:value-of select="name(self::node()/descendant::node()/child::t2-far-west)"/>
119*1212f9a0SAndroid Build Coastguard WorkerDS  38. CCC: <xsl:value-of select="name(descendant-or-self::node()/descendant-or-self::node()/descendant-or-self::t2-north)"/>
120*1212f9a0SAndroid Build Coastguard WorkerDS  39. CCE: <xsl:value-of select="name(descendant-or-self::node()/descendant-or-self::node()/child::t2-near-north)"/>
121*1212f9a0SAndroid Build Coastguard WorkerDS  40. CDC: <xsl:value-of select="name(descendant-or-self::node()/descendant::node()/descendant-or-self::t2-near-north)"/>
122*1212f9a0SAndroid Build Coastguard WorkerDS  41. CDE: <xsl:value-of select="name(descendant-or-self::node()/descendant::node()/child::t2-far-west)"/>
123*1212f9a0SAndroid Build Coastguard WorkerDS  42. CEC: <xsl:value-of select="name(descendant-or-self::node()/child::node()/descendant-or-self::t2-near-north)"/>
124*1212f9a0SAndroid Build Coastguard WorkerDS  43. CEE: <xsl:value-of select="name(descendant-or-self::node()/child::node()/child::t2-far-west)"/>
125*1212f9a0SAndroid Build Coastguard WorkerDS  44. DCC: <xsl:value-of select="name(descendant::node()/descendant-or-self::node()/descendant-or-self::t2-near-north)"/>
126*1212f9a0SAndroid Build Coastguard WorkerDS  45. DCE: <xsl:value-of select="name(descendant::node()/descendant-or-self::node()/child::t2-far-west)"/>
127*1212f9a0SAndroid Build Coastguard WorkerDS  46. DDC: <xsl:value-of select="name(descendant::node()/descendant::node()/descendant-or-self::t2-far-west)"/>
128*1212f9a0SAndroid Build Coastguard Worker</xsl:template>
129*1212f9a0SAndroid Build Coastguard Worker
130*1212f9a0SAndroid Build Coastguard Worker
131*1212f9a0SAndroid Build Coastguard Worker  <!--
132*1212f9a0SAndroid Build Coastguard Worker   * Licensed to the Apache Software Foundation (ASF) under one
133*1212f9a0SAndroid Build Coastguard Worker   * or more contributor license agreements. See the NOTICE file
134*1212f9a0SAndroid Build Coastguard Worker   * distributed with this work for additional information
135*1212f9a0SAndroid Build Coastguard Worker   * regarding copyright ownership. The ASF licenses this file
136*1212f9a0SAndroid Build Coastguard Worker   * to you under the Apache License, Version 2.0 (the  "License");
137*1212f9a0SAndroid Build Coastguard Worker   * you may not use this file except in compliance with the License.
138*1212f9a0SAndroid Build Coastguard Worker   * You may obtain a copy of the License at
139*1212f9a0SAndroid Build Coastguard Worker   *
140*1212f9a0SAndroid Build Coastguard Worker   *     http://www.apache.org/licenses/LICENSE-2.0
141*1212f9a0SAndroid Build Coastguard Worker   *
142*1212f9a0SAndroid Build Coastguard Worker   * Unless required by applicable law or agreed to in writing, software
143*1212f9a0SAndroid Build Coastguard Worker   * distributed under the License is distributed on an "AS IS" BASIS,
144*1212f9a0SAndroid Build Coastguard Worker   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
145*1212f9a0SAndroid Build Coastguard Worker   * See the License for the specific language governing permissions and
146*1212f9a0SAndroid Build Coastguard Worker   * limitations under the License.
147*1212f9a0SAndroid Build Coastguard Worker  -->
148*1212f9a0SAndroid Build Coastguard Worker
149*1212f9a0SAndroid Build Coastguard Worker</xsl:stylesheet>
150