fop1.xsl 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. <?xml version='1.0'?>
  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. <xsl:template match="*" mode="fop1.outline">
  6. <xsl:apply-templates select="*" mode="fop1.outline"/>
  7. </xsl:template>
  8. <xsl:template match="set|book|part|reference|
  9. preface|chapter|appendix|article
  10. |glossary|bibliography|index|setindex
  11. |refentry
  12. |sect1|sect2|sect3|sect4|sect5|section"
  13. mode="fop1.outline">
  14. <xsl:variable name="id">
  15. <xsl:call-template name="object.id"/>
  16. </xsl:variable>
  17. <xsl:variable name="bookmark-label">
  18. <xsl:apply-templates select="." mode="object.title.markup"/>
  19. </xsl:variable>
  20. <!-- Put the root element bookmark at the same level as its children -->
  21. <!-- If the object is a set or book, generate a bookmark for the toc -->
  22. <xsl:choose>
  23. <xsl:when test="parent::*">
  24. <fo:bookmark internal-destination="{$id}">
  25. <fo:bookmark-title>
  26. <xsl:value-of select="normalize-space(translate($bookmark-label, $a-dia, $a-asc))"/>
  27. </fo:bookmark-title>
  28. <xsl:apply-templates select="*" mode="fop1.outline"/>
  29. </fo:bookmark>
  30. </xsl:when>
  31. <xsl:otherwise>
  32. <fo:bookmark internal-destination="{$id}">
  33. <fo:bookmark-title>
  34. <xsl:value-of select="normalize-space(translate($bookmark-label, $a-dia, $a-asc))"/>
  35. </fo:bookmark-title>
  36. </fo:bookmark>
  37. <xsl:variable name="toc.params">
  38. <xsl:call-template name="find.path.params">
  39. <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
  40. </xsl:call-template>
  41. </xsl:variable>
  42. <xsl:if test="contains($toc.params, 'toc')
  43. and (book|part|reference|preface|chapter|appendix|article
  44. |glossary|bibliography|index|setindex
  45. |refentry
  46. |sect1|sect2|sect3|sect4|sect5|section)">
  47. <fo:bookmark internal-destination="toc...{$id}">
  48. <fo:bookmark-title>
  49. <xsl:call-template name="gentext">
  50. <xsl:with-param name="key" select="'TableofContents'"/>
  51. </xsl:call-template>
  52. </fo:bookmark-title>
  53. </fo:bookmark>
  54. </xsl:if>
  55. <xsl:apply-templates select="*" mode="fop1.outline"/>
  56. </xsl:otherwise>
  57. </xsl:choose>
  58. <!--
  59. <fo:bookmark internal-destination="{$id}"/>
  60. -->
  61. </xsl:template>
  62. </xsl:stylesheet>