xref: /aosp_15_r20/external/apache-xml/test/tests/conf/mdocs/mdocs17.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:months="Lookup table for month names"
4                exclude-result-prefixes="months">
5
6  <!-- FileName: MDocs17 -->
7  <!-- Document: http://www.w3.org/TR/xpath -->
8  <!-- DocVersion: 19991116 -->
9  <!-- Section: 12.1 Multiple Source Documents  -->
10  <!-- Creator: Doug Tidwell, adapted by David Marston -->
11  <!-- Purpose: Use document('') to refer to the stylesheet, and have a local lookup table. -->
12
13  <months:name sequence="01">January</months:name>
14  <months:name sequence="02">February</months:name>
15  <months:name sequence="03">March</months:name>
16  <months:name sequence="04">April</months:name>
17  <months:name sequence="05">May</months:name>
18  <months:name sequence="06">June</months:name>
19  <months:name sequence="07">July</months:name>
20  <months:name sequence="08">August</months:name>
21  <months:name sequence="09">September</months:name>
22  <months:name sequence="10">October</months:name>
23  <months:name sequence="11">November</months:name>
24  <months:name sequence="12">December</months:name>
25
26<xsl:output method="xml"/>
27
28<xsl:variable name="newline">
29<xsl:text>
30</xsl:text>
31</xsl:variable>
32
33<xsl:template match="/">
34  <out>
35    <xsl:value-of select="$newline"/>
36    <xsl:for-each select="/report/month">
37      <month>
38        <xsl:value-of select="document('')/xsl:stylesheet/months:name[@sequence=current()/@sequence]"/>
39        <xsl:text> - </xsl:text>
40        <xsl:value-of select="miles-earned"/>
41        <xsl:text> miles earned.</xsl:text>
42      </month>
43      <xsl:value-of select="$newline"/>
44    </xsl:for-each>
45  </out>
46</xsl:template>
47
48
49  <!--
50   * Licensed to the Apache Software Foundation (ASF) under one
51   * or more contributor license agreements. See the NOTICE file
52   * distributed with this work for additional information
53   * regarding copyright ownership. The ASF licenses this file
54   * to you under the Apache License, Version 2.0 (the  "License");
55   * you may not use this file except in compliance with the License.
56   * You may obtain a copy of the License at
57   *
58   *     http://www.apache.org/licenses/LICENSE-2.0
59   *
60   * Unless required by applicable law or agreed to in writing, software
61   * distributed under the License is distributed on an "AS IS" BASIS,
62   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
63   * See the License for the specific language governing permissions and
64   * limitations under the License.
65  -->
66
67</xsl:stylesheet>
68