aboutsummaryrefslogtreecommitdiffstats
path: root/stylesheets/xhtml/lfs-titles.xsl
blob: be65a93ce42250633a8c09c84c1a55547a0a4f17 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
<?xml version='1.0' encoding='ISO-8859-1'?>

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                xmlns="http://www.w3.org/1999/xhtml"
                version="1.0">

  <xsl:template name="part.titlepage">
    <div class="titlepage">
      <h1 class="{name(.)}">
        <xsl:apply-templates select="." mode="label.markup"/>
        <xsl:text>. </xsl:text>
        <xsl:value-of select="title"/>
      </h1>
    </div>
  </xsl:template>

  <xsl:template name="chapter.titlepage">
    <div class="titlepage">
      <h1 class="{name(.)}">
        <xsl:apply-templates select="." mode="label.markup"/>
        <xsl:text>. </xsl:text>
        <xsl:value-of select="title"/>
      </h1>
    </div>
  </xsl:template>

  <xsl:template name="preface.titlepage">
    <div class="titlepage">
      <h1 class="{name(.)}">
        <xsl:value-of select="title"/>
      </h1>
    </div>
  </xsl:template>

  <xsl:template name="appendix.titlepage">
    <div class="titlepage">
      <h1 class="{name(.)}">
        <xsl:apply-templates select="." mode="label.markup"/>
        <xsl:text>. </xsl:text>
        <xsl:value-of select="title"/>
      </h1>
    </div>
  </xsl:template>

  <xsl:template name="sect1.titlepage">
    <xsl:choose>
        <!-- I should find a better test -->
      <xsl:when test="position() = 4">
        <div class="titlepage">
          <xsl:if test="@id">
            <a id="{@id}" name="{@id}"/>
          </xsl:if>
          <h2 class="{name(.)}">
            <xsl:apply-templates select="." mode="label.markup"/>
            <xsl:text>. </xsl:text>
            <xsl:value-of select="title"/>
          </h2>
        </div>
      </xsl:when>
      <xsl:otherwise>
        <div class="titlepage">
          <h1 class="{name(.)}">
            <xsl:apply-templates select="." mode="label.markup"/>
            <xsl:text>. </xsl:text>
            <xsl:value-of select="title"/>
          </h1>
        </div>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <xsl:template name="sect2.titlepage">
    <xsl:choose>
      <xsl:when test="string-length(title) = 0"/>
      <xsl:otherwise>
        <div class="titlepage">
          <xsl:if test="@id">
            <a id="{@id}" name="{@id}"/>
          </xsl:if>
          <h2 class="{name(.)}">
            <xsl:apply-templates select="." mode="label.markup"/>
            <xsl:text>. </xsl:text>
            <xsl:value-of select="title"/>
          </h2>
        </div>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <xsl:template name="dedication.titlepage">
    <div class="titlepage">
      <h2 class="{name(.)}">
        <xsl:value-of select="title"/>
      </h2>
    </div>
  </xsl:template>

    <!-- Added the role param for proper punctuation in xref calls. -->
  <xsl:template match="*" mode="insert.title.markup">
    <xsl:param name="purpose"/>
    <xsl:param name="xrefstyle"/>
    <xsl:param name="title"/>
    <xsl:param name="role"/>
    <xsl:choose>
      <xsl:when test="$purpose = 'xref' and titleabbrev">
        <xsl:apply-templates select="." mode="titleabbrev.markup"/>
      </xsl:when>
      <xsl:otherwise>
        <xsl:copy-of select="$title"/>
        <xsl:value-of select="$role"/>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

</xsl:stylesheet>