1<?xml version="1.0"?> 2<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> 3 4 <!-- FileName: generated01 --> 5 <!-- Document: http://www.w3.org/TR/xslt --> 6 <!-- DocVersion: 19991116 --> 7 <!-- Section: 12.2 --> 8 <!-- Purpose: Build links using keys and generate-id(). --> 9 10<xsl:output method="html" indent="yes"/> 11 12<xsl:key name="titles" match="div" use="title"/> 13<xsl:key name="id" match="@id" use="@id"/> 14 15<xsl:template match="doc"> 16 <HTML><P>Reference numbers should match the titles, links should work.</P> 17 <xsl:for-each select="div"> 18 <HR/> 19 <H1 id="{generate-id(.)}"> 20 <xsl:number level="multiple" count="div" format="1.1. "/> 21 <xsl:value-of select="title"/></H1> 22 <xsl:apply-templates/> 23 </xsl:for-each> 24 </HTML> 25</xsl:template> 26 27<xsl:template match="p"> 28 <P><xsl:apply-templates/></P> 29</xsl:template> 30 31<xsl:template match="divref"> 32 <A href="#{generate-id(key('titles', .))}"> 33 <xsl:for-each select="key('titles', .)"> 34 <xsl:number level="multiple" count="div" format="1.1. "/> 35 </xsl:for-each> 36 <xsl:value-of select="."/> 37 </A> 38</xsl:template> 39 40 41 <!-- 42 * Licensed to the Apache Software Foundation (ASF) under one 43 * or more contributor license agreements. See the NOTICE file 44 * distributed with this work for additional information 45 * regarding copyright ownership. The ASF licenses this file 46 * to you under the Apache License, Version 2.0 (the "License"); 47 * you may not use this file except in compliance with the License. 48 * You may obtain a copy of the License at 49 * 50 * http://www.apache.org/licenses/LICENSE-2.0 51 * 52 * Unless required by applicable law or agreed to in writing, software 53 * distributed under the License is distributed on an "AS IS" BASIS, 54 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 55 * See the License for the specific language governing permissions and 56 * limitations under the License. 57 --> 58 59</xsl:stylesheet> 60