flagging.xsl 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  1. <?xml version='1.0' encoding="UTF-8"?>
  2. <!--
  3. Copyright © 2009 by Suite Solutions, Ltd. All rights reserved.
  4. All other trademarks are the property of their respective owners.
  5. Suite Solutions, Ltd. IS DELIVERING THE SOFTWARE "AS IS," WITH
  6. ABSOLUTELY NO WARRANTIES WHATSOEVER, WHETHER EXPRESS OR IMPLIED, AND IDIOM
  7. TECHNOLOGIES, INC. DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING
  8. BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  9. PURPOSE AND WARRANTY OF NON-INFRINGEMENT. IDIOM TECHNOLOGIES, INC. SHALL NOT
  10. BE LIABLE FOR INDIRECT, INCIDENTAL, SPECIAL, COVER, PUNITIVE, EXEMPLARY,
  11. RELIANCE, OR CONSEQUENTIAL DAMAGES (INCLUDING BUT NOT LIMITED TO LOSS OF
  12. ANTICIPATED PROFIT), ARISING FROM ANY CAUSE UNDER OR RELATED TO OR ARISING
  13. OUT OF THE USE OF OR INABILITY TO USE THE SOFTWARE, EVEN IF Suite Solutions, Ltd.
  14. HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
  15. Suite Solutions, Ltd. and its licensors shall not be liable for any
  16. damages suffered by any person as a result of using and/or modifying the
  17. Software or its derivatives. In no event shall Suite Solutions, Ltd.'s
  18. liability for any damages hereunder exceed the amounts received by Suite Solutions, Ltd, Inc.
  19. as a result of this transaction.
  20. These terms and conditions supersede the terms and conditions in any
  21. licensing agreement to the extent that such terms and conditions conflict
  22. with those set forth herein.
  23. This file is part of the DITA Open Toolkit project hosted on Sourceforge.net.
  24. See the accompanying license.txt file for applicable licenses.
  25. -->
  26. <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  27. xmlns:opentopic-func="http://www.idiominc.com/opentopic/exsl/function"
  28. xmlns:fo="http://www.w3.org/1999/XSL/Format"
  29. xmlns:dita2xslfo="http://dita-ot.sourceforge.net/ns/200910/dita2xslfo"
  30. xmlns:suitesol="http://suite-sol.com/namespaces/mapcounts"
  31. exclude-result-prefixes="suitesol opentopic-func dita2xslfo">
  32. <xsl:template match="suitesol:flagging-inside">
  33. <xsl:call-template name="parseFlagStyle">
  34. <xsl:with-param name="value">
  35. <xsl:value-of select="@style"/>
  36. </xsl:with-param>
  37. </xsl:call-template>
  38. </xsl:template>
  39. <xsl:template match="suitesol:changebar-start">
  40. <fo:change-bar-begin>
  41. <xsl:attribute name="change-bar-class">
  42. <xsl:text>dv</xsl:text>
  43. <xsl:value-of select="@id" />
  44. </xsl:attribute>
  45. <!--
  46. change-bar-color
  47. change-bar-offset
  48. change-bar-placement= start | end | left | right | inside | outside | alternate
  49. change-bar-style = none | hidden | dotted | dashed | solid | double | groove | ridge | inset | outset
  50. change-bar-width
  51. -->
  52. <xsl:call-template name="parseChangeBarStyle">
  53. <xsl:with-param name="value">
  54. <xsl:value-of select="@changebar"/>
  55. </xsl:with-param>
  56. </xsl:call-template>
  57. </fo:change-bar-begin>
  58. </xsl:template>
  59. <xsl:template name="parseChangeBarStyle">
  60. <xsl:param name="value"/>
  61. <xsl:choose>
  62. <xsl:when test="$value = ''"/>
  63. <xsl:when test="contains($value,';')">
  64. <xsl:variable name="firstValue" select="substring-before($value,';')"/>
  65. <xsl:call-template name="outputChangeBarStyle">
  66. <xsl:with-param name="value">
  67. <xsl:value-of select="$firstValue"/>
  68. </xsl:with-param>
  69. </xsl:call-template>
  70. <xsl:call-template name="parseChangeBarStyle">
  71. <xsl:with-param name="value" select="substring-after($value,';')"/>
  72. </xsl:call-template>
  73. </xsl:when>
  74. <xsl:otherwise>
  75. <xsl:call-template name="outputChangeBarStyle">
  76. <xsl:with-param name="value">
  77. <xsl:value-of select="$value"/>
  78. </xsl:with-param>
  79. </xsl:call-template>
  80. </xsl:otherwise>
  81. </xsl:choose>
  82. </xsl:template>
  83. <xsl:template name="outputChangeBarStyle">
  84. <xsl:param name="value"/>
  85. <xsl:choose>
  86. <xsl:when test="$value = ''"/>
  87. <xsl:when test="contains($value,':')">
  88. <xsl:variable name="attr" select="substring-before($value,':')"/>
  89. <xsl:variable name="val" select="substring-after($value,':')"/>
  90. <!--
  91. change-bar-color
  92. change-bar-offset
  93. change-bar-placement= start | end | left | right | inside | outside | alternate
  94. change-bar-style = none | hidden | dotted | dashed | solid | double | groove | ridge | inset | outset
  95. change-bar-width
  96. -->
  97. <xsl:choose>
  98. <xsl:when test="$attr='color'">
  99. <xsl:attribute name="change-bar-color">
  100. <xsl:value-of select="$val"/>
  101. </xsl:attribute>
  102. </xsl:when>
  103. <xsl:when test="$attr='offset'">
  104. <xsl:attribute name="change-bar-offset">
  105. <xsl:value-of select="$val"/>
  106. </xsl:attribute>
  107. </xsl:when>
  108. <xsl:when test="$attr='placement'">
  109. <xsl:attribute name="change-bar-placement">
  110. <xsl:value-of select="$val"/>
  111. </xsl:attribute>
  112. </xsl:when>
  113. <xsl:when test="$attr='style'">
  114. <xsl:attribute name="change-bar-style">
  115. <xsl:value-of select="$val"/>
  116. </xsl:attribute>
  117. </xsl:when>
  118. <xsl:when test="$attr='width'">
  119. <xsl:attribute name="change-bar-width">
  120. <xsl:value-of select="$val"/>
  121. </xsl:attribute>
  122. </xsl:when>
  123. </xsl:choose>
  124. </xsl:when>
  125. <xsl:otherwise>
  126. <!-- do nothing -->
  127. </xsl:otherwise>
  128. </xsl:choose>
  129. </xsl:template>
  130. <xsl:template match="suitesol:changebar-end">
  131. <fo:change-bar-end>
  132. <xsl:attribute name="change-bar-class">
  133. <xsl:text>dv</xsl:text>
  134. <xsl:value-of select="@id" />
  135. </xsl:attribute>
  136. </fo:change-bar-end>
  137. </xsl:template>
  138. <xsl:template name="parseFlagStyle">
  139. <xsl:param name="value"/>
  140. <xsl:choose>
  141. <xsl:when test="$value = ''"/>
  142. <xsl:when test="contains($value,';')">
  143. <xsl:variable name="firstValue" select="substring-before($value,';')"/>
  144. <xsl:call-template name="outputFlagStyle">
  145. <xsl:with-param name="value">
  146. <xsl:value-of select="$firstValue"/>
  147. </xsl:with-param>
  148. </xsl:call-template>
  149. <xsl:call-template name="parseFlagStyle">
  150. <xsl:with-param name="value" select="substring-after($value,';')"/>
  151. </xsl:call-template>
  152. </xsl:when>
  153. <xsl:otherwise>
  154. <xsl:call-template name="outputFlagStyle">
  155. <xsl:with-param name="value">
  156. <xsl:value-of select="$value"/>
  157. </xsl:with-param>
  158. </xsl:call-template>
  159. </xsl:otherwise>
  160. </xsl:choose>
  161. </xsl:template>
  162. <xsl:template name="outputFlagStyle">
  163. <xsl:param name="value"/>
  164. <xsl:choose>
  165. <xsl:when test="$value = ''"/>
  166. <xsl:when test="contains($value,':')">
  167. <xsl:variable name="attr" select="substring-before($value,':')"/>
  168. <xsl:variable name="val" select="substring-after($value,':')"/>
  169. <xsl:attribute name="{$attr}">
  170. <xsl:value-of select="$val"/>
  171. </xsl:attribute>
  172. </xsl:when>
  173. <xsl:otherwise>
  174. <!-- do nothing -->
  175. </xsl:otherwise>
  176. </xsl:choose>
  177. </xsl:template>
  178. <xsl:template match="suitesol:flagging-outside">
  179. <fo:block>
  180. <xsl:call-template name="parseFlagStyle">
  181. <xsl:with-param name="value">
  182. <xsl:value-of select="@style"/>
  183. </xsl:with-param>
  184. </xsl:call-template>
  185. <xsl:apply-templates />
  186. </fo:block>
  187. </xsl:template>
  188. <xsl:template match="suitesol:flagging-outside-inline" priority="10">
  189. <fo:inline>
  190. <xsl:call-template name="parseFlagStyle">
  191. <xsl:with-param name="value">
  192. <xsl:value-of select="@style"/>
  193. </xsl:with-param>
  194. </xsl:call-template>
  195. <xsl:apply-templates />
  196. </fo:inline>
  197. </xsl:template>
  198. </xsl:stylesheet>