1<?xml version="1.0" encoding="utf-8"?> 2<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 3 version='1.0'> 4 5<!-- Performance-optimized versions of some upstream templates from common/ 6 directory --> 7 8<!-- from common/labels.xsl --> 9 10<xsl:template match="chapter" mode="label.markup"> 11 <xsl:choose> 12 <xsl:when test="@label"> 13 <xsl:value-of select="@label"/> 14 </xsl:when> 15 <xsl:when test="string($chapter.autolabel) != 0"> 16 <xsl:if test="$component.label.includes.part.label != 0 and 17 ancestor::part"> 18 <xsl:variable name="part.label"> 19 <xsl:apply-templates select="ancestor::part" 20 mode="label.markup"/> 21 </xsl:variable> 22 <xsl:if test="$part.label != ''"> 23 <xsl:value-of select="$part.label"/> 24 <xsl:apply-templates select="ancestor::part" 25 mode="intralabel.punctuation"> 26 <xsl:with-param name="object" select="."/> 27 </xsl:apply-templates> 28 </xsl:if> 29 </xsl:if> 30 <xsl:variable name="format"> 31 <xsl:call-template name="autolabel.format"> 32 <xsl:with-param name="format" select="$chapter.autolabel"/> 33 </xsl:call-template> 34 </xsl:variable> 35 <xsl:choose> 36 <xsl:when test="$label.from.part != 0 and ancestor::part"> 37 <xsl:number from="part" count="chapter" format="{$format}" level="any"/> 38 </xsl:when> 39 <xsl:otherwise> 40 <!-- Optimization for pgsql-docs: When counting to get label for 41 this chapter, preceding chapters can only be our siblings or 42 children of a preceding part, so only count those instead of 43 scanning the entire node tree. --> 44 <!-- <xsl:number from="book" count="chapter" format="{$format}" level="any"/> --> 45 <xsl:number value="count(../preceding-sibling::part/chapter) + count(preceding-sibling::chapter) + 1" format="{$format}"/> 46 </xsl:otherwise> 47 </xsl:choose> 48 </xsl:when> 49 </xsl:choose> 50</xsl:template> 51 52<xsl:template match="appendix" mode="label.markup"> 53 <xsl:choose> 54 <xsl:when test="@label"> 55 <xsl:value-of select="@label"/> 56 </xsl:when> 57 <xsl:when test="string($appendix.autolabel) != 0"> 58 <xsl:if test="$component.label.includes.part.label != 0 and 59 ancestor::part"> 60 <xsl:variable name="part.label"> 61 <xsl:apply-templates select="ancestor::part" 62 mode="label.markup"/> 63 </xsl:variable> 64 <xsl:if test="$part.label != ''"> 65 <xsl:value-of select="$part.label"/> 66 <xsl:apply-templates select="ancestor::part" 67 mode="intralabel.punctuation"> 68 <xsl:with-param name="object" select="."/> 69 </xsl:apply-templates> 70 </xsl:if> 71 </xsl:if> 72 <xsl:variable name="format"> 73 <xsl:call-template name="autolabel.format"> 74 <xsl:with-param name="format" select="$appendix.autolabel"/> 75 </xsl:call-template> 76 </xsl:variable> 77 <xsl:choose> 78 <xsl:when test="$label.from.part != 0 and ancestor::part"> 79 <xsl:number from="part" count="appendix" format="{$format}" level="any"/> 80 </xsl:when> 81 <xsl:otherwise> 82 <!-- Optimization for pgsql-docs: When counting to get label for 83 this appendix, preceding appendixes can only be our siblings or 84 children of a preceding part, so only count those instead of 85 scanning the entire node tree. --> 86 <!-- <xsl:number from="book|article" count="appendix" format="{$format}" level="any"/> --> 87 <xsl:number value="count(../preceding-sibling::part/appendix) + count(preceding-sibling::appendix) + 1" format="{$format}"/> 88 </xsl:otherwise> 89 </xsl:choose> 90 </xsl:when> 91 </xsl:choose> 92</xsl:template> 93 94<!-- from common/l10n.xsl --> 95 96<!-- Just hardcode the language for the whole document, to make it faster. --> 97 98<xsl:template name="l10n.language">en</xsl:template> 99 100</xsl:stylesheet> 101