xref: /aosp_15_r20/external/apache-xml/test/tests/extensions/library/libraryNodeset04.xsl (revision 1212f9a0ffdc28482b8821715d2222bf16dc14e2)
1<?xml version="1.0"?>
2<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
3                xmlns:ex="http://xml.apache.org/xalan"
4                extension-element-prefixes="ex">
5
6  <!-- FileName: libraryNodeset04 -->
7  <!-- Document: http://www.w3.org/TR/xslt -->
8  <!-- DocVersion: 19991116 -->
9  <!-- Section: 11.4 -->
10  <!-- Creator: David Marston -->
11  <!-- Purpose: Ensure that traversal of nodeset of global RTF gets the right one. -->
12
13<xsl:output method="xml" indent="no" encoding="UTF-8"/>
14
15<xsl:variable name="top1">
16  <t0>top1-begin
17    <t1>top1-first1</t1>
18    <t2>top1-first2</t2>
19    <t1>top1-second1</t1>
20  </t0>
21</xsl:variable>
22
23<xsl:variable name="top2">
24  <t0>top2-begin
25    <t1>top2-first1</t1>
26    <t2>top2-first2</t2>
27    <t1>top2-second1</t1>
28  </t0>
29</xsl:variable>
30
31<xsl:template match="doc">
32  <out>
33    <!-- First, force evaluation of each variable -->
34    <junk>
35      <xsl:text>$top1 summary: </xsl:text>
36      <xsl:value-of select="$top1"/>
37      <xsl:text>
38</xsl:text>
39      <xsl:text>$top2 summary: </xsl:text>
40      <xsl:value-of select="$top2"/>
41    </junk>
42    <xsl:text>
43</xsl:text>
44    <xsl:text>The preceding::t1 elements in $top2 are </xsl:text>
45    <xsl:for-each select="ex:nodeset($top2)//t2/preceding::t1">
46      <xsl:value-of select="."/>
47      <xsl:text>,</xsl:text>
48    </xsl:for-each>
49  </out>
50</xsl:template>
51
52
53  <!--
54   * Licensed to the Apache Software Foundation (ASF) under one
55   * or more contributor license agreements. See the NOTICE file
56   * distributed with this work for additional information
57   * regarding copyright ownership. The ASF licenses this file
58   * to you under the Apache License, Version 2.0 (the  "License");
59   * you may not use this file except in compliance with the License.
60   * You may obtain a copy of the License at
61   *
62   *     http://www.apache.org/licenses/LICENSE-2.0
63   *
64   * Unless required by applicable law or agreed to in writing, software
65   * distributed under the License is distributed on an "AS IS" BASIS,
66   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
67   * See the License for the specific language governing permissions and
68   * limitations under the License.
69  -->
70
71</xsl:stylesheet>
72