xref: /aosp_15_r20/external/apache-xml/test/tests/conf/position/position102.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: position102 -->
5  <!-- Document: http://www.w3.org/TR/xslt -->
6  <!-- DocVersion: 19991116 -->
7  <!-- Section: 5.6 -->
8  <!-- Creator: David Marston, from an idea by Kai Ojansuu -->
9  <!-- Purpose: Test position() when template is imported. -->
10
11<xsl:import href="pos102imp.xsl"/>
12
13<xsl:output method="xml" indent="no" encoding="UTF-8"/>
14
15<xsl:template match="doc">
16  <out>
17    <xsl:apply-templates select="a"/>
18    <xsl:apply-templates select="b"/>
19    <xsl:apply-templates select="c"/>
20  </out>
21</xsl:template>
22
23<xsl:template match="a">
24  <xsl:text>
25</xsl:text>
26  <local>
27    <xsl:text>Item </xsl:text>
28    <xsl:value-of select="@mark"/>
29    <xsl:text> is in position </xsl:text>
30    <xsl:value-of select="position()"/>
31  </local>
32</xsl:template>
33
34<xsl:template match="c">
35  <xsl:text>
36</xsl:text>
37  <apply level="main">
38    <xsl:text>Item </xsl:text>
39    <xsl:value-of select="@mark"/>
40    <xsl:text> is in position </xsl:text>
41    <xsl:value-of select="position()"/>
42  </apply>
43  <xsl:apply-imports/>
44</xsl:template>
45
46
47  <!--
48   * Licensed to the Apache Software Foundation (ASF) under one
49   * or more contributor license agreements. See the NOTICE file
50   * distributed with this work for additional information
51   * regarding copyright ownership. The ASF licenses this file
52   * to you under the Apache License, Version 2.0 (the  "License");
53   * you may not use this file except in compliance with the License.
54   * You may obtain a copy of the License at
55   *
56   *     http://www.apache.org/licenses/LICENSE-2.0
57   *
58   * Unless required by applicable law or agreed to in writing, software
59   * distributed under the License is distributed on an "AS IS" BASIS,
60   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
61   * See the License for the specific language governing permissions and
62   * limitations under the License.
63  -->
64
65</xsl:stylesheet>
66