lfs-pagesetup.xsl 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  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. <!-- Header -->
  6. <xsl:template name="header.content">
  7. <xsl:param name="sequence" select="''"/>
  8. <fo:block>
  9. <xsl:attribute name="text-align">
  10. <xsl:choose>
  11. <xsl:when test="$sequence = 'first' or $sequence = 'odd'">right</xsl:when>
  12. <xsl:otherwise>left</xsl:otherwise>
  13. </xsl:choose>
  14. </xsl:attribute>
  15. <xsl:value-of select="/book/bookinfo/title"/>
  16. <xsl:text> - </xsl:text>
  17. <xsl:value-of select="/book/bookinfo/subtitle"/>
  18. </fo:block>
  19. </xsl:template>
  20. <xsl:template name="header.table">
  21. <xsl:param name="sequence" select="''"/>
  22. <xsl:param name="gentext-key" select="''"/>
  23. <xsl:choose>
  24. <xsl:when test="$gentext-key = 'book' or $sequence = 'blank'"/>
  25. <xsl:otherwise>
  26. <xsl:call-template name="header.content">
  27. <xsl:with-param name="sequence" select="$sequence"/>
  28. </xsl:call-template>
  29. </xsl:otherwise>
  30. </xsl:choose>
  31. </xsl:template>
  32. <!-- Centered titles for book and part -->
  33. <xsl:template name="book.titlepage">
  34. <fo:block space-before="2in">
  35. <fo:block>
  36. <xsl:call-template name="book.titlepage.before.recto"/>
  37. <xsl:call-template name="book.titlepage.recto"/>
  38. </fo:block>
  39. <fo:block>
  40. <xsl:call-template name="book.titlepage.before.verso"/>
  41. <xsl:call-template name="book.titlepage.verso"/>
  42. </fo:block>
  43. <xsl:call-template name="book.titlepage.separator"/>
  44. </fo:block>
  45. </xsl:template>
  46. <xsl:template name="part.titlepage">
  47. <fo:block>
  48. <fo:block space-before="2.5in">
  49. <xsl:call-template name="part.titlepage.before.recto"/>
  50. <xsl:call-template name="part.titlepage.recto"/>
  51. </fo:block>
  52. <fo:block>
  53. <xsl:call-template name="part.titlepage.before.verso"/>
  54. <xsl:call-template name="part.titlepage.verso"/>
  55. </fo:block>
  56. <xsl:call-template name="part.titlepage.separator"/>
  57. </fo:block>
  58. </xsl:template>
  59. <!-- Font size for chapter title. -->
  60. <xsl:template match="title" mode="chapter.titlepage.recto.auto.mode">
  61. <fo:block xmlns:fo="http://www.w3.org/1999/XSL/Format"
  62. xsl:use-attribute-sets="chapter.titlepage.recto.style"
  63. font-size="21pt" font-weight="bold" text-align="left">
  64. <xsl:call-template name="component.title">
  65. <xsl:with-param name="node" select="ancestor-or-self::chapter[1]"/>
  66. </xsl:call-template>
  67. </fo:block>
  68. </xsl:template>
  69. <!-- Margins -->
  70. <xsl:param name="page.margin.inner">0.5in</xsl:param>
  71. <xsl:param name="page.margin.outer">0.375in</xsl:param>
  72. <xsl:param name="body.start.indent" select="'0.7pc'"/>
  73. <xsl:param name="title.margin.left">-0.7pc</xsl:param>
  74. <xsl:attribute-set name="normal.para.spacing">
  75. <xsl:attribute name="space-before.optimum">0.6em</xsl:attribute>
  76. <xsl:attribute name="space-before.minimum">0.4em</xsl:attribute>
  77. <xsl:attribute name="space-before.maximum">0.8em</xsl:attribute>
  78. </xsl:attribute-set>
  79. <xsl:attribute-set name="list.block.spacing">
  80. <xsl:attribute name="space-before.optimum">0.6em</xsl:attribute>
  81. <xsl:attribute name="space-before.minimum">0.4em</xsl:attribute>
  82. <xsl:attribute name="space-before.maximum">0.8em</xsl:attribute>
  83. <xsl:attribute name="space-after.optimum">0.6em</xsl:attribute>
  84. <xsl:attribute name="space-after.minimum">0.4em</xsl:attribute>
  85. <xsl:attribute name="space-after.maximum">0.8em</xsl:attribute>
  86. </xsl:attribute-set>
  87. <xsl:attribute-set name="list.item.spacing">
  88. <xsl:attribute name="space-before.optimum">0.6em</xsl:attribute>
  89. <xsl:attribute name="space-before.minimum">0.4em</xsl:attribute>
  90. <xsl:attribute name="space-before.maximum">0.8em</xsl:attribute>
  91. </xsl:attribute-set>
  92. <xsl:attribute-set name="verbatim.properties">
  93. <xsl:attribute name="space-before.optimum">0.6em</xsl:attribute>
  94. <xsl:attribute name="space-before.minimum">0.4em</xsl:attribute>
  95. <xsl:attribute name="space-before.maximum">0.8em</xsl:attribute>
  96. <xsl:attribute name="space-after.optimum">0.6em</xsl:attribute>
  97. <xsl:attribute name="space-after.minimum">0.4em</xsl:attribute>
  98. <xsl:attribute name="space-after.maximum">0.8em</xsl:attribute>
  99. </xsl:attribute-set>
  100. <!-- Others-->
  101. <xsl:param name="header.rule" select="0"></xsl:param>
  102. <xsl:param name="footer.rule" select="0"></xsl:param>
  103. <xsl:param name="marker.section.level" select="-1"></xsl:param>
  104. <xsl:attribute-set name="compact.list.item.spacing">
  105. <xsl:attribute name="space-before.optimum">0.6em</xsl:attribute>
  106. <xsl:attribute name="space-before.minimum">0.4em</xsl:attribute>
  107. <xsl:attribute name="space-before.maximum">0.8em</xsl:attribute>
  108. </xsl:attribute-set>
  109. <!-- Dropping a blank page -->
  110. <xsl:template name="book.titlepage.separator"/>
  111. </xsl:stylesheet>