xref: /aosp_15_r20/external/apache-xml/test/tests/conf/position/position70.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: position70 -->
5  <!-- Document: http://www.w3.org/TR/xslt -->
6  <!-- DocVersion: 19991116 -->
7  <!-- Section: 5.4 -->
8  <!-- Creator: David Marston -->
9  <!-- Purpose: Test that set of nodes changes when strip-space is in effect. -->
10  <!-- "The xsl:apply-templates instruction processes all children of the current node,
11        including text nodes. However, text nodes that have been stripped as specified
12        in 3.4 Whitespace Stripping will not be processed." -->
13
14<xsl:strip-space elements="doc inner inner2"/>
15
16<xsl:template match="/doc">
17  <out>
18    <xsl:apply-templates select="*|@*|comment()|text()"/>
19  </out>
20</xsl:template>
21
22<xsl:template match="*"><!-- for child elements -->
23  <xsl:text>E(</xsl:text>
24  <xsl:value-of select="position()"/>
25  <xsl:text>):</xsl:text>
26  <xsl:value-of select="name()"/>
27  <xsl:apply-templates select="@*"/>
28  <xsl:apply-templates/>
29  <xsl:text>
30</xsl:text>
31</xsl:template>
32
33<xsl:template match="@*">
34  <!-- The parser has freedom to present attributes in any order it wants.
35     Input file should have only one attribute if you want consistent results across parsers. -->
36  <xsl:text>A(</xsl:text>
37  <xsl:value-of select="position()"/>
38  <xsl:text>):</xsl:text>
39  <xsl:value-of select="name()"/>
40</xsl:template>
41
42<xsl:template match="text()">
43  <xsl:text>T(</xsl:text>
44  <xsl:value-of select="position()"/>
45  <xsl:text>):</xsl:text>
46  <xsl:value-of select="."/>
47</xsl:template>
48
49<xsl:template match="comment()">
50  <xsl:text>C(</xsl:text>
51  <xsl:value-of select="position()"/>
52  <xsl:text>):</xsl:text>
53  <xsl:value-of select="."/>
54</xsl:template>
55
56
57  <!--
58   * Licensed to the Apache Software Foundation (ASF) under one
59   * or more contributor license agreements. See the NOTICE file
60   * distributed with this work for additional information
61   * regarding copyright ownership. The ASF licenses this file
62   * to you under the Apache License, Version 2.0 (the  "License");
63   * you may not use this file except in compliance with the License.
64   * You may obtain a copy of the License at
65   *
66   *     http://www.apache.org/licenses/LICENSE-2.0
67   *
68   * Unless required by applicable law or agreed to in writing, software
69   * distributed under the License is distributed on an "AS IS" BASIS,
70   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
71   * See the License for the specific language governing permissions and
72   * limitations under the License.
73  -->
74
75</xsl:stylesheet>
76