lfs-sections.xsl 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  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 how sections are handled -->
  6. <!-- Force sect1 onto a new page -->
  7. <xsl:attribute-set name="section.level1.properties">
  8. <xsl:attribute name="break-before">
  9. <xsl:choose>
  10. <xsl:when test="not(. = //*/sect1[1])">
  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. <!-- sect2:
  20. Skip sect2.titlepage run when title is empty.
  21. Removed unused code. -->
  22. <!-- The original template is in {docbook-xsl}/fo/sections.xsl -->
  23. <xsl:template match="sect2">
  24. <xsl:variable name="id">
  25. <xsl:call-template name="object.id"/>
  26. </xsl:variable>
  27. <fo:block xsl:use-attribute-sets="section.level2.properties">
  28. <xsl:attribute name="id">
  29. <xsl:value-of select="$id"/>
  30. </xsl:attribute>
  31. <xsl:if test="not(string-length(title)=0)">
  32. <xsl:call-template name="sect2.titlepage"/>
  33. </xsl:if>
  34. <xsl:apply-templates/>
  35. </fo:block>
  36. </xsl:template>
  37. </xsl:stylesheet>