xref: /aosp_15_r20/external/apache-xml/test/tests/conferr/idkeyerr/idkeyerr13.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: idkeyerr13 -->
5  <!-- Document: http://www.w3.org/TR/xslt -->
6  <!-- DocVersion: 19991116 -->
7  <!-- Section: 12.2 -->
8  <!-- Creator: David Marston -->
9  <!-- Purpose: Test for two xsl:key declarations with the same name attribute. -->
10  <!-- The spec allows this. If the processor implements the feature, then 'titles' is
11     one keyspace where the two types of 'use' nodes index their designated match nodes,
12     but don't cross-index the others as would happen if | notation was used in one xsl:key. -->
13
14<xsl:output indent="yes"/>
15
16<xsl:key name="titles" match="div" use="title"/>
17<xsl:key name="titles" match="@id" use="@id"/>
18
19<xsl:template match="doc">
20  <P>Reference numbers should match the titles, links should work.</P>
21  <xsl:for-each select="div">
22    <HR/>
23    <H1 id="{generate-id(.)}">
24      <xsl:number level="multiple" count="div" format="1.1. "/>
25      <xsl:value-of select="title"/></H1>
26    <xsl:apply-templates/>
27  </xsl:for-each>
28</xsl:template>
29
30<xsl:template match="p">
31  <P><xsl:apply-templates/></P>
32</xsl:template>
33
34<xsl:template match="divref">
35  <A href="#{generate-id(key('titles', .))}">
36    <xsl:for-each select="key('titles', .)">
37      <xsl:number level="multiple" count="div" format="1.1. "/>
38    </xsl:for-each>
39    <xsl:value-of select="."/>
40  </A>
41</xsl:template>
42
43
44  <!--
45   * Licensed to the Apache Software Foundation (ASF) under one
46   * or more contributor license agreements. See the NOTICE file
47   * distributed with this work for additional information
48   * regarding copyright ownership. The ASF licenses this file
49   * to you under the Apache License, Version 2.0 (the  "License");
50   * you may not use this file except in compliance with the License.
51   * You may obtain a copy of the License at
52   *
53   *     http://www.apache.org/licenses/LICENSE-2.0
54   *
55   * Unless required by applicable law or agreed to in writing, software
56   * distributed under the License is distributed on an "AS IS" BASIS,
57   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
58   * See the License for the specific language governing permissions and
59   * limitations under the License.
60  -->
61
62</xsl:stylesheet>
63