lfs-sections.xsl 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. <?xml version='1.0' encoding='ISO-8859-1'?>
  2. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  3. xmlns="http://www.w3.org/1999/xhtml"
  4. version="1.0">
  5. <!-- This stylesheet controls how sections are handled -->
  6. <!-- Chunk the first top-level section? 1 = yes, 0 = no
  7. If chapters TOC are generated, this must be 1. -->
  8. <xsl:param name="chunk.first.sections" select="1"/>
  9. <!-- sect1:
  10. When there is a role attibute, use it as the class value.
  11. Process the SVN keywords found in sect1info as a footnote.
  12. Removed unused code. -->
  13. <!-- The original template is in {docbook-xsl}/xhtml/sections.xsl -->
  14. <xsl:template match="sect1">
  15. <div>
  16. <xsl:choose>
  17. <xsl:when test="@role">
  18. <xsl:attribute name="class">
  19. <xsl:value-of select="@role"/>
  20. </xsl:attribute>
  21. </xsl:when>
  22. <xsl:otherwise>
  23. <xsl:apply-templates select="." mode="class.attribute"/>
  24. </xsl:otherwise>
  25. </xsl:choose>
  26. <xsl:call-template name="language.attribute"/>
  27. <xsl:call-template name="sect1.titlepage"/>
  28. <xsl:apply-templates/>
  29. <xsl:apply-templates select="sect1info" mode="svn-keys"/>
  30. </div>
  31. </xsl:template>
  32. <!-- sect2:
  33. When there is a role attibute, use it as the class value.
  34. Removed unused code. -->
  35. <!-- The original template is in {docbook-xsl}/xhtml/sections.xsl -->
  36. <xsl:template match="sect2">
  37. <div>
  38. <xsl:choose>
  39. <xsl:when test="@role">
  40. <xsl:attribute name="class">
  41. <xsl:value-of select="@role"/>
  42. </xsl:attribute>
  43. </xsl:when>
  44. <xsl:otherwise>
  45. <xsl:attribute name="class">
  46. <xsl:value-of select="name(.)"/>
  47. </xsl:attribute>
  48. </xsl:otherwise>
  49. </xsl:choose>
  50. <xsl:call-template name="language.attribute"/>
  51. <xsl:call-template name="sect2.titlepage"/>
  52. <xsl:apply-templates/>
  53. </div>
  54. </xsl:template>
  55. <!-- sect1info mode svn-keys:
  56. Self-made template to process SVN keywords found in sect1info. -->
  57. <xsl:template match="sect1info" mode="svn-keys">
  58. <p class="updated">Last updated <!-- by
  59. <xsl:apply-templates select="othername" mode="svn-keys"/> -->
  60. on
  61. <xsl:apply-templates select="date" mode="svn-keys"/>
  62. </p>
  63. </xsl:template>
  64. <!-- othername mode svn-keys:
  65. Self-made template to process the $LastChangedBy SVN keyword. -->
  66. <xsl:template match="othername" mode="svn-keys">
  67. <xsl:variable name="author">
  68. <xsl:value-of select="."/>
  69. </xsl:variable>
  70. <xsl:variable name="nameonly">
  71. <xsl:value-of select="substring($author,16)"/>
  72. </xsl:variable>
  73. <xsl:value-of select="substring-before($nameonly,'$')"/>
  74. </xsl:template>
  75. <!-- date mode svn-keys:
  76. Self-made template to process the $Date SVN keyword. -->
  77. <xsl:template match="date" mode="svn-keys">
  78. <xsl:variable name="date">
  79. <xsl:value-of select="."/>
  80. </xsl:variable>
  81. <xsl:value-of select="substring($date,7,26)"/>
  82. </xsl:template>
  83. </xsl:stylesheet>