lfs-pagesetup.xsl 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  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. <!-- Force section1's onto a new page -->
  6. <xsl:attribute-set name="section.level1.properties">
  7. <xsl:attribute name="break-after">
  8. <xsl:choose>
  9. <xsl:when test="not(position()=last())">
  10. <xsl:text>page</xsl:text>
  11. </xsl:when>
  12. <xsl:otherwise>
  13. <xsl:text>auto</xsl:text>
  14. </xsl:otherwise>
  15. </xsl:choose>
  16. </xsl:attribute>
  17. </xsl:attribute-set>
  18. <!-- Header -->
  19. <xsl:template name="header.content">
  20. <xsl:param name="sequence" select="''"/>
  21. <fo:block>
  22. <xsl:attribute name="text-align">
  23. <xsl:choose>
  24. <xsl:when test="$sequence = 'first' or $sequence = 'odd'">right</xsl:when>
  25. <xsl:otherwise>left</xsl:otherwise>
  26. </xsl:choose>
  27. </xsl:attribute>
  28. <xsl:value-of select="/book/bookinfo/title"/>
  29. <xsl:text> - </xsl:text>
  30. <xsl:value-of select="/book/bookinfo/subtitle"/>
  31. </fo:block>
  32. </xsl:template>
  33. <xsl:template name="header.table">
  34. <xsl:param name="sequence" select="''"/>
  35. <xsl:param name="gentext-key" select="''"/>
  36. <xsl:choose>
  37. <xsl:when test="$gentext-key = 'book' or $sequence = 'blank'"/>
  38. <xsl:otherwise>
  39. <xsl:call-template name="header.content">
  40. <xsl:with-param name="sequence" select="$sequence"/>
  41. </xsl:call-template>
  42. </xsl:otherwise>
  43. </xsl:choose>
  44. </xsl:template>
  45. <!-- Centered titles for book and part -->
  46. <xsl:template name="book.titlepage">
  47. <fo:block space-before="2in">
  48. <fo:block>
  49. <xsl:call-template name="book.titlepage.before.recto"/>
  50. <xsl:call-template name="book.titlepage.recto"/>
  51. </fo:block>
  52. <fo:block>
  53. <xsl:call-template name="book.titlepage.before.verso"/>
  54. <xsl:call-template name="book.titlepage.verso"/>
  55. </fo:block>
  56. <xsl:call-template name="book.titlepage.separator"/>
  57. </fo:block>
  58. </xsl:template>
  59. <xsl:template name="part.titlepage">
  60. <fo:block xmlns:fo="http://www.w3.org/1999/XSL/Format">
  61. <fo:block space-before="2.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. <!-- Margins -->
  73. <xsl:param name="page.margin.inner">1in</xsl:param>
  74. <xsl:param name="page.margin.outer">0.5in</xsl:param>
  75. <xsl:param name="title.margin.left">-1pc</xsl:param>
  76. <xsl:attribute-set name="normal.para.spacing">
  77. <xsl:attribute name="space-before.optimum">0.8em</xsl:attribute>
  78. <xsl:attribute name="space-before.minimum">0.6em</xsl:attribute>
  79. <xsl:attribute name="space-before.maximum">1em</xsl:attribute>
  80. </xsl:attribute-set>
  81. <xsl:attribute-set name="list.block.spacing">
  82. <xsl:attribute name="space-before.optimum">0.8em</xsl:attribute>
  83. <xsl:attribute name="space-before.minimum">0.6em</xsl:attribute>
  84. <xsl:attribute name="space-before.maximum">1em</xsl:attribute>
  85. <xsl:attribute name="space-after.optimum">0.8em</xsl:attribute>
  86. <xsl:attribute name="space-after.minimum">0.6em</xsl:attribute>
  87. <xsl:attribute name="space-after.maximum">1em</xsl:attribute>
  88. </xsl:attribute-set>
  89. <xsl:attribute-set name="list.item.spacing">
  90. <xsl:attribute name="space-before.optimum">0.6em</xsl:attribute>
  91. <xsl:attribute name="space-before.minimum">0.4em</xsl:attribute>
  92. <xsl:attribute name="space-before.maximum">0.8em</xsl:attribute>
  93. </xsl:attribute-set>
  94. <xsl:attribute-set name="verbatim.properties">
  95. <xsl:attribute name="space-before.minimum">0.6em</xsl:attribute>
  96. <xsl:attribute name="space-before.optimum">0.8em</xsl:attribute>
  97. <xsl:attribute name="space-before.maximum">1em</xsl:attribute>
  98. <xsl:attribute name="space-after.minimum">0.6em</xsl:attribute>
  99. <xsl:attribute name="space-after.optimum">0.8em</xsl:attribute>
  100. <xsl:attribute name="space-after.maximum">1em</xsl:attribute>
  101. </xsl:attribute-set>
  102. <!-- Others-->
  103. <xsl:param name="header.rule" select="0"></xsl:param>
  104. <xsl:param name="footer.rule" select="0"></xsl:param>
  105. <xsl:param name="marker.section.level" select="-1"></xsl:param>
  106. <!-- Dropping a blank page -->
  107. <xsl:template name="book.titlepage.separator"/>
  108. <!-- How render a variablelist -->
  109. <xsl:param name="variablelist.as.blocks" select="1"/>
  110. </xsl:stylesheet>