lfs-pagesetup.xsl 4.7 KB

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