xref: /aosp_15_r20/external/apache-xml/test/tests/conf/node/node12.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: node12 -->
5  <!-- Document: http://www.w3.org/TR/xpath -->
6  <!-- DocVersion: 19991116 -->
7  <!-- Section: 2.3 -->
8  <!-- Creator: David Marston -->
9  <!-- Purpose: Test for node tests in select in for-each. -->
10
11<xsl:template match="/doc">
12  <out>
13    <xsl:text>ATTRIBUTES:</xsl:text>
14    <xsl:for-each select="@*">
15      <xsl:text>A-</xsl:text><xsl:value-of select="name()"/>
16    </xsl:for-each>
17    <xsl:text>
18TEXT:</xsl:text>
19    <xsl:for-each select="text()">
20      <xsl:text>T-</xsl:text><xsl:value-of select="."/>
21    </xsl:for-each>
22    <xsl:text>
23COMMENTS:</xsl:text>
24    <xsl:for-each select="comment()">
25      <xsl:text>C-</xsl:text><xsl:value-of select="."/>
26    </xsl:for-each>
27    <xsl:text>
28PIs:</xsl:text>
29    <xsl:for-each select="processing-instruction()">
30      <xsl:text>P-</xsl:text><xsl:value-of select="name()"/>
31    </xsl:for-each>
32    <xsl:text>
33CHILDREN:</xsl:text>
34    <xsl:for-each select="*">
35      <xsl:text>E-</xsl:text><xsl:value-of select="name()"/><xsl:text>
36</xsl:text>
37      <xsl:apply-templates select="@*"/>
38      <xsl:apply-templates/>
39      <xsl:text>--End of child </xsl:text><xsl:value-of select="name()"/><xsl:text>
40</xsl:text>
41    </xsl:for-each>
42  </out>
43</xsl:template>
44
45<xsl:template match="*"><!-- for child elements -->
46  <xsl:text>E:</xsl:text><xsl:value-of select="name()"/>
47  <xsl:apply-templates select="@*"/>
48  <xsl:apply-templates/>
49  <xsl:text>
50</xsl:text>
51</xsl:template>
52
53<xsl:template match="@*">
54  <xsl:text>A:</xsl:text><xsl:value-of select="name()"/>
55</xsl:template>
56
57<xsl:template match="text()">
58  <xsl:text>T:</xsl:text><xsl:value-of select="."/>
59</xsl:template>
60
61<xsl:template match="comment()">
62  <xsl:text>C:</xsl:text><xsl:value-of select="."/>
63</xsl:template>
64
65<xsl:template match="processing-instruction()">
66  <xsl:text>P:</xsl:text><xsl:value-of select="name()"/>
67</xsl:template>
68
69
70  <!--
71   * Licensed to the Apache Software Foundation (ASF) under one
72   * or more contributor license agreements. See the NOTICE file
73   * distributed with this work for additional information
74   * regarding copyright ownership. The ASF licenses this file
75   * to you under the Apache License, Version 2.0 (the  "License");
76   * you may not use this file except in compliance with the License.
77   * You may obtain a copy of the License at
78   *
79   *     http://www.apache.org/licenses/LICENSE-2.0
80   *
81   * Unless required by applicable law or agreed to in writing, software
82   * distributed under the License is distributed on an "AS IS" BASIS,
83   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
84   * See the License for the specific language governing permissions and
85   * limitations under the License.
86  -->
87
88</xsl:stylesheet>
89