RSUpgradeStyle.xsl 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3. Licensed Materials - Property of IBM
  4. IBM Cognos Products: rspecupgrade
  5. (C) Copyright IBM Corp. 2005, 2010
  6. US Government Users Restricted Rights - Use, duplication or disclosure
  7. restricted by GSA ADP Schedule Contract with IBM Corp.
  8. -->
  9. <!-- COPYRIGHT_DATA { 'YEAR':[2005, 2009], 'RELEASE':['colorado_wave1'], 'VISIBLE':'YES', 'COMPONENT':'rspecupgrade' }-->
  10. <!--All lines above the COPYRIGHT_DATA line will be replaced when copyright notices are generated. -->
  11. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:baltic="http://developer.cognos.com/schemas/report/1/" xmlns="http://developer.cognos.com/schemas/report/2.0/" xmlns:date="http://exslt.org/dates-and-times" xmlns:exsl="http://exslt.org/common" xmlns:xalan="http://xml.apache.org/xalan" xmlns:java="http://xml.apache.org/xalan/java" extension-element-prefixes="xalan date exsl" exclude-result-prefixes="xalan java baltic date exsl">
  12. <xsl:template match="baltic:conditionalStyle">
  13. <xsl:param name="p_recursive"/>
  14. <xsl:if test="baltic:style/@refVariableValue">
  15. <conditionalStyles>
  16. <conditionalStyleCases refVariable="{@refVariable}">
  17. <xsl:apply-templates select="baltic:style[@refVariableValue]">
  18. <xsl:with-param name="p_recursive" select="$p_recursive"/>
  19. </xsl:apply-templates>
  20. </conditionalStyleCases>
  21. <conditionalStyleDefault>
  22. <xsl:apply-templates select="baltic:style[not(@refVariableValue)]">
  23. <xsl:with-param name="p_recursive" select="$p_recursive"/>
  24. </xsl:apply-templates>
  25. </conditionalStyleDefault>
  26. </conditionalStyles>
  27. </xsl:if>
  28. </xsl:template>
  29. <xsl:template match="baltic:style[not(@refVariableValue)]">
  30. <xsl:param name="p_recursive"/>
  31. <xsl:param name="p_addValue" select="''"/>
  32. <xsl:param name="p_prependValue" select="''"/>
  33. <style>
  34. <!-- NOTE: The refStyle attribute of the V4 style element was never supported, so it is dropped in v5. -->
  35. <xsl:call-template name="formatGroupTemplate">
  36. <xsl:with-param name="p_recursive" select="$p_recursive"/>
  37. </xsl:call-template>
  38. <xsl:choose>
  39. <xsl:when test="baltic:CSS">
  40. <xsl:apply-templates select="baltic:CSS">
  41. <xsl:with-param name="p_addValue" select="$p_addValue"/>
  42. <xsl:with-param name="p_prependValue" select="$p_prependValue"/>
  43. </xsl:apply-templates>
  44. </xsl:when>
  45. <xsl:otherwise>
  46. <xsl:choose>
  47. <xsl:when test="$p_addValue != ''">
  48. <CSS>
  49. <xsl:attribute name="value"><xsl:value-of select="$p_addValue"/></xsl:attribute>
  50. </CSS>
  51. </xsl:when>
  52. <xsl:when test="$p_prependValue != ''">
  53. <CSS>
  54. <xsl:attribute name="value"><xsl:value-of select="$p_prependValue"/></xsl:attribute>
  55. </CSS>
  56. </xsl:when>
  57. </xsl:choose>
  58. </xsl:otherwise>
  59. </xsl:choose>
  60. </style>
  61. </xsl:template>
  62. <xsl:template match="baltic:conditionalStyle/baltic:style[not(@refVariableValue)]">
  63. <xsl:param name="p_recursive"/>
  64. <!-- NOTE: The refStyle attribute of the V4 style element was never supported, so it is dropped in v5. -->
  65. <xsl:call-template name="formatGroupTemplate">
  66. <xsl:with-param name="p_recursive" select="$p_recursive"/>
  67. </xsl:call-template>
  68. <xsl:apply-templates select="baltic:CSS"/>
  69. </xsl:template>
  70. <xsl:template match="baltic:style[@refVariableValue]">
  71. <xsl:param name="p_recursive"/>
  72. <xsl:param name="p_addValue" select="''"/>
  73. <xsl:param name="p_prependValue" select="''"/>
  74. <conditionalStyle refVariableValue="{@refVariableValue}">
  75. <!-- NOTE: The refStyle attribute of the V4 style element was never supported, so it is dropped in v5. -->
  76. <xsl:call-template name="formatGroupTemplate">
  77. <xsl:with-param name="p_recursive" select="$p_recursive"/>
  78. </xsl:call-template>
  79. <xsl:choose>
  80. <xsl:when test="baltic:CSS">
  81. <xsl:apply-templates select="baltic:CSS">
  82. <xsl:with-param name="p_addValue" select="$p_addValue"/>
  83. <xsl:with-param name="p_prependValue" select="$p_prependValue"/>
  84. </xsl:apply-templates>
  85. </xsl:when>
  86. <xsl:otherwise>
  87. <xsl:choose>
  88. <xsl:when test="$p_addValue != ''">
  89. <CSS>
  90. <xsl:attribute name="value"><xsl:value-of select="$p_addValue"/></xsl:attribute>
  91. </CSS>
  92. </xsl:when>
  93. <xsl:when test="$p_prependValue != ''">
  94. <CSS>
  95. <xsl:attribute name="value"><xsl:value-of select="$p_prependValue"/></xsl:attribute>
  96. </CSS>
  97. </xsl:when>
  98. </xsl:choose>
  99. </xsl:otherwise>
  100. </xsl:choose>
  101. </conditionalStyle>
  102. </xsl:template>
  103. <xsl:template match="baltic:XMLAttribute">
  104. <XMLAttribute>
  105. <xsl:attribute name="name"><xsl:value-of select="@name"/></xsl:attribute>
  106. <xsl:attribute name="value"><xsl:value-of select="@value"/></xsl:attribute>
  107. <xsl:if test="@render">
  108. <xsl:attribute name="render"><xsl:value-of select="@render"/></xsl:attribute>
  109. </xsl:if>
  110. </XMLAttribute>
  111. </xsl:template>
  112. <xsl:template match="baltic:CSS">
  113. <xsl:param name="p_addValue" select="''"/>
  114. <xsl:param name="p_prependValue" select="''"/>
  115. <CSS>
  116. <xsl:attribute name="value">
  117. <xsl:if test="$p_prependValue != ''"><xsl:value-of select="$p_prependValue"/>;</xsl:if>
  118. <xsl:value-of select="@value"/>
  119. <xsl:if test="$p_addValue != ''">;<xsl:value-of select="$p_addValue"/></xsl:if>
  120. </xsl:attribute>
  121. </CSS>
  122. </xsl:template>
  123. <xsl:template name="checkRefVariableTemplate">
  124. <xsl:param name="p_cur" select="."/>
  125. <xsl:variable name="v_refVariable" select="$p_cur/@refVariable"/>
  126. <xsl:if test="/baltic:report/baltic:variableList/baltic:variable[@name=$v_refVariable]">true</xsl:if>
  127. </xsl:template>
  128. </xsl:stylesheet>