xref: /aosp_15_r20/external/apache-xml/test/tests/conf/numbering/numbering25.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  <!-- CaseName: numbering25 -->
5  <!-- Author: David Marston -->
6  <!-- Purpose: Number without value= inside template called within sorted for-each. -->
7  <!-- SpecCitation: Rec="XSLT" Version="1.0" type="OASISptr1" place="id(number)/ulist[2]/item[1]/p[1]/text()[5]" -->
8  <!-- SpecCitation: Rec="XSLT" Version="1.0" type="OASISptr1" place="id(number)/ulist[1]/item[3]/p[1]/text()[1]" -->
9  <!-- SpecCitation: Rec="XSLT" Version="1.0" type="OASISptr1" place="id(number)/p[2]/text()[3]" -->
10  <!-- SpecCitation: Rec="XSLT" Version="1.0" type="OASISptr1" place="id(convert)/p[2]/text()[5]" -->
11  <!-- SpecCitation: Rec="XSLT" Version="1.0" type="OASISptr1" place="id(convert)/ulist[1]/item[1]/p[1]/text()[1]" -->
12  <!-- SpecCitation: Rec="XSLT" Version="1.0" type="DocFrag" place="id(for-each)" -->
13  <!-- SpecCitation: Rec="XSLT" Version="1.0" type="DocFrag" place="id(sorting)" -->
14  <!-- Scenario: operation="standard-XML" -->
15  <!-- Elaboration: Numbering inside different template is still based on position
16     of each node in the source tree, if there is no value attribute in xsl:number. -->
17
18<xsl:template match="/">
19  <out>
20    <xsl:apply-templates/>
21  </out>
22</xsl:template>
23
24<xsl:template match="doc/chapter">
25  <list>
26    <xsl:text>&#10;</xsl:text>
27    <xsl:for-each select="note">
28      <xsl:sort data-type="text" order="descending"/>
29      <xsl:apply-templates select="." mode="numbering"/>
30    </xsl:for-each>
31  </list>
32</xsl:template>
33
34<xsl:template match="note" mode="numbering">
35  <xsl:number level="single" from="chapter" format="(1) "/><xsl:value-of select="."/>
36  <xsl:text>&#10;</xsl:text>
37</xsl:template>
38
39
40  <!--
41   * Licensed to the Apache Software Foundation (ASF) under one
42   * or more contributor license agreements. See the NOTICE file
43   * distributed with this work for additional information
44   * regarding copyright ownership. The ASF licenses this file
45   * to you under the Apache License, Version 2.0 (the  "License");
46   * you may not use this file except in compliance with the License.
47   * You may obtain a copy of the License at
48   *
49   *     http://www.apache.org/licenses/LICENSE-2.0
50   *
51   * Unless required by applicable law or agreed to in writing, software
52   * distributed under the License is distributed on an "AS IS" BASIS,
53   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
54   * See the License for the specific language governing permissions and
55   * limitations under the License.
56  -->
57
58</xsl:stylesheet>
59