profile-docbook.xsl 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409
  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" version="1.0">
  7. <xsl:output method="xml" encoding="UTF-8" indent="no" doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"/>
  8. <!-- ********************************************************************
  9. $Id$
  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"/>
  17. <xsl:include href="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="autotoc.xsl"/>
  30. <xsl:include href="autoidx.xsl"/>
  31. <xsl:include href="lists.xsl"/>
  32. <xsl:include href="callout.xsl"/>
  33. <xsl:include href="verbatim.xsl"/>
  34. <xsl:include href="graphics.xsl"/>
  35. <xsl:include href="xref.xsl"/>
  36. <xsl:include href="formal.xsl"/>
  37. <xsl:include href="table.xsl"/>
  38. <xsl:include href="htmltbl.xsl"/>
  39. <xsl:include href="sections.xsl"/>
  40. <xsl:include href="inline.xsl"/>
  41. <xsl:include href="footnote.xsl"/>
  42. <xsl:include href="html.xsl"/>
  43. <xsl:include href="info.xsl"/>
  44. <xsl:include href="keywords.xsl"/>
  45. <xsl:include href="division.xsl"/>
  46. <xsl:include href="toc.xsl"/>
  47. <xsl:include href="index.xsl"/>
  48. <xsl:include href="refentry.xsl"/>
  49. <xsl:include href="math.xsl"/>
  50. <xsl:include href="admon.xsl"/>
  51. <xsl:include href="component.xsl"/>
  52. <xsl:include href="biblio.xsl"/>
  53. <xsl:include href="biblio-iso690.xsl"/>
  54. <xsl:include href="glossary.xsl"/>
  55. <xsl:include href="block.xsl"/>
  56. <xsl:include href="task.xsl"/>
  57. <xsl:include href="qandaset.xsl"/>
  58. <xsl:include href="synop.xsl"/>
  59. <xsl:include href="titlepage.xsl"/>
  60. <xsl:include href="titlepage.templates.xsl"/>
  61. <xsl:include href="pi.xsl"/>
  62. <xsl:include href="ebnf.xsl"/>
  63. <xsl:include href="chunker.xsl"/>
  64. <xsl:include href="html-rtf.xsl"/>
  65. <xsl:include href="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">
  100. <!-- no apply-templates; make it empty -->
  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.stylesheet != ''">
  111. <xsl:call-template name="output.html.stylesheets">
  112. <xsl:with-param name="stylesheets" select="normalize-space($html.stylesheet)"/>
  113. </xsl:call-template>
  114. </xsl:if>
  115. <xsl:if test="$link.mailto.url != ''">
  116. <link rev="made" href="{$link.mailto.url}"/>
  117. </xsl:if>
  118. <xsl:if test="$html.base != ''">
  119. <base href="{$html.base}"/>
  120. </xsl:if>
  121. <meta name="generator" content="DocBook {$DistroTitle} V{$VERSION}"/>
  122. <xsl:if test="$generate.meta.abstract != 0">
  123. <xsl:variable name="info" select="(articleinfo |bookinfo |prefaceinfo |chapterinfo |appendixinfo |sectioninfo |sect1info |sect2info |sect3info |sect4info |sect5info |referenceinfo |refentryinfo |partinfo |info |docinfo)[1]"/>
  124. <xsl:if test="$info and $info/abstract">
  125. <meta name="description">
  126. <xsl:attribute name="content">
  127. <xsl:for-each select="$info/abstract[1]/*">
  128. <xsl:value-of select="normalize-space(.)"/>
  129. <xsl:if test="position() &lt; last()">
  130. <xsl:text> </xsl:text>
  131. </xsl:if>
  132. </xsl:for-each>
  133. </xsl:attribute>
  134. </meta>
  135. </xsl:if>
  136. </xsl:if>
  137. <xsl:if test="($draft.mode = 'yes' or ($draft.mode = 'maybe' and ancestor-or-self::*[@status][1]/@status = 'draft')) and $draft.watermark.image != ''">
  138. <style type="text/css"><xsl:text>
  139. body { background-image: url('</xsl:text>
  140. <xsl:value-of select="$draft.watermark.image"/><xsl:text>');
  141. background-repeat: no-repeat;
  142. background-position: top left;
  143. /* The following properties make the watermark "fixed" on the page. */
  144. /* I think that's just a bit too distracting for the reader... */
  145. /* background-attachment: fixed; */
  146. /* background-position: center center; */
  147. }</xsl:text>
  148. </style>
  149. </xsl:if>
  150. <xsl:apply-templates select="." mode="head.keywords.content"/>
  151. </xsl:template>
  152. <xsl:template name="output.html.stylesheets">
  153. <xsl:param name="stylesheets" select="''"/>
  154. <xsl:choose>
  155. <xsl:when test="contains($stylesheets, ' ')">
  156. <link rel="stylesheet" href="{substring-before($stylesheets, ' ')}">
  157. <xsl:if test="$html.stylesheet.type != ''">
  158. <xsl:attribute name="type">
  159. <xsl:value-of select="$html.stylesheet.type"/>
  160. </xsl:attribute>
  161. </xsl:if>
  162. </link>
  163. <xsl:call-template name="output.html.stylesheets">
  164. <xsl:with-param name="stylesheets" select="substring-after($stylesheets, ' ')"/>
  165. </xsl:call-template>
  166. </xsl:when>
  167. <xsl:when test="$stylesheets != ''">
  168. <link rel="stylesheet" href="{$stylesheets}">
  169. <xsl:if test="$html.stylesheet.type != ''">
  170. <xsl:attribute name="type">
  171. <xsl:value-of select="$html.stylesheet.type"/>
  172. </xsl:attribute>
  173. </xsl:if>
  174. </link>
  175. </xsl:when>
  176. </xsl:choose>
  177. </xsl:template>
  178. <!-- ============================================================ -->
  179. <xsl:template match="*" mode="head.keywords.content">
  180. <xsl:apply-templates select="chapterinfo/keywordset" mode="html.header"/>
  181. <xsl:apply-templates select="appendixinfo/keywordset" mode="html.header"/>
  182. <xsl:apply-templates select="prefaceinfo/keywordset" mode="html.header"/>
  183. <xsl:apply-templates select="bookinfo/keywordset" mode="html.header"/>
  184. <xsl:apply-templates select="setinfo/keywordset" mode="html.header"/>
  185. <xsl:apply-templates select="articleinfo/keywordset" mode="html.header"/>
  186. <xsl:apply-templates select="artheader/keywordset" mode="html.header"/>
  187. <xsl:apply-templates select="sect1info/keywordset" mode="html.header"/>
  188. <xsl:apply-templates select="sect2info/keywordset" mode="html.header"/>
  189. <xsl:apply-templates select="sect3info/keywordset" mode="html.header"/>
  190. <xsl:apply-templates select="sect4info/keywordset" mode="html.header"/>
  191. <xsl:apply-templates select="sect5info/keywordset" mode="html.header"/>
  192. <xsl:apply-templates select="sectioninfo/keywordset" mode="html.header"/>
  193. <xsl:apply-templates select="refsect1info/keywordset" mode="html.header"/>
  194. <xsl:apply-templates select="refsect2info/keywordset" mode="html.header"/>
  195. <xsl:apply-templates select="refsect3info/keywordset" mode="html.header"/>
  196. <xsl:apply-templates select="bibliographyinfo/keywordset" mode="html.header"/>
  197. <xsl:apply-templates select="glossaryinfo/keywordset" mode="html.header"/>
  198. <xsl:apply-templates select="indexinfo/keywordset" mode="html.header"/>
  199. <xsl:apply-templates select="refentryinfo/keywordset" mode="html.header"/>
  200. <xsl:apply-templates select="partinfo/keywordset" mode="html.header"/>
  201. <xsl:apply-templates select="referenceinfo/keywordset" mode="html.header"/>
  202. <xsl:apply-templates select="docinfo/keywordset" mode="html.header"/>
  203. <xsl:apply-templates select="info/keywordset" mode="html.header"/>
  204. <xsl:if test="$inherit.keywords != 0 and parent::*">
  205. <xsl:apply-templates select="parent::*" mode="head.keywords.content"/>
  206. </xsl:if>
  207. </xsl:template>
  208. <!-- ============================================================ -->
  209. <xsl:template name="system.head.content">
  210. <xsl:param name="node" select="."/>
  211. <!-- FIXME: When chunking, only the annotations actually used
  212. in this chunk should be referenced. I don't think it
  213. does any harm to reference them all, but it adds
  214. unnecessary bloat to each chunk. -->
  215. <xsl:if test="$annotation.support != 0 and //annotation">
  216. <xsl:call-template name="add.annotation.links"/>
  217. <script type="text/javascript">
  218. <xsl:text>
  219. // Create PopupWindow objects</xsl:text>
  220. <xsl:for-each select="//annotation">
  221. <xsl:text>
  222. var popup_</xsl:text>
  223. <xsl:value-of select="generate-id(.)"/>
  224. <xsl:text> = new PopupWindow("popup-</xsl:text>
  225. <xsl:value-of select="generate-id(.)"/>
  226. <xsl:text>");
  227. </xsl:text>
  228. <xsl:text>popup_</xsl:text>
  229. <xsl:value-of select="generate-id(.)"/>
  230. <xsl:text>.offsetY = 15;
  231. </xsl:text>
  232. <xsl:text>popup_</xsl:text>
  233. <xsl:value-of select="generate-id(.)"/>
  234. <xsl:text>.autoHide();
  235. </xsl:text>
  236. </xsl:for-each>
  237. </script>
  238. <style type="text/css">
  239. <xsl:value-of select="$annotation.css"/>
  240. </style>
  241. </xsl:if>
  242. <!-- system.head.content is like user.head.content, except that
  243. it is called before head.content. This is important because it
  244. means, for example, that <style> elements output by system.head.content
  245. have a lower CSS precedence than the users stylesheet. -->
  246. </xsl:template>
  247. <!-- ============================================================ -->
  248. <xsl:template name="user.preroot">
  249. <!-- Pre-root output, can be used to output comments and PIs. -->
  250. <!-- This must not output any element content! -->
  251. </xsl:template>
  252. <xsl:template name="user.head.content">
  253. <xsl:param name="node" select="."/>
  254. </xsl:template>
  255. <xsl:template name="user.header.navigation">
  256. <xsl:param name="node" select="."/>
  257. </xsl:template>
  258. <xsl:template name="user.header.content">
  259. <xsl:param name="node" select="."/>
  260. </xsl:template>
  261. <xsl:template name="user.footer.content">
  262. <xsl:param name="node" select="."/>
  263. </xsl:template>
  264. <xsl:template name="user.footer.navigation">
  265. <xsl:param name="node" select="."/>
  266. </xsl:template>
  267. <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="/">
  268. <!-- * Get a title for current doc so that we let the user -->
  269. <!-- * know what document we are processing at this point. -->
  270. <xsl:variable name="doc.title">
  271. <xsl:call-template name="get.doc.title"/>
  272. </xsl:variable>
  273. <xsl:choose>
  274. <!-- Hack! If someone hands us a DocBook V5.x or DocBook NG document,
  275. toss the namespace and continue. Use the docbook5 namespaced
  276. stylesheets for DocBook5 if you don't want to use this feature.-->
  277. <!-- include extra test for Xalan quirk -->
  278. <xsl:when test="false()"/>
  279. <!-- Can't process unless namespace removed -->
  280. <xsl:when test="false()"/>
  281. <xsl:otherwise>
  282. <xsl:choose>
  283. <xsl:when test="$rootid != ''">
  284. <xsl:choose>
  285. <xsl:when test="count($profiled-nodes//*[@id=$rootid]) = 0">
  286. <xsl:message terminate="yes">
  287. <xsl:text>ID '</xsl:text>
  288. <xsl:value-of select="$rootid"/>
  289. <xsl:text>' not found in document.</xsl:text>
  290. </xsl:message>
  291. </xsl:when>
  292. <xsl:otherwise>
  293. <xsl:if test="$collect.xref.targets = 'yes' or $collect.xref.targets = 'only'">
  294. <xsl:apply-templates select="key('id', $rootid)" mode="collect.targets"/>
  295. </xsl:if>
  296. <xsl:if test="$collect.xref.targets != 'only'">
  297. <xsl:apply-templates select="$profiled-nodes//*[@id=$rootid]" mode="process.root"/>
  298. <xsl:if test="$tex.math.in.alt != ''">
  299. <xsl:apply-templates select="$profiled-nodes//*[@id=$rootid]" mode="collect.tex.math"/>
  300. </xsl:if>
  301. </xsl:if>
  302. </xsl:otherwise>
  303. </xsl:choose>
  304. </xsl:when>
  305. <xsl:otherwise>
  306. <xsl:if test="$collect.xref.targets = 'yes' or $collect.xref.targets = 'only'">
  307. <xsl:apply-templates select="$profiled-nodes" mode="collect.targets"/>
  308. </xsl:if>
  309. <xsl:if test="$collect.xref.targets != 'only'">
  310. <xsl:apply-templates select="$profiled-nodes" mode="process.root"/>
  311. <xsl:if test="$tex.math.in.alt != ''">
  312. <xsl:apply-templates select="$profiled-nodes" mode="collect.tex.math"/>
  313. </xsl:if>
  314. </xsl:if>
  315. </xsl:otherwise>
  316. </xsl:choose>
  317. </xsl:otherwise>
  318. </xsl:choose>
  319. </xsl:template>
  320. <xsl:template match="*" mode="process.root">
  321. <xsl:variable name="doc" select="self::*"/>
  322. <xsl:call-template name="user.preroot"/>
  323. <xsl:call-template name="root.messages"/>
  324. <html>
  325. <head>
  326. <xsl:call-template name="system.head.content">
  327. <xsl:with-param name="node" select="$doc"/>
  328. </xsl:call-template>
  329. <xsl:call-template name="head.content">
  330. <xsl:with-param name="node" select="$doc"/>
  331. </xsl:call-template>
  332. <xsl:call-template name="user.head.content">
  333. <xsl:with-param name="node" select="$doc"/>
  334. </xsl:call-template>
  335. </head>
  336. <body>
  337. <xsl:call-template name="body.attributes"/>
  338. <xsl:call-template name="user.header.content">
  339. <xsl:with-param name="node" select="$doc"/>
  340. </xsl:call-template>
  341. <xsl:apply-templates select="."/>
  342. <xsl:call-template name="user.footer.content">
  343. <xsl:with-param name="node" select="$doc"/>
  344. </xsl:call-template>
  345. </body>
  346. </html>
  347. <xsl:value-of select="$html.append"/>
  348. </xsl:template>
  349. <xsl:template name="root.messages">
  350. <!-- redefine this any way you'd like to output messages -->
  351. <!-- DO NOT OUTPUT ANYTHING FROM THIS TEMPLATE -->
  352. </xsl:template>
  353. <!-- ==================================================================== -->
  354. <xsl:template name="chunk">
  355. <xsl:param name="node" select="."/>
  356. <!-- The default is that we are not chunking... -->
  357. <xsl:text>0</xsl:text>
  358. </xsl:template>
  359. <!-- ==================================================================== -->
  360. </xsl:stylesheet>