lfs-pagesetup.xsl 5.0 KB

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