1<?xml version='1.0'?>
2<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3                version='1.0'>
4
5<!-- ********************************************************************
6     $Id$
7     ********************************************************************
8
9     This file is part of the XSL DocBook Stylesheet distribution.
10     See /README or http://nwalsh.com/docbook/xsl/ for copyright
11     and other information.
12
13     ******************************************************************** -->
14
15<!-- ==================================================================== -->
16
17<xsl:template match="reference">
18  <xsl:variable name="id">
19    <xsl:call-template name="object.id"/>
20  </xsl:variable>
21
22  <div class="{name(.)}">
23    <xsl:if test="@id">
24      <a name="{$id}"/>
25    </xsl:if>
26    <xsl:call-template name="reference.titlepage"/>
27    <xsl:if test="not(partintro) and $generate.reference.toc != '0'">
28      <xsl:call-template name="division.toc"/>
29    </xsl:if>
30    <xsl:apply-templates/>
31  </div>
32</xsl:template>
33
34<xsl:template match="reference" mode="division.number">
35  <xsl:number from="book" count="reference" format="I."/>
36</xsl:template>
37
38<xsl:template match="reference/docinfo"></xsl:template>
39<xsl:template match="reference/referenceinfo"></xsl:template>
40<xsl:template match="reference/title"></xsl:template>
41<xsl:template match="reference/subtitle"></xsl:template>
42
43<!-- ==================================================================== -->
44
45<xsl:template match="refentry">
46  <xsl:variable name="refmeta" select=".//refmeta"/>
47  <xsl:variable name="refentrytitle" select="$refmeta//refentrytitle"/>
48  <xsl:variable name="refnamediv" select=".//refnamediv"/>
49  <xsl:variable name="refname" select="$refnamediv//refname"/>
50  <xsl:variable name="title">
51    <xsl:choose>
52      <xsl:when test="$refentrytitle">
53        <xsl:apply-templates select="$refentrytitle[1]" mode="title"/>
54      </xsl:when>
55      <xsl:when test="$refname">
56        <xsl:apply-templates select="$refname[1]" mode="title"/>
57      </xsl:when>
58      <xsl:otherwise></xsl:otherwise>
59    </xsl:choose>
60  </xsl:variable>
61
62  <div class="{name(.)}">
63    <h1 class="title">
64      <a>
65        <xsl:attribute name="name">
66          <xsl:call-template name="object.id"/>
67        </xsl:attribute>
68      </a>
69      <xsl:copy-of select="$title"/>
70    </h1>
71    <xsl:apply-templates/>
72    <xsl:call-template name="process.footnotes"/>
73  </div>
74</xsl:template>
75
76<xsl:template match="refentry/docinfo|refentry/refentryinfo"></xsl:template>
77
78<xsl:template match="refentrytitle|refname" mode="title">
79  <xsl:apply-templates/>
80</xsl:template>
81
82<xsl:template match="refmeta">
83</xsl:template>
84
85<xsl:template match="manvolnum">
86  <xsl:if test="$refentry.xref.manvolnum != 0">
87    <xsl:text>(</xsl:text>
88    <xsl:apply-templates/>
89    <xsl:text>)</xsl:text>
90  </xsl:if>
91</xsl:template>
92
93<xsl:template match="refmiscinfo">
94</xsl:template>
95
96<xsl:template match="refentrytitle">
97  <xsl:call-template name="inline.charseq"/>
98</xsl:template>
99
100<xsl:template match="refnamediv">
101  <xsl:call-template name="block.object"/>
102</xsl:template>
103
104<xsl:template match="refname">
105  <xsl:apply-templates/>
106  <xsl:if test="following-sibling::refname">
107    <xsl:text>, </xsl:text>
108  </xsl:if>
109</xsl:template>
110
111<xsl:template match="refname[1]">
112  <xsl:if test="$refentry.generate.name != 0">
113    <h2>
114      <xsl:call-template name="gentext">
115        <xsl:with-param name="key" select="'RefName'"/>
116      </xsl:call-template>
117    </h2>
118  </xsl:if>
119  <xsl:apply-templates/>
120  <xsl:if test="following-sibling::refname">
121    <xsl:text>, </xsl:text>
122  </xsl:if>
123</xsl:template>
124
125<xsl:template match="refpurpose">
126  <xsl:text> </xsl:text>
127  <xsl:call-template name="dingbat">
128    <xsl:with-param name="dingbat">em-dash</xsl:with-param>
129  </xsl:call-template>
130  <xsl:text> </xsl:text>
131  <xsl:apply-templates/>
132</xsl:template>
133
134<xsl:template match="refdescriptor">
135  <!-- todo: finish this -->
136</xsl:template>
137
138<xsl:template match="refclass">
139  <p>
140    <b>
141      <xsl:if test="@role">
142        <xsl:value-of select="@role"/>
143        <xsl:text>: </xsl:text>
144      </xsl:if>
145      <xsl:apply-templates/>
146    </b>
147  </p>
148</xsl:template>
149
150<xsl:template match="refsynopsisdiv">
151  <div class="{name(.)}">
152    <a>
153      <xsl:attribute name="name">
154        <xsl:call-template name="object.id"/>
155      </xsl:attribute>
156    </a>
157    <h2>Synopsis</h2>
158    <xsl:apply-templates/>
159  </div>
160</xsl:template>
161
162<xsl:template match="refsynopsisdivinfo"></xsl:template>
163
164<xsl:template match="refsynopsisdiv/title">
165</xsl:template>
166
167<xsl:template match="refsect1|refsect2|refsect3">
168  <xsl:call-template name="block.object"/>
169</xsl:template>
170
171<xsl:template match="refsect1/title">
172  <h2>
173    <a>
174      <xsl:attribute name="name">
175        <xsl:call-template name="object.id">
176          <xsl:with-param name="object" select="ancestor::refsect1"/>
177        </xsl:call-template>
178      </xsl:attribute>
179    </a>
180    <xsl:apply-templates/>
181  </h2>
182</xsl:template>
183
184<xsl:template match="refsect2/title">
185  <h3>
186    <a>
187      <xsl:attribute name="name">
188        <xsl:call-template name="object.id">
189          <xsl:with-param name="object" select="ancestor::refsect2"/>
190        </xsl:call-template>
191      </xsl:attribute>
192    </a>
193    <xsl:apply-templates/>
194  </h3>
195</xsl:template>
196
197<xsl:template match="refsect3/title">
198  <h4>
199    <a>
200      <xsl:attribute name="name">
201        <xsl:call-template name="object.id">
202          <xsl:with-param name="object" select="ancestor::refsect3"/>
203        </xsl:call-template>
204      </xsl:attribute>
205    </a>
206    <xsl:apply-templates/>
207  </h4>
208</xsl:template>
209
210<xsl:template match="refsect1info"></xsl:template>
211<xsl:template match="refsect2info"></xsl:template>
212<xsl:template match="refsect3info"></xsl:template>
213
214<!-- ==================================================================== -->
215
216</xsl:stylesheet>
217