subtitles.xsl 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. <?xml version='1.0'?>
  2. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  3. xmlns:doc="http://nwalsh.com/xsl/documentation/1.0"
  4. exclude-result-prefixes="doc"
  5. version='1.0'>
  6. <!-- ********************************************************************
  7. $Id: subtitles.xsl 9286 2012-04-19 10:10:58Z bobstayton $
  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. <!-- subtitle markup -->
  15. <doc:mode mode="subtitle.markup" xmlns="">
  16. <refpurpose>Provides access to element subtitles</refpurpose>
  17. <refdescription id="subtitle.markup-desc">
  18. <para>Processing an element in the
  19. <literal role="mode">subtitle.markup</literal> mode produces the
  20. subtitle of the element.
  21. </para>
  22. </refdescription>
  23. </doc:mode>
  24. <xsl:template match="*" mode="subtitle.markup">
  25. <xsl:param name="verbose" select="1"/>
  26. <xsl:if test="$verbose != 0">
  27. <xsl:message>
  28. <xsl:text>Request for subtitle of unexpected element: </xsl:text>
  29. <xsl:value-of select="local-name(.)"/>
  30. </xsl:message>
  31. <xsl:text>???SUBTITLE???</xsl:text>
  32. </xsl:if>
  33. </xsl:template>
  34. <xsl:template match="subtitle" mode="subtitle.markup">
  35. <xsl:param name="allow-anchors" select="'0'"/>
  36. <xsl:param name="verbose" select="1"/>
  37. <xsl:apply-templates/>
  38. </xsl:template>
  39. <xsl:template match="set" mode="subtitle.markup">
  40. <xsl:param name="allow-anchors" select="'0'"/>
  41. <xsl:param name="verbose" select="1"/>
  42. <xsl:apply-templates select="(setinfo/subtitle|info/subtitle|subtitle)[1]"
  43. mode="subtitle.markup">
  44. <xsl:with-param name="allow-anchors" select="$allow-anchors"/>
  45. <xsl:with-param name="verbose" select="$verbose"/>
  46. </xsl:apply-templates>
  47. </xsl:template>
  48. <xsl:template match="book" mode="subtitle.markup">
  49. <xsl:param name="allow-anchors" select="'0'"/>
  50. <xsl:param name="verbose" select="1"/>
  51. <xsl:apply-templates select="(bookinfo/subtitle|info/subtitle|subtitle)[1]"
  52. mode="subtitle.markup">
  53. <xsl:with-param name="allow-anchors" select="$allow-anchors"/>
  54. <xsl:with-param name="verbose" select="$verbose"/>
  55. </xsl:apply-templates>
  56. </xsl:template>
  57. <xsl:template match="part" mode="subtitle.markup">
  58. <xsl:param name="allow-anchors" select="'0'"/>
  59. <xsl:param name="verbose" select="1"/>
  60. <xsl:apply-templates select="(partinfo/subtitle
  61. |docinfo/subtitle
  62. |info/subtitle
  63. |subtitle)[1]"
  64. mode="subtitle.markup">
  65. <xsl:with-param name="allow-anchors" select="$allow-anchors"/>
  66. <xsl:with-param name="verbose" select="$verbose"/>
  67. </xsl:apply-templates>
  68. </xsl:template>
  69. <xsl:template match="preface|chapter|appendix" mode="subtitle.markup">
  70. <xsl:param name="allow-anchors" select="'0'"/>
  71. <xsl:param name="verbose" select="1"/>
  72. <xsl:apply-templates select="(docinfo/subtitle
  73. |info/subtitle
  74. |prefaceinfo/subtitle
  75. |chapterinfo/subtitle
  76. |appendixinfo/subtitle
  77. |subtitle)[1]"
  78. mode="subtitle.markup">
  79. <xsl:with-param name="allow-anchors" select="$allow-anchors"/>
  80. <xsl:with-param name="verbose" select="$verbose"/>
  81. </xsl:apply-templates>
  82. </xsl:template>
  83. <xsl:template match="article" mode="subtitle.markup">
  84. <xsl:param name="allow-anchors" select="'0'"/>
  85. <xsl:param name="verbose" select="1"/>
  86. <xsl:apply-templates select="(artheader/subtitle
  87. |articleinfo/subtitle
  88. |info/subtitle
  89. |subtitle)[1]"
  90. mode="subtitle.markup">
  91. <xsl:with-param name="allow-anchors" select="$allow-anchors"/>
  92. <xsl:with-param name="verbose" select="$verbose"/>
  93. </xsl:apply-templates>
  94. </xsl:template>
  95. <xsl:template match="dedication|colophon" mode="subtitle.markup">
  96. <xsl:param name="allow-anchors" select="'0'"/>
  97. <xsl:param name="verbose" select="1"/>
  98. <xsl:apply-templates select="(subtitle|info/subtitle)[1]"
  99. mode="subtitle.markup">
  100. <xsl:with-param name="allow-anchors" select="$allow-anchors"/>
  101. <xsl:with-param name="verbose" select="$verbose"/>
  102. </xsl:apply-templates>
  103. </xsl:template>
  104. <xsl:template match="reference" mode="subtitle.markup">
  105. <xsl:param name="allow-anchors" select="'0'"/>
  106. <xsl:param name="verbose" select="1"/>
  107. <xsl:apply-templates select="(referenceinfo/subtitle
  108. |docinfo/subtitle
  109. |info/subtitle
  110. |subtitle)[1]"
  111. mode="subtitle.markup">
  112. <xsl:with-param name="allow-anchors" select="$allow-anchors"/>
  113. <xsl:with-param name="verbose" select="$verbose"/>
  114. </xsl:apply-templates>
  115. </xsl:template>
  116. <xsl:template match="qandaset" mode="subtitle.markup">
  117. <xsl:param name="allow-anchors" select="'0'"/>
  118. <xsl:param name="verbose" select="1"/>
  119. <xsl:apply-templates select="(blockinfo/subtitle|info/subtitle)[1]"
  120. mode="subtitle.markup">
  121. <xsl:with-param name="allow-anchors" select="$allow-anchors"/>
  122. <xsl:with-param name="verbose" select="$verbose"/>
  123. </xsl:apply-templates>
  124. </xsl:template>
  125. <xsl:template match="refentry" mode="subtitle.markup">
  126. <xsl:param name="allow-anchors" select="'0'"/>
  127. <xsl:param name="verbose" select="1"/>
  128. <xsl:apply-templates select="(refentryinfo/subtitle
  129. |info/subtitle
  130. |docinfo/subtitle)[1]"
  131. mode="subtitle.markup">
  132. <xsl:with-param name="allow-anchors" select="$allow-anchors"/>
  133. <xsl:with-param name="verbose" select="$verbose"/>
  134. </xsl:apply-templates>
  135. </xsl:template>
  136. <xsl:template match="section
  137. |sect1|sect2|sect3|sect4|sect5
  138. |refsect1|refsect2|refsect3
  139. |topic
  140. |simplesect"
  141. mode="subtitle.markup">
  142. <xsl:param name="allow-anchors" select="'0'"/>
  143. <xsl:param name="verbose" select="1"/>
  144. <xsl:apply-templates select="(info/subtitle
  145. |sectioninfo/subtitle
  146. |sect1info/subtitle
  147. |sect2info/subtitle
  148. |sect3info/subtitle
  149. |sect4info/subtitle
  150. |sect5info/subtitle
  151. |refsect1info/subtitle
  152. |refsect2info/subtitle
  153. |refsect3info/subtitle
  154. |subtitle)[1]"
  155. mode="subtitle.markup">
  156. <xsl:with-param name="allow-anchors" select="$allow-anchors"/>
  157. <xsl:with-param name="verbose" select="$verbose"/>
  158. </xsl:apply-templates>
  159. </xsl:template>
  160. </xsl:stylesheet>