| 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: refentry.xsl 6910 2007-06-28 23:23:30Z xmldoc $ |
| 7 |
******************************************************************** |
| 8 |
|
| 9 |
This file is part of the XSL DocBook Stylesheet distribution. |
| 10 |
See ../README or http://docbook.sf.net/release/xsl/current/ for |
| 11 |
copyright and other information. |
| 12 |
|
| 13 |
******************************************************************** --> |
| 14 |
|
| 15 |
<!-- ==================================================================== --> |
| 16 |
|
| 17 |
<xsl:template match="reference"> |
| 18 |
<xsl:call-template name="id.warning"/> |
| 19 |
|
| 20 |
<div> |
| 21 |
<xsl:apply-templates select="." mode="class.attribute"/> |
| 22 |
<xsl:call-template name="dir"> |
| 23 |
<xsl:with-param name="inherit" select="1"/> |
| 24 |
</xsl:call-template> |
| 25 |
<xsl:call-template name="language.attribute"/> |
| 26 |
<xsl:if test="$generate.id.attributes != 0"> |
| 27 |
<xsl:attribute name="id"> |
| 28 |
<xsl:call-template name="object.id"/> |
| 29 |
</xsl:attribute> |
| 30 |
</xsl:if> |
| 31 |
|
| 32 |
<xsl:call-template name="reference.titlepage"/> |
| 33 |
|
| 34 |
<xsl:variable name="toc.params"> |
| 35 |
<xsl:call-template name="find.path.params"> |
| 36 |
<xsl:with-param name="table" select="normalize-space($generate.toc)"/> |
| 37 |
</xsl:call-template> |
| 38 |
</xsl:variable> |
| 39 |
|
| 40 |
<xsl:if test="not(partintro) and contains($toc.params, 'toc')"> |
| 41 |
<xsl:call-template name="division.toc"/> |
| 42 |
</xsl:if> |
| 43 |
<xsl:apply-templates/> |
| 44 |
</div> |
| 45 |
</xsl:template> |
| 46 |
|
| 47 |
<xsl:template match="reference" mode="division.number"> |
| 48 |
<xsl:number from="book" count="reference" format="I."/> |
| 49 |
</xsl:template> |
| 50 |
|
| 51 |
<xsl:template match="reference/docinfo"></xsl:template> |
| 52 |
<xsl:template match="reference/referenceinfo"></xsl:template> |
| 53 |
<xsl:template match="reference/title"></xsl:template> |
| 54 |
<xsl:template match="reference/subtitle"></xsl:template> |
| 55 |
<xsl:template match="reference/titleabbrev"></xsl:template> |
| 56 |
|
| 57 |
<!-- ==================================================================== --> |
| 58 |
|
| 59 |
<xsl:template name="refentry.title"> |
| 60 |
<xsl:param name="node" select="."/> |
| 61 |
<xsl:variable name="refmeta" select="$node//refmeta"/> |
| 62 |
<xsl:variable name="refentrytitle" select="$refmeta//refentrytitle"/> |
| 63 |
<xsl:variable name="refnamediv" select="$node//refnamediv"/> |
| 64 |
<xsl:variable name="refname" select="$refnamediv//refname"/> |
| 65 |
<xsl:variable name="refdesc" select="$refnamediv//refdescriptor"/> |
| 66 |
<xsl:variable name="title"> |
| 67 |
<xsl:choose> |
| 68 |
<xsl:when test="$refentrytitle"> |
| 69 |
<xsl:apply-templates select="$refentrytitle[1]" mode="title"/> |
| 70 |
</xsl:when> |
| 71 |
<xsl:when test="$refdesc"> |
| 72 |
<xsl:apply-templates select="$refdesc[1]" mode="title"/> |
| 73 |
</xsl:when> |
| 74 |
<xsl:when test="$refname"> |
| 75 |
<xsl:apply-templates select="$refname[1]" mode="title"/> |
| 76 |
</xsl:when> |
| 77 |
<xsl:otherwise></xsl:otherwise> |
| 78 |
</xsl:choose> |
| 79 |
</xsl:variable> |
| 80 |
|
| 81 |
<h1 class="title"> |
| 82 |
<xsl:copy-of select="$title"/> |
| 83 |
</h1> |
| 84 |
</xsl:template> |
| 85 |
|
| 86 |
<xsl:template match="refentry"> |
| 87 |
<xsl:call-template name="id.warning"/> |
| 88 |
|
| 89 |
<div> |
| 90 |
<xsl:apply-templates select="." mode="class.attribute"/> |
| 91 |
<xsl:call-template name="dir"> |
| 92 |
<xsl:with-param name="inherit" select="1"/> |
| 93 |
</xsl:call-template> |
| 94 |
<xsl:call-template name="language.attribute"/> |
| 95 |
<xsl:if test="$refentry.separator != 0 and preceding-sibling::refentry"> |
| 96 |
<div class="refentry.separator"> |
| 97 |
<hr/> |
| 98 |
</div> |
| 99 |
</xsl:if> |
| 100 |
<xsl:call-template name="anchor"> |
| 101 |
<xsl:with-param name="conditional" select="0"/> |
| 102 |
</xsl:call-template> |
| 103 |
<xsl:call-template name="refentry.titlepage"/> |
| 104 |
<xsl:apply-templates/> |
| 105 |
<xsl:call-template name="process.footnotes"/> |
| 106 |
</div> |
| 107 |
</xsl:template> |
| 108 |
|
| 109 |
<xsl:template match="refentry/docinfo|refentry/refentryinfo"></xsl:template> |
| 110 |
<xsl:template match="refentry/info"></xsl:template> |
| 111 |
|
| 112 |
<xsl:template match="refentrytitle|refname|refdescriptor" mode="title"> |
| 113 |
<xsl:apply-templates/> |
| 114 |
</xsl:template> |
| 115 |
|
| 116 |
<xsl:template match="refmeta"> |
| 117 |
</xsl:template> |
| 118 |
|
| 119 |
<xsl:template match="manvolnum"> |
| 120 |
<xsl:if test="$refentry.xref.manvolnum != 0"> |
| 121 |
<xsl:text>(</xsl:text> |
| 122 |
<xsl:apply-templates/> |
| 123 |
<xsl:text>)</xsl:text> |
| 124 |
</xsl:if> |
| 125 |
</xsl:template> |
| 126 |
|
| 127 |
<xsl:template match="refmiscinfo"> |
| 128 |
</xsl:template> |
| 129 |
|
| 130 |
<xsl:template match="refentrytitle"> |
| 131 |
<xsl:call-template name="inline.charseq"/> |
| 132 |
</xsl:template> |
| 133 |
|
| 134 |
<xsl:template match="refnamediv"> |
| 135 |
<div> |
| 136 |
<xsl:apply-templates select="." mode="class.attribute"/> |
| 137 |
<xsl:call-template name="dir"> |
| 138 |
<xsl:with-param name="inherit" select="1"/> |
| 139 |
</xsl:call-template> |
| 140 |
<xsl:call-template name="anchor"/> |
| 141 |
|
| 142 |
<xsl:choose> |
| 143 |
<xsl:when test="preceding-sibling::refnamediv"> |
| 144 |
<!-- no title on secondary refnamedivs! --> |
| 145 |
</xsl:when> |
| 146 |
<xsl:when test="$refentry.generate.name != 0"> |
| 147 |
<h2> |
| 148 |
<xsl:call-template name="gentext"> |
| 149 |
<xsl:with-param name="key" select="'RefName'"/> |
| 150 |
</xsl:call-template> |
| 151 |
</h2> |
| 152 |
</xsl:when> |
| 153 |
<xsl:when test="$refentry.generate.title != 0"> |
| 154 |
<h2> |
| 155 |
<xsl:choose> |
| 156 |
<xsl:when test="../refmeta/refentrytitle"> |
| 157 |
<xsl:apply-templates select="../refmeta/refentrytitle"/> |
| 158 |
</xsl:when> |
| 159 |
<xsl:otherwise> |
| 160 |
<xsl:apply-templates select="refname[1]"/> |
| 161 |
</xsl:otherwise> |
| 162 |
</xsl:choose> |
| 163 |
</h2> |
| 164 |
</xsl:when> |
| 165 |
</xsl:choose> |
| 166 |
|
| 167 |
<p> |
| 168 |
<xsl:apply-templates/> |
| 169 |
</p> |
| 170 |
</div> |
| 171 |
</xsl:template> |
| 172 |
|
| 173 |
<xsl:template match="refname"> |
| 174 |
<xsl:if test="not(preceding-sibling::refdescriptor)"> |
| 175 |
<xsl:apply-templates/> |
| 176 |
<xsl:if test="following-sibling::refname"> |
| 177 |
<xsl:text>, </xsl:text> |
| 178 |
</xsl:if> |
| 179 |
</xsl:if> |
| 180 |
</xsl:template> |
| 181 |
|
| 182 |
<xsl:template match="refpurpose"> |
| 183 |
<xsl:if test="node()"> |
| 184 |
<xsl:text> </xsl:text> |
| 185 |
<xsl:call-template name="dingbat"> |
| 186 |
<xsl:with-param name="dingbat">em-dash</xsl:with-param> |
| 187 |
</xsl:call-template> |
| 188 |
<xsl:text> </xsl:text> |
| 189 |
<xsl:apply-templates/> |
| 190 |
</xsl:if> |
| 191 |
</xsl:template> |
| 192 |
|
| 193 |
<xsl:template match="refdescriptor"> |
| 194 |
<xsl:apply-templates/> |
| 195 |
</xsl:template> |
| 196 |
|
| 197 |
<xsl:template match="refclass"> |
| 198 |
<xsl:if test="$refclass.suppress = 0"> |
| 199 |
<p> |
| 200 |
<b> |
| 201 |
<xsl:if test="@role"> |
| 202 |
<xsl:value-of select="@role"/> |
| 203 |
<xsl:text>: </xsl:text> |
| 204 |
</xsl:if> |
| 205 |
<xsl:apply-templates/> |
| 206 |
</b> |
| 207 |
</p> |
| 208 |
</xsl:if> |
| 209 |
</xsl:template> |
| 210 |
|
| 211 |
<xsl:template match="refsynopsisdiv"> |
| 212 |
<div> |
| 213 |
<xsl:apply-templates select="." mode="class.attribute"/> |
| 214 |
<xsl:call-template name="dir"> |
| 215 |
<xsl:with-param name="inherit" select="1"/> |
| 216 |
</xsl:call-template> |
| 217 |
<xsl:call-template name="anchor"/> |
| 218 |
<h2> |
| 219 |
<xsl:choose> |
| 220 |
<xsl:when test="refsynopsisdiv/title|title"> |
| 221 |
<xsl:apply-templates select="(refsynopsisdiv/title|title)[1]" |
| 222 |
mode="titlepage.mode"/> |
| 223 |
</xsl:when> |
| 224 |
<xsl:otherwise> |
| 225 |
<xsl:call-template name="gentext"> |
| 226 |
<xsl:with-param name="key" select="'RefSynopsisDiv'"/> |
| 227 |
</xsl:call-template> |
| 228 |
</xsl:otherwise> |
| 229 |
</xsl:choose> |
| 230 |
</h2> |
| 231 |
<xsl:apply-templates/> |
| 232 |
</div> |
| 233 |
</xsl:template> |
| 234 |
|
| 235 |
<xsl:template match="refsynopsisdivinfo"></xsl:template> |
| 236 |
|
| 237 |
<xsl:template match="refsynopsisdiv/title"> |
| 238 |
</xsl:template> |
| 239 |
|
| 240 |
<xsl:template match="refsynopsisdiv/title" mode="titlepage.mode"> |
| 241 |
<xsl:apply-templates/> |
| 242 |
</xsl:template> |
| 243 |
|
| 244 |
<xsl:template match="refsection|refsect1|refsect2|refsect3"> |
| 245 |
<div> |
| 246 |
<xsl:apply-templates select="." mode="class.attribute"/> |
| 247 |
<xsl:call-template name="dir"> |
| 248 |
<xsl:with-param name="inherit" select="1"/> |
| 249 |
</xsl:call-template> |
| 250 |
<xsl:call-template name="language.attribute"/> |
| 251 |
<xsl:call-template name="anchor"> |
| 252 |
<xsl:with-param name="conditional" select="0"/> |
| 253 |
</xsl:call-template> |
| 254 |
<!-- pick up info title --> |
| 255 |
<xsl:apply-templates select="(title|info/title)[1]"/> |
| 256 |
<xsl:apply-templates select="node()[not(self::title) and not(self::info)]"/> |
| 257 |
</div> |
| 258 |
</xsl:template> |
| 259 |
|
| 260 |
<xsl:template match="refsection/title|refsection/info/title"> |
| 261 |
<!-- the ID is output in the block.object call for refsect1 --> |
| 262 |
<xsl:variable name="level" select="count(ancestor-or-self::refsection)"/> |
| 263 |
<xsl:variable name="refsynopsisdiv"> |
| 264 |
<xsl:text>0</xsl:text> |
| 265 |
<xsl:if test="ancestor::refsynopsisdiv">1</xsl:if> |
| 266 |
</xsl:variable> |
| 267 |
<xsl:variable name="hlevel"> |
| 268 |
<xsl:choose> |
| 269 |
<xsl:when test="$level+$refsynopsisdiv > 5">6</xsl:when> |
| 270 |
<xsl:otherwise> |
| 271 |
<xsl:value-of select="$level+1+$refsynopsisdiv"/> |
| 272 |
</xsl:otherwise> |
| 273 |
</xsl:choose> |
| 274 |
</xsl:variable> |
| 275 |
<xsl:element name="h{$hlevel}"> |
| 276 |
<xsl:apply-templates/> |
| 277 |
</xsl:element> |
| 278 |
</xsl:template> |
| 279 |
|
| 280 |
<xsl:template match="refsect1/title|refsect1/info/title"> |
| 281 |
<!-- the ID is output in the block.object call for refsect1 --> |
| 282 |
<h2> |
| 283 |
<xsl:apply-templates/> |
| 284 |
</h2> |
| 285 |
</xsl:template> |
| 286 |
|
| 287 |
<xsl:template match="refsect2/title|refsect2/info/title"> |
| 288 |
<!-- the ID is output in the block.object call for refsect2 --> |
| 289 |
<h3> |
| 290 |
<xsl:apply-templates/> |
| 291 |
</h3> |
| 292 |
</xsl:template> |
| 293 |
|
| 294 |
<xsl:template match="refsect3/title|refsect3/info/title"> |
| 295 |
<!-- the ID is output in the block.object call for refsect3 --> |
| 296 |
<h4> |
| 297 |
<xsl:apply-templates/> |
| 298 |
</h4> |
| 299 |
</xsl:template> |
| 300 |
|
| 301 |
<xsl:template match="refsectioninfo|refsection/info"></xsl:template> |
| 302 |
<xsl:template match="refsect1info|refsect1/info"></xsl:template> |
| 303 |
<xsl:template match="refsect2info|refsect2/info"></xsl:template> |
| 304 |
<xsl:template match="refsect3info|refsect3/info"></xsl:template> |
| 305 |
|
| 306 |
|
| 307 |
<!-- ==================================================================== --> |
| 308 |
|
| 309 |
</xsl:stylesheet> |