chunk-changebars.xsl 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  2. xmlns:exsl="http://exslt.org/common"
  3. xmlns:cf="http://docbook.sourceforge.net/xmlns/chunkfast/1.0"
  4. version="1.0"
  5. exclude-result-prefixes="exsl cf">
  6. <!-- ********************************************************************
  7. $Id: chunk-changebars.xsl 8399 2009-04-08 07:37:42Z bobstayton $
  8. ********************************************************************
  9. This file is part of the XSL DocBook Stylesheet distribution.
  10. See ../README or http://docbook.sf.net/release/xsl/current/ for
  11. copyright and other information.
  12. ******************************************************************** -->
  13. <!-- ==================================================================== -->
  14. <!-- This file is a variant of chunk.xsl, to be used for generating chunked
  15. output with highlighting based on change markup. -->
  16. <xsl:import href="changebars.xsl"/>
  17. <xsl:import href="chunk-common.xsl"/>
  18. <!-- This customization of "process-chunk-element" is needed in order to make change
  19. highlighting be inherited by chunked children of an element with change markup. -->
  20. <xsl:template name="process-chunk-element">
  21. <xsl:param name="content">
  22. <xsl:choose>
  23. <xsl:when test="ancestor-or-self::*[@revisionflag] and $show.revisionflag != 0">
  24. <xsl:variable name="revisionflag" select="ancestor-or-self::*[@revisionflag][1]/@revisionflag" />
  25. <xsl:call-template name="block.or.inline.revision">
  26. <xsl:with-param name="revisionflag" select="$revisionflag"/>
  27. </xsl:call-template>
  28. </xsl:when>
  29. <xsl:otherwise>
  30. <xsl:apply-imports/>
  31. </xsl:otherwise>
  32. </xsl:choose>
  33. </xsl:param>
  34. <xsl:choose>
  35. <xsl:when test="$chunk.fast != 0 and $exsl.node.set.available != 0">
  36. <xsl:variable name="chunks" select="exsl:node-set($chunk.hierarchy)//cf:div"/>
  37. <xsl:variable name="genid" select="generate-id()"/>
  38. <xsl:variable name="div" select="$chunks[@id=$genid or @xml:id=$genid]"/>
  39. <xsl:variable name="prevdiv"
  40. select="($div/preceding-sibling::cf:div|$div/preceding::cf:div|$div/parent::cf:div)[last()]"/>
  41. <xsl:variable name="prev" select="key('genid', ($prevdiv/@id|$prevdiv/@xml:id)[1])"/>
  42. <xsl:variable name="nextdiv"
  43. select="($div/following-sibling::cf:div|$div/following::cf:div|$div/cf:div)[1]"/>
  44. <xsl:variable name="next" select="key('genid', ($nextdiv/@id|$nextdiv/@xml:id)[1])"/>
  45. <xsl:choose>
  46. <xsl:when test="$onechunk != 0 and parent::*">
  47. <xsl:copy-of select="$content"/>
  48. </xsl:when>
  49. <xsl:otherwise>
  50. <xsl:call-template name="process-chunk">
  51. <xsl:with-param name="prev" select="$prev"/>
  52. <xsl:with-param name="next" select="$next"/>
  53. <xsl:with-param name="content" select="$content"/>
  54. </xsl:call-template>
  55. </xsl:otherwise>
  56. </xsl:choose>
  57. </xsl:when>
  58. <xsl:otherwise>
  59. <xsl:choose>
  60. <xsl:when test="$onechunk != 0 and not(parent::*)">
  61. <xsl:call-template name="chunk-all-sections">
  62. <xsl:with-param name="content" select="$content"/>
  63. </xsl:call-template>
  64. </xsl:when>
  65. <xsl:when test="$onechunk != 0">
  66. <xsl:copy-of select="$content"/>
  67. </xsl:when>
  68. <xsl:when test="$chunk.first.sections = 0">
  69. <xsl:call-template name="chunk-first-section-with-parent">
  70. <xsl:with-param name="content" select="$content"/>
  71. </xsl:call-template>
  72. </xsl:when>
  73. <xsl:otherwise>
  74. <xsl:call-template name="chunk-all-sections">
  75. <xsl:with-param name="content" select="$content"/>
  76. </xsl:call-template>
  77. </xsl:otherwise>
  78. </xsl:choose>
  79. </xsl:otherwise>
  80. </xsl:choose>
  81. </xsl:template>
  82. <xsl:include href="chunk-code.xsl"/>
  83. </xsl:stylesheet>