xref: /aosp_15_r20/external/apache-xml/test/tests/extensions/library/libraryNodeset02.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: libraryNodeset02 -->
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 local RTF gets the right one. -->
12
13<xsl:output method="xml" indent="no" encoding="UTF-8"/>
14
15<xsl:template match="doc">
16  <!-- Define a couple variables -->
17  <xsl:variable name="var1">
18    <t0>var1-begin
19      <t1>var1-first1</t1>
20      <t2>var1-first2</t2>
21      <t1>var1-second1</t1>
22    </t0>
23  </xsl:variable>
24  <xsl:variable name="var2">
25    <t0>var2-begin
26      <t1>var2-first1</t1>
27      <t2>var2-first2</t2>
28      <t1>var2-second1</t1>
29    </t0>
30  </xsl:variable>
31
32  <out>
33    <!-- Now, force evaluation of each of the above variables -->
34    <junk>
35      <xsl:text>$var1 summary: </xsl:text>
36      <xsl:value-of select="$var1"/>
37      <xsl:text>
38</xsl:text>
39      <xsl:text>$var2 summary: </xsl:text>
40      <xsl:value-of select="$var2"/>
41    </junk>
42    <xsl:text>
43</xsl:text>
44    <xsl:text>The preceding::t1 elements in $var2 are </xsl:text>
45    <xsl:for-each select="ex:nodeset($var2)//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