changebars.xsl 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. <?xml version="1.0"?>
  2. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  3. version="1.0">
  4. <!-- ********************************************************************
  5. $Id: changebars.xsl 9286 2012-04-19 10:10:58Z bobstayton $
  6. ********************************************************************
  7. This file is part of the XSL DocBook Stylesheet distribution.
  8. See ../README or http://docbook.sf.net/release/xsl/current/ for
  9. copyright and other information.
  10. ******************************************************************** -->
  11. <!-- ==================================================================== -->
  12. <xsl:import href="docbook.xsl"/>
  13. <xsl:param name="show.revisionflag" select="'1'"/>
  14. <xsl:template name="system.head.content">
  15. <xsl:param name="node" select="."/>
  16. <style type="text/css">
  17. <xsl:text>
  18. div.added { background-color: #ffff99;
  19. text-decoration: underline; }
  20. div.deleted { text-decoration: line-through;
  21. background-color: #FF7F7F; }
  22. div.changed { background-color: #99ff99; }
  23. div.off { }
  24. span.added { background-color: #ffff99;
  25. text-decoration: underline; }
  26. span.deleted { text-decoration: line-through;
  27. background-color: #FF7F7F; }
  28. span.changed { background-color: #99ff99; }
  29. span.off { }
  30. </xsl:text>
  31. </style>
  32. </xsl:template>
  33. <xsl:template match="*[@revisionflag]">
  34. <xsl:call-template name="block.or.inline.revision"/>
  35. </xsl:template>
  36. <xsl:template name="block.or.inline.revision">
  37. <xsl:param name="revisionflag" select="@revisionflag"/>
  38. <xsl:choose>
  39. <xsl:when test="local-name(.) = 'para'
  40. or local-name(.) = 'formalpara'
  41. or local-name(.) = 'simpara'
  42. or local-name(.) = 'simplesect'
  43. or local-name(.) = 'section'
  44. or local-name(.) = 'sect1'
  45. or local-name(.) = 'sect2'
  46. or local-name(.) = 'sect3'
  47. or local-name(.) = 'sect4'
  48. or local-name(.) = 'sect5'
  49. or local-name(.) = 'topic'
  50. or local-name(.) = 'chapter'
  51. or local-name(.) = 'preface'
  52. or local-name(.) = 'itemizedlist'
  53. or local-name(.) = 'orderedlist'
  54. or local-name(.) = 'variablelist'
  55. or local-name(.) = 'varlistentry'
  56. or local-name(.) = 'informaltable'
  57. or local-name(.) = 'informalexample'
  58. or local-name(.) = 'note'
  59. or local-name(.) = 'example'
  60. or local-name(.) = 'mediaobject'
  61. or local-name(.) = 'sidebar'
  62. or local-name(.) = 'glossary'
  63. or local-name(.) = 'glossentry'
  64. or local-name(.) = 'bibliography'
  65. or local-name(.) = 'index'
  66. or local-name(.) = 'appendix'">
  67. <div class='{$revisionflag}'>
  68. <xsl:apply-imports/>
  69. </div>
  70. </xsl:when>
  71. <xsl:when test="local-name(.) = 'phrase'
  72. or local-name(.) = 'ulink'
  73. or local-name(.) = 'link'
  74. or local-name(.) = 'olink'
  75. or local-name(.) = 'inlinemediaobject'
  76. or local-name(.) = 'filename'
  77. or local-name(.) = 'literal'
  78. or local-name(.) = 'member'
  79. or local-name(.) = 'term'
  80. or local-name(.) = 'guilabel'
  81. or local-name(.) = 'glossterm'
  82. or local-name(.) = 'sgmltag'
  83. or local-name(.) = 'tag'
  84. or local-name(.) = 'quote'
  85. or local-name(.) = 'emphasis'
  86. or local-name(.) = 'command'
  87. or local-name(.) = 'xref'">
  88. <span class='{$revisionflag}'>
  89. <xsl:apply-imports/>
  90. </span>
  91. </xsl:when>
  92. <xsl:when test="local-name(.) = 'listitem'
  93. or local-name(.) = 'entry'
  94. or local-name(.) = 'title'">
  95. <!-- nop; these are handled directly in the stylesheet -->
  96. <xsl:apply-imports/>
  97. </xsl:when>
  98. <xsl:otherwise>
  99. <xsl:message>
  100. <xsl:text>Revisionflag on unexpected element: </xsl:text>
  101. <xsl:value-of select="local-name(.)"/>
  102. <xsl:text> (Assuming block)</xsl:text>
  103. </xsl:message>
  104. <div class='{$revisionflag}'>
  105. <xsl:apply-imports/>
  106. </div>
  107. </xsl:otherwise>
  108. </xsl:choose>
  109. </xsl:template>
  110. </xsl:stylesheet>