xhtml-profile-docbook.xsl 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408
  1. <?xml version="1.0" encoding="ASCII"?>
  2. <!--This file was created automatically by html2xhtml-->
  3. <!--from the HTML stylesheets.-->
  4. <!--This file was created automatically by xsl2profile-->
  5. <!--from the DocBook XSL stylesheets.-->
  6. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ng="http://docbook.org/docbook-ng" xmlns:db="http://docbook.org/ns/docbook" xmlns:exsl="http://exslt.org/common" xmlns:exslt="http://exslt.org/common" xmlns="http://www.w3.org/1999/xhtml" exslt:dummy="dummy" ng:dummy="dummy" db:dummy="dummy" extension-element-prefixes="exslt" exclude-result-prefixes="db ng exsl exslt exslt" version="1.0">
  7. <xsl:output method="xml" encoding="UTF-8" indent="no"/>
  8. <!-- ********************************************************************
  9. $Id: xhtml-profile-docbook.xsl,v 1.1 2011-09-16 21:44:00 bobs Exp $
  10. ********************************************************************
  11. This file is part of the XSL DocBook Stylesheet distribution.
  12. See ../README or http://docbook.sf.net/release/xsl/current/ for
  13. copyright and other information.
  14. ******************************************************************** -->
  15. <!-- ==================================================================== -->
  16. <xsl:include href="../VERSION.xsl"/>
  17. <xsl:include href="../xhtml/param.xsl"/>
  18. <xsl:include href="../lib/lib.xsl"/>
  19. <xsl:include href="../common/l10n.xsl"/>
  20. <xsl:include href="../common/common.xsl"/>
  21. <xsl:include href="../common/utility.xsl"/>
  22. <xsl:include href="../common/labels.xsl"/>
  23. <xsl:include href="../common/titles.xsl"/>
  24. <xsl:include href="../common/subtitles.xsl"/>
  25. <xsl:include href="../common/gentext.xsl"/>
  26. <xsl:include href="../common/targets.xsl"/>
  27. <xsl:include href="../common/olink.xsl"/>
  28. <xsl:include href="../common/pi.xsl"/>
  29. <xsl:include href="../xhtml/autotoc.xsl"/>
  30. <xsl:include href="../xhtml/autoidx.xsl"/>
  31. <xsl:include href="../xhtml/lists.xsl"/>
  32. <xsl:include href="../xhtml/callout.xsl"/>
  33. <xsl:include href="../xhtml/verbatim.xsl"/>
  34. <xsl:include href="../xhtml/graphics.xsl"/>
  35. <xsl:include href="../xhtml/xref.xsl"/>
  36. <xsl:include href="../xhtml/formal.xsl"/>
  37. <xsl:include href="../xhtml/table.xsl"/>
  38. <xsl:include href="../xhtml/htmltbl.xsl"/>
  39. <xsl:include href="../xhtml/sections.xsl"/>
  40. <xsl:include href="../xhtml/inline.xsl"/>
  41. <xsl:include href="../xhtml/footnote.xsl"/>
  42. <xsl:include href="../xhtml/html.xsl"/>
  43. <xsl:include href="../xhtml/info.xsl"/>
  44. <xsl:include href="../xhtml/keywords.xsl"/>
  45. <xsl:include href="../xhtml/division.xsl"/>
  46. <xsl:include href="../xhtml/toc.xsl"/>
  47. <xsl:include href="../xhtml/index.xsl"/>
  48. <xsl:include href="../xhtml/refentry.xsl"/>
  49. <xsl:include href="../xhtml/math.xsl"/>
  50. <xsl:include href="../xhtml/admon.xsl"/>
  51. <xsl:include href="../xhtml/component.xsl"/>
  52. <xsl:include href="../xhtml/biblio.xsl"/>
  53. <xsl:include href="../xhtml/biblio-iso690.xsl"/>
  54. <xsl:include href="../xhtml/glossary.xsl"/>
  55. <xsl:include href="../xhtml/block.xsl"/>
  56. <xsl:include href="../xhtml/task.xsl"/>
  57. <xsl:include href="../xhtml/qandaset.xsl"/>
  58. <xsl:include href="../xhtml/synop.xsl"/>
  59. <xsl:include href="../xhtml/titlepage.xsl"/>
  60. <xsl:include href="../xhtml/titlepage.templates.xsl"/>
  61. <xsl:include href="../xhtml/pi.xsl"/>
  62. <xsl:include href="../xhtml/ebnf.xsl"/>
  63. <xsl:include href="../xhtml/chunker.xsl"/>
  64. <xsl:include href="../xhtml/html-rtf.xsl"/>
  65. <xsl:include href="../xhtml/annotations.xsl"/>
  66. <xsl:include href="../common/stripns.xsl"/>
  67. <xsl:param name="stylesheet.result.type" select="'xhtml'"/>
  68. <xsl:param name="htmlhelp.output" select="0"/>
  69. <!-- ==================================================================== -->
  70. <xsl:key name="id" match="*" use="@id|@xml:id"/>
  71. <xsl:key name="gid" match="*" use="generate-id()"/>
  72. <!-- ==================================================================== -->
  73. <xsl:template match="*">
  74. <xsl:message>
  75. <xsl:text>Element </xsl:text>
  76. <xsl:value-of select="local-name(.)"/>
  77. <xsl:text> in namespace '</xsl:text>
  78. <xsl:value-of select="namespace-uri(.)"/>
  79. <xsl:text>' encountered</xsl:text>
  80. <xsl:if test="parent::*">
  81. <xsl:text> in </xsl:text>
  82. <xsl:value-of select="name(parent::*)"/>
  83. </xsl:if>
  84. <xsl:text>, but no template matches.</xsl:text>
  85. </xsl:message>
  86. <span style="color: red">
  87. <xsl:text>&lt;</xsl:text>
  88. <xsl:value-of select="name(.)"/>
  89. <xsl:text>&gt;</xsl:text>
  90. <xsl:apply-templates/>
  91. <xsl:text>&lt;/</xsl:text>
  92. <xsl:value-of select="name(.)"/>
  93. <xsl:text>&gt;</xsl:text>
  94. </span>
  95. </xsl:template>
  96. <xsl:template match="text()">
  97. <xsl:value-of select="."/>
  98. </xsl:template>
  99. <xsl:template name="body.attributes"><xslo:if xmlns:xslo="http://www.w3.org/1999/XSL/Transform" test="starts-with($writing.mode, 'rl')"><xslo:attribute name="dir">rtl</xslo:attribute></xslo:if>
  100. <!-- no apply-templates; make it empty except for dir for rtl-->
  101. </xsl:template>
  102. <xsl:template name="head.content">
  103. <xsl:param name="node" select="."/>
  104. <xsl:param name="title">
  105. <xsl:apply-templates select="$node" mode="object.title.markup.textonly"/>
  106. </xsl:param>
  107. <title>
  108. <xsl:copy-of select="$title"/>
  109. </title>
  110. <xsl:if test="$html.base != ''">
  111. <base href="{$html.base}"/>
  112. </xsl:if>
  113. <!-- Insert links to CSS files or insert literal style elements -->
  114. <xsl:call-template name="generate.css"/>
  115. <xsl:if test="$html.stylesheet != ''">
  116. <xsl:call-template name="output.html.stylesheets">
  117. <xsl:with-param name="stylesheets" select="normalize-space($html.stylesheet)"/>
  118. </xsl:call-template>
  119. </xsl:if>
  120. <xsl:if test="$link.mailto.url != ''">
  121. <link rev="made" href="{$link.mailto.url}"/>
  122. </xsl:if>
  123. <meta name="generator" content="DocBook {$DistroTitle} V{$VERSION}"/>
  124. <xsl:if test="$generate.meta.abstract != 0">
  125. <xsl:variable name="info" select="(articleinfo |bookinfo |prefaceinfo |chapterinfo |appendixinfo |sectioninfo |sect1info |sect2info |sect3info |sect4info |sect5info |referenceinfo |refentryinfo |partinfo |info |docinfo)[1]"/>
  126. <xsl:if test="$info and $info/abstract">
  127. <meta name="description">
  128. <xsl:attribute name="content">
  129. <xsl:for-each select="$info/abstract[1]/*">
  130. <xsl:value-of select="normalize-space(.)"/>
  131. <xsl:if test="position() &lt; last()">
  132. <xsl:text> </xsl:text>
  133. </xsl:if>
  134. </xsl:for-each>
  135. </xsl:attribute>
  136. </meta>
  137. </xsl:if>
  138. </xsl:if>
  139. <xsl:if test="($draft.mode = 'yes' or ($draft.mode = 'maybe' and ancestor-or-self::*[@status][1]/@status = 'draft')) and $draft.watermark.image != ''">
  140. <style type="text/css"><xsl:text>
  141. body { background-image: url('</xsl:text>
  142. <xsl:value-of select="$draft.watermark.image"/><xsl:text>');
  143. background-repeat: no-repeat;
  144. background-position: top left;
  145. /* The following properties make the watermark "fixed" on the page. */
  146. /* I think that's just a bit too distracting for the reader... */
  147. /* background-attachment: fixed; */
  148. /* background-position: center center; */
  149. }</xsl:text>
  150. </style>
  151. </xsl:if>
  152. <xsl:apply-templates select="." mode="head.keywords.content"/>
  153. </xsl:template>
  154. <xsl:template name="output.html.stylesheets">
  155. <xsl:param name="stylesheets" select="''"/>
  156. <xsl:choose>
  157. <xsl:when test="contains($stylesheets, ' ')">
  158. <xsl:variable name="css.filename" select="substring-before($stylesheets, ' ')"/>
  159. <xsl:call-template name="make.css.link">
  160. <xsl:with-param name="css.filename" select="$css.filename"/>
  161. </xsl:call-template>
  162. <xsl:call-template name="output.html.stylesheets">
  163. <xsl:with-param name="stylesheets" select="substring-after($stylesheets, ' ')"/>
  164. </xsl:call-template>
  165. </xsl:when>
  166. <xsl:when test="$stylesheets != ''">
  167. <xsl:call-template name="make.css.link">
  168. <xsl:with-param name="css.filename" select="$stylesheets"/>
  169. </xsl:call-template>
  170. </xsl:when>
  171. </xsl:choose>
  172. </xsl:template>
  173. <!-- ============================================================ -->
  174. <xsl:template match="*" mode="head.keywords.content">
  175. <xsl:apply-templates select="chapterinfo/keywordset" mode="html.header"/>
  176. <xsl:apply-templates select="appendixinfo/keywordset" mode="html.header"/>
  177. <xsl:apply-templates select="prefaceinfo/keywordset" mode="html.header"/>
  178. <xsl:apply-templates select="bookinfo/keywordset" mode="html.header"/>
  179. <xsl:apply-templates select="setinfo/keywordset" mode="html.header"/>
  180. <xsl:apply-templates select="articleinfo/keywordset" mode="html.header"/>
  181. <xsl:apply-templates select="artheader/keywordset" mode="html.header"/>
  182. <xsl:apply-templates select="sect1info/keywordset" mode="html.header"/>
  183. <xsl:apply-templates select="sect2info/keywordset" mode="html.header"/>
  184. <xsl:apply-templates select="sect3info/keywordset" mode="html.header"/>
  185. <xsl:apply-templates select="sect4info/keywordset" mode="html.header"/>
  186. <xsl:apply-templates select="sect5info/keywordset" mode="html.header"/>
  187. <xsl:apply-templates select="sectioninfo/keywordset" mode="html.header"/>
  188. <xsl:apply-templates select="refsect1info/keywordset" mode="html.header"/>
  189. <xsl:apply-templates select="refsect2info/keywordset" mode="html.header"/>
  190. <xsl:apply-templates select="refsect3info/keywordset" mode="html.header"/>
  191. <xsl:apply-templates select="bibliographyinfo/keywordset" mode="html.header"/>
  192. <xsl:apply-templates select="glossaryinfo/keywordset" mode="html.header"/>
  193. <xsl:apply-templates select="indexinfo/keywordset" mode="html.header"/>
  194. <xsl:apply-templates select="refentryinfo/keywordset" mode="html.header"/>
  195. <xsl:apply-templates select="partinfo/keywordset" mode="html.header"/>
  196. <xsl:apply-templates select="referenceinfo/keywordset" mode="html.header"/>
  197. <xsl:apply-templates select="docinfo/keywordset" mode="html.header"/>
  198. <xsl:apply-templates select="info/keywordset" mode="html.header"/>
  199. <xsl:if test="$inherit.keywords != 0 and parent::*">
  200. <xsl:apply-templates select="parent::*" mode="head.keywords.content"/>
  201. </xsl:if>
  202. </xsl:template>
  203. <!-- ============================================================ -->
  204. <xsl:template name="system.head.content">
  205. <xsl:param name="node" select="."/>
  206. <!-- FIXME: When chunking, only the annotations actually used
  207. in this chunk should be referenced. I don't think it
  208. does any harm to reference them all, but it adds
  209. unnecessary bloat to each chunk. -->
  210. <xsl:if test="$annotation.support != 0 and //annotation">
  211. <xsl:call-template name="add.annotation.links"/>
  212. <script type="text/javascript">
  213. <xsl:text>
  214. // Create PopupWindow objects</xsl:text>
  215. <xsl:for-each select="//annotation">
  216. <xsl:text>
  217. var popup_</xsl:text>
  218. <xsl:value-of select="generate-id(.)"/>
  219. <xsl:text> = new PopupWindow("popup-</xsl:text>
  220. <xsl:value-of select="generate-id(.)"/>
  221. <xsl:text>");
  222. </xsl:text>
  223. <xsl:text>popup_</xsl:text>
  224. <xsl:value-of select="generate-id(.)"/>
  225. <xsl:text>.offsetY = 15;
  226. </xsl:text>
  227. <xsl:text>popup_</xsl:text>
  228. <xsl:value-of select="generate-id(.)"/>
  229. <xsl:text>.autoHide();
  230. </xsl:text>
  231. </xsl:for-each>
  232. </script>
  233. <style type="text/css">
  234. <xsl:value-of select="$annotation.css"/>
  235. </style>
  236. </xsl:if>
  237. <!-- system.head.content is like user.head.content, except that
  238. it is called before head.content. This is important because it
  239. means, for example, that <style> elements output by system.head.content
  240. have a lower CSS precedence than the users stylesheet. -->
  241. </xsl:template>
  242. <!-- ============================================================ -->
  243. <xsl:template name="user.preroot">
  244. <!-- Pre-root output, can be used to output comments and PIs. -->
  245. <!-- This must not output any element content! -->
  246. </xsl:template>
  247. <xsl:template name="user.head.content">
  248. <xsl:param name="node" select="."/>
  249. </xsl:template>
  250. <xsl:template name="user.header.navigation">
  251. <xsl:param name="node" select="."/>
  252. </xsl:template>
  253. <xsl:template name="user.header.content">
  254. <xsl:param name="node" select="."/>
  255. </xsl:template>
  256. <xsl:template name="user.footer.content">
  257. <xsl:param name="node" select="."/>
  258. </xsl:template>
  259. <xsl:template name="user.footer.navigation">
  260. <xsl:param name="node" select="."/>
  261. </xsl:template>
  262. <xslo:include xmlns:xslo="http://www.w3.org/1999/XSL/Transform" href="../profiling/profile-mode.xsl"/><xslo:variable xmlns:xslo="http://www.w3.org/1999/XSL/Transform" name="profiled-content"><xslo:choose><xslo:when test="*/self::ng:* or */self::db:*"><xslo:message>Note: namesp. cut : stripped namespace before processing</xslo:message><xslo:variable name="stripped-content"><xslo:apply-templates select="/" mode="stripNS"/></xslo:variable><xslo:message>Note: namesp. cut : processing stripped document</xslo:message><xslo:apply-templates select="exslt:node-set($stripped-content)" mode="profile"/></xslo:when><xslo:otherwise><xslo:apply-templates select="/" mode="profile"/></xslo:otherwise></xslo:choose></xslo:variable><xslo:variable xmlns:xslo="http://www.w3.org/1999/XSL/Transform" name="profiled-nodes" select="exslt:node-set($profiled-content)"/><xsl:template match="/">
  263. <!-- * Get a title for current doc so that we let the user -->
  264. <!-- * know what document we are processing at this point. -->
  265. <xsl:variable name="doc.title">
  266. <xsl:call-template name="get.doc.title"/>
  267. </xsl:variable>
  268. <xsl:choose>
  269. <!-- Hack! If someone hands us a DocBook V5.x or DocBook NG document,
  270. toss the namespace and continue. Use the docbook5 namespaced
  271. stylesheets for DocBook5 if you don't want to use this feature.-->
  272. <!-- include extra test for Xalan quirk -->
  273. <xsl:when test="false()"/>
  274. <!-- Can't process unless namespace removed -->
  275. <xsl:when test="false()"/>
  276. <xsl:otherwise>
  277. <xsl:choose>
  278. <xsl:when test="$rootid != ''">
  279. <xsl:choose>
  280. <xsl:when test="count($profiled-nodes//*[@id=$rootid]) = 0">
  281. <xsl:message terminate="yes">
  282. <xsl:text>ID '</xsl:text>
  283. <xsl:value-of select="$rootid"/>
  284. <xsl:text>' not found in document.</xsl:text>
  285. </xsl:message>
  286. </xsl:when>
  287. <xsl:otherwise>
  288. <xsl:if test="$collect.xref.targets = 'yes' or $collect.xref.targets = 'only'">
  289. <xsl:apply-templates select="key('id', $rootid)" mode="collect.targets"/>
  290. </xsl:if>
  291. <xsl:if test="$collect.xref.targets != 'only'">
  292. <xsl:apply-templates select="$profiled-nodes//*[@id=$rootid]" mode="process.root"/>
  293. <xsl:if test="$tex.math.in.alt != ''">
  294. <xsl:apply-templates select="$profiled-nodes//*[@id=$rootid]" mode="collect.tex.math"/>
  295. </xsl:if>
  296. </xsl:if>
  297. </xsl:otherwise>
  298. </xsl:choose>
  299. </xsl:when>
  300. <xsl:otherwise>
  301. <xsl:if test="$collect.xref.targets = 'yes' or $collect.xref.targets = 'only'">
  302. <xsl:apply-templates select="$profiled-nodes" mode="collect.targets"/>
  303. </xsl:if>
  304. <xsl:if test="$collect.xref.targets != 'only'">
  305. <xsl:apply-templates select="$profiled-nodes" mode="process.root"/>
  306. <xsl:if test="$tex.math.in.alt != ''">
  307. <xsl:apply-templates select="$profiled-nodes" mode="collect.tex.math"/>
  308. </xsl:if>
  309. </xsl:if>
  310. </xsl:otherwise>
  311. </xsl:choose>
  312. </xsl:otherwise>
  313. </xsl:choose>
  314. </xsl:template>
  315. <xsl:template match="*" mode="process.root">
  316. <xsl:variable name="doc" select="self::*"/>
  317. <xsl:call-template name="user.preroot"/>
  318. <xsl:call-template name="root.messages"/>
  319. <html>
  320. <head>
  321. <xsl:call-template name="system.head.content">
  322. <xsl:with-param name="node" select="$doc"/>
  323. </xsl:call-template>
  324. <xsl:call-template name="head.content">
  325. <xsl:with-param name="node" select="$doc"/>
  326. </xsl:call-template>
  327. <xsl:call-template name="user.head.content">
  328. <xsl:with-param name="node" select="$doc"/>
  329. </xsl:call-template>
  330. </head>
  331. <body>
  332. <xsl:call-template name="body.attributes"/>
  333. <xsl:call-template name="user.header.content">
  334. <xsl:with-param name="node" select="$doc"/>
  335. </xsl:call-template>
  336. <xsl:apply-templates select="."/>
  337. <xsl:call-template name="user.footer.content">
  338. <xsl:with-param name="node" select="$doc"/>
  339. </xsl:call-template>
  340. </body>
  341. </html>
  342. <xsl:value-of select="$html.append"/>
  343. <!-- Generate any css files only once, not once per chunk -->
  344. <xsl:call-template name="generate.css.files"/>
  345. </xsl:template>
  346. <xsl:template name="root.messages">
  347. <!-- redefine this any way you'd like to output messages -->
  348. <!-- DO NOT OUTPUT ANYTHING FROM THIS TEMPLATE -->
  349. </xsl:template>
  350. <!-- ==================================================================== -->
  351. <xsl:template name="chunk">
  352. <xsl:param name="node" select="."/>
  353. <!-- The default is that we are not chunking... -->
  354. <xsl:text>0</xsl:text>
  355. </xsl:template>
  356. </xsl:stylesheet>