lfs-pagesetup.xsl 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. <?xml version='1.0' encoding='ISO-8859-1'?>
  2. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  3. xmlns:fo="http://www.w3.org/1999/XSL/Format"
  4. version="1.0">
  5. <!-- REVISED -->
  6. <!-- This stylesheet controls page margins, header content and titles size. -->
  7. <!-- The inner page margin. -->
  8. <xsl:param name="page.margin.inner" select="'0.5in'"/>
  9. <!-- The outer page margin. -->
  10. <xsl:param name="page.margin.outer" select="'0.375in'"/>
  11. <!-- The bottom margin of the page. -->
  12. <xsl:param name="page.margin.bottom" select="'0.375in'"/>
  13. <!-- The top margin of the page. -->
  14. <xsl:param name="page.margin.top" select="'0.375in'"/>
  15. <!-- The bottom margin of the body text. -->
  16. <xsl:param name="body.margin.bottom" select="'0.4in'"/>
  17. <!-- The top margin of the body text. -->
  18. <xsl:param name="body.margin.top" select="'0.4in'"/>
  19. <!-- Specifies the height of the header. -->
  20. <xsl:param name="region.before.extent" select="'0.25in'"/>
  21. <!-- Specifies the height of the footer. -->
  22. <xsl:param name="region.after.extent" select="'0.25in'"/>
  23. <!-- The start-indent for the body text. -->
  24. <xsl:param name="body.start.indent" select="'0pc'"/>
  25. <!-- Adjust the left margin for titles. -->
  26. <xsl:param name="title.margin.left">-0.8pc</xsl:param>
  27. <!-- Rule under headers? 1 =yes, 0 = no -->
  28. <xsl:param name="header.rule" select="0"/>
  29. <!-- Rule over footers? 1 =yes, 0 = no -->
  30. <xsl:param name="footer.rule" select="0"></xsl:param>
  31. <!-- Control depth of sections shown in running headers or footers.
  32. Be sure that no uneeded fo:marker are generated. -->
  33. <xsl:param name="marker.section.level" select="-1"></xsl:param>
  34. <!-- Dropping a blank page after book title. -->
  35. <xsl:template name="book.titlepage.separator"/>
  36. <!-- book title:
  37. Centered the title and removed unused code. -->
  38. <!-- The original template is in {docbook-xsl}/fo/titlepage.templates.xsl -->
  39. <xsl:template name="book.titlepage">
  40. <fo:block margin-top="3in">
  41. <fo:block>
  42. <xsl:call-template name="book.titlepage.before.recto"/>
  43. <xsl:call-template name="book.titlepage.recto"/>
  44. </fo:block>
  45. <fo:block>
  46. <xsl:call-template name="book.titlepage.before.verso"/>
  47. <xsl:call-template name="book.titlepage.verso"/>
  48. </fo:block>
  49. <xsl:call-template name="book.titlepage.separator"/>
  50. </fo:block>
  51. </xsl:template>
  52. <!-- book title:
  53. Drop a blank page after book title. -->
  54. <!-- The original template is in {docbook-xsl}/fo/titlepage.templates.xsl -->
  55. <xsl:template name="book.titlepage.separator"/>
  56. <!-- part title:
  57. Centered the title and removed unused code. -->
  58. <!-- The original template is in {docbook-xsl}/fo/titlepage.templates.xsl -->
  59. <xsl:template name="part.titlepage">
  60. <fo:block>
  61. <fo:block margin-top="3.5in">
  62. <xsl:call-template name="part.titlepage.before.recto"/>
  63. <xsl:call-template name="part.titlepage.recto"/>
  64. </fo:block>
  65. <fo:block>
  66. <xsl:call-template name="part.titlepage.before.verso"/>
  67. <xsl:call-template name="part.titlepage.verso"/>
  68. </fo:block>
  69. <xsl:call-template name="part.titlepage.separator"/>
  70. </fo:block>
  71. </xsl:template>
  72. <!-- chapter title:
  73. Small font size and left alignament. -->
  74. <!-- The original template is in {docbook-xsl}/fo/titlepage.templates.xsl -->
  75. <xsl:template match="title" mode="chapter.titlepage.recto.auto.mode">
  76. <fo:block xsl:use-attribute-sets="chapter.titlepage.recto.style"
  77. font-size="21pt" font-weight="bold" text-align="left">
  78. <xsl:call-template name="component.title">
  79. <xsl:with-param name="node" select="ancestor-or-self::chapter[1]"/>
  80. </xsl:call-template>
  81. </fo:block>
  82. </xsl:template>
  83. <!-- header.table:
  84. Re-made template to not generate a fo:table in the header,
  85. allowing a more simple header.content custonization. -->
  86. <!-- The original template is in {docbook-xsl}/fo/pagesetup.xsl -->
  87. <xsl:template name="header.table">
  88. <xsl:param name="sequence" select="''"/>
  89. <xsl:param name="gentext-key" select="''"/>
  90. <xsl:choose>
  91. <xsl:when test="$gentext-key = 'book' or $sequence = 'blank'"/>
  92. <xsl:otherwise>
  93. <xsl:call-template name="header.content">
  94. <xsl:with-param name="sequence" select="$sequence"/>
  95. </xsl:call-template>
  96. </xsl:otherwise>
  97. </xsl:choose>
  98. </xsl:template>
  99. <!-- header.content
  100. Re-made template to show the book title and version on all pages. -->
  101. <!-- The original template is in {docbook-xsl}/fo/pagesetup.xsl -->
  102. <xsl:template name="header.content">
  103. <xsl:param name="sequence" select="''"/>
  104. <fo:block>
  105. <xsl:attribute name="text-align">
  106. <xsl:choose>
  107. <xsl:when test="$sequence = 'first' or $sequence = 'odd'">right</xsl:when>
  108. <xsl:otherwise>left</xsl:otherwise>
  109. </xsl:choose>
  110. </xsl:attribute>
  111. <xsl:value-of select="/book/bookinfo/title"/>
  112. <xsl:text> - </xsl:text>
  113. <xsl:value-of select="/book/bookinfo/subtitle"/>
  114. </fo:block>
  115. </xsl:template>
  116. </xsl:stylesheet>