source: stylesheets/pdf/lfs-sections.xsl@ 40c1b5b

Last change on this file since 40c1b5b was bf8c11f, checked in by Jim Gifford <clfs@…>, 19 years ago

r627@server (orig r625): jim | 2005-10-31 12:59:34 -0800
Import of Cross-LFS Book

  • Property mode set to 100644
File size: 3.6 KB
RevLine 
[bf8c11f]1<?xml version='1.0' encoding='ISO-8859-1'?>
2
3<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
4 xmlns:fo="http://www.w3.org/1999/XSL/Format"
5 version="1.0">
6
7 <!-- Force section1's onto a new page -->
8 <xsl:attribute-set name="section.level1.properties">
9 <xsl:attribute name="break-after">
10 <xsl:choose>
11 <xsl:when test="not(position()=last())">
12 <xsl:text>page</xsl:text>
13 </xsl:when>
14 <xsl:otherwise>
15 <xsl:text>auto</xsl:text>
16 </xsl:otherwise>
17 </xsl:choose>
18 </xsl:attribute>
19 </xsl:attribute-set>
20
21 <!-- Sections numbering -->
22 <xsl:param name="section.autolabel" select="1"/>
23 <xsl:param name="section.label.includes.component.label" select="1"/>
24
25 <!-- Skip numeraration for sections with empty title -->
26 <xsl:template match="sect2|sect3|sect4|sect5" mode="label.markup">
27 <xsl:if test="string-length(title) > 0">
28 <!-- label the parent -->
29 <xsl:variable name="parent.label">
30 <xsl:apply-templates select=".." mode="label.markup"/>
31 </xsl:variable>
32 <xsl:if test="$parent.label != ''">
33 <xsl:apply-templates select=".." mode="label.markup"/>
34 <xsl:apply-templates select=".." mode="intralabel.punctuation"/>
35 </xsl:if>
36 <xsl:choose>
37 <xsl:when test="@label">
38 <xsl:value-of select="@label"/>
39 </xsl:when>
40 <xsl:when test="$section.autolabel != 0">
41 <xsl:choose>
42 <xsl:when test="local-name(.) = 'sect2'">
43 <xsl:choose>
44 <!-- If the first sect2 isn't numbered, renumber the remainig sections -->
45 <xsl:when test="string-length(../sect2[1]/title) = 0">
46 <xsl:variable name="totalsect2">
47 <xsl:number count="sect2"/>
48 </xsl:variable>
49 <xsl:number value="$totalsect2 - 1"/>
50 </xsl:when>
51 <xsl:otherwise>
52 <xsl:number count="sect2"/>
53 </xsl:otherwise>
54 </xsl:choose>
55 </xsl:when>
56 <xsl:when test="local-name(.) = 'sect3'">
57 <xsl:number count="sect3"/>
58 </xsl:when>
59 <xsl:when test="local-name(.) = 'sect4'">
60 <xsl:number count="sect4"/>
61 </xsl:when>
62 <xsl:when test="local-name(.) = 'sect5'">
63 <xsl:number count="sect5"/>
64 </xsl:when>
65 <xsl:otherwise>
66 <xsl:message>label.markup: this can't happen!</xsl:message>
67 </xsl:otherwise>
68 </xsl:choose>
69 </xsl:when>
70 </xsl:choose>
71 </xsl:if>
72 </xsl:template>
73
74 <!-- Drop the trailing punctuation if title is empty -->
75 <xsl:template match="section|sect1|sect2|sect3|sect4|sect5|simplesect
76 |bridgehead"
77 mode="object.title.template">
78 <xsl:choose>
79 <xsl:when test="$section.autolabel != 0">
80 <xsl:if test="string-length(title) > 0">
81 <xsl:call-template name="gentext.template">
82 <xsl:with-param name="context" select="'title-numbered'"/>
83 <xsl:with-param name="name">
84 <xsl:call-template name="xpath.location"/>
85 </xsl:with-param>
86 </xsl:call-template>
87 </xsl:if>
88 </xsl:when>
89 <xsl:otherwise>
90 <xsl:call-template name="gentext.template">
91 <xsl:with-param name="context" select="'title-unnumbered'"/>
92 <xsl:with-param name="name">
93 <xsl:call-template name="xpath.location"/>
94 </xsl:with-param>
95 </xsl:call-template>
96 </xsl:otherwise>
97 </xsl:choose>
98 </xsl:template>
99
100</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.