RSUpgradeRepeater.xsl 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  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:repeater">
  13. <repeaterTable>
  14. <!-- originalRefQuery is used by the property list adjuster and will be removed later on. -->
  15. <xsl:attribute name="originalRefQuery"><xsl:value-of select="@refQuery"/></xsl:attribute>
  16. <!-- Start of repeaterTable attributes. -->
  17. <xsl:variable name="var_refQuery" select="@refQuery"/>
  18. <xsl:variable name="var_beringRefQuery">
  19. <xsl:call-template name="getQueryTemplate">
  20. <xsl:with-param name="refQuery" select="$var_refQuery"/>
  21. </xsl:call-template>
  22. </xsl:variable>
  23. <xsl:attribute name="refQuery"><xsl:value-of select="$var_beringRefQuery"/></xsl:attribute>
  24. <xsl:if test="count(@across) = 1">
  25. <xsl:attribute name="across"><xsl:value-of select="@across"/></xsl:attribute>
  26. </xsl:if>
  27. <xsl:if test="count(@down) = 1">
  28. <xsl:attribute name="down"><xsl:value-of select="@down"/></xsl:attribute>
  29. </xsl:if>
  30. <xsl:if test="count(@direction) = 1">
  31. <xsl:attribute name="direction"><xsl:value-of select="@direction"/></xsl:attribute>
  32. </xsl:if>
  33. <xsl:call-template name="addStyle"/>
  34. <xsl:if test="count(@id) = 1">
  35. <xsl:attribute name="name"><xsl:value-of select="@id"/></xsl:attribute>
  36. </xsl:if>
  37. <xsl:if test="count(@repeatEveryPage) = 1">
  38. <xsl:attribute name="repeatEveryPage"><xsl:value-of select="@repeatEveryPage"/></xsl:attribute>
  39. </xsl:if>
  40. <xsl:if test="count(@shareResultSet) = 1">
  41. <xsl:attribute name="shareResultSet"><xsl:value-of select="@shareResultSet"/></xsl:attribute>
  42. </xsl:if>
  43. <!-- End of repeaterTable attributes. -->
  44. <xsl:call-template name="generateMasterDetailLinks2">
  45. <xsl:with-param name="p_frame" select="."/>
  46. </xsl:call-template>
  47. <xsl:apply-templates select="baltic:repeaterBody"/>
  48. <!-- The structure of the V5 repeaterTable grouping is derived from the V4 Cube Dimension Levels. -->
  49. <xsl:apply-templates select="/baltic:report/baltic:querySet/baltic:BIQuery[@name=$var_refQuery]" mode="repeater">
  50. <xsl:with-param name="p_refLevel" select="@refLevel"/>
  51. </xsl:apply-templates>
  52. <xsl:call-template name="simpleLayoutGroupTemplate"/>
  53. <xsl:variable name="v_cube">
  54. <xsl:call-template name="getCube">
  55. <xsl:with-param name="p_queryName" select="$var_refQuery"/>
  56. </xsl:call-template>
  57. </xsl:variable>
  58. <xsl:element name="propertyList"/>
  59. </repeaterTable>
  60. </xsl:template>
  61. <xsl:template match="baltic:repeaterBody">
  62. <repeaterTableCell>
  63. <xsl:call-template name="addStyle"/>
  64. <xsl:call-template name="layoutContainerTemplate"/>
  65. </repeaterTableCell>
  66. </xsl:template>
  67. <!-- Start of templates that generate repeaterGroups. -->
  68. <xsl:template match="/baltic:report/baltic:querySet/baltic:BIQuery" mode="repeater">
  69. <xsl:param name="p_refLevel" select="''"/>
  70. <xsl:variable name="var_cube">
  71. <xsl:call-template name="getCubeOrCubeReference"/>
  72. </xsl:variable>
  73. <xsl:variable name="var_repeaterGroups">
  74. <xsl:choose>
  75. <xsl:when test="$p_refLevel != ''">
  76. <xsl:for-each select="$var_cube/baltic:cube/baltic:dimension/baltic:level[@name=$p_refLevel]/preceding-sibling::baltic:level">
  77. <xsl:apply-templates select="." mode="repeater"/>
  78. </xsl:for-each>
  79. <xsl:apply-templates select="$var_cube/baltic:cube/baltic:dimension/baltic:level[@name=$p_refLevel]" mode="repeater"/>
  80. </xsl:when>
  81. </xsl:choose>
  82. </xsl:variable>
  83. <xsl:if test="$var_repeaterGroups/*">
  84. <repeaterGroups>
  85. <xsl:copy-of select="$var_repeaterGroups"/>
  86. </repeaterGroups>
  87. </xsl:if>
  88. <!-- Generate the sortList from the baltic:cube/baltic:factList/baltic:item sort attributes. -->
  89. <!-- Also, if there is no level specified, also generate the sortList from the baltic:cube/baltic:dimension/baltic:level/baltic:item sort attributes. -->
  90. <sortList>
  91. <xsl:choose>
  92. <xsl:when test="$p_refLevel != ''">
  93. <xsl:apply-templates select="$var_cube/baltic:cube/baltic:factList/baltic:item" mode="generate_sortItems"/>
  94. </xsl:when>
  95. <xsl:otherwise>
  96. <xsl:apply-templates select="$var_cube/baltic:cube/baltic:dimension/baltic:level/baltic:item" mode="generate_sortItems"/>
  97. <xsl:apply-templates select="$var_cube/baltic:cube/baltic:factList/baltic:item" mode="generate_sortItems"/>
  98. </xsl:otherwise>
  99. </xsl:choose>
  100. </sortList>
  101. </xsl:template>
  102. <xsl:template match="baltic:cube/baltic:dimension/baltic:level" mode="repeater">
  103. <xsl:param name="p_repeater"/>
  104. <xsl:variable name="var_refLevel" select="@name"/>
  105. <xsl:variable name="v_refDataItem">
  106. <xsl:call-template name="getKeyItemNameForLevel"/>
  107. </xsl:variable>
  108. <xsl:choose>
  109. <xsl:when test="$v_refDataItem='ERROR: Cannot find item or dataItem for the level referenced.'">
  110. <xsl:comment>
  111. <xsl:call-template name="logError2">
  112. <xsl:with-param name="p_msgId" select="'RSU_SPC_LEVEL_KEYITEM_MISSING'"/>
  113. <xsl:with-param name="p_param1" select="'pageGroup'"/>
  114. <xsl:with-param name="p_param2" select="$var_refLevel"/>
  115. </xsl:call-template>
  116. </xsl:comment>
  117. </xsl:when>
  118. <xsl:otherwise>
  119. <repeaterGroup refDataItem="{$v_refDataItem}">
  120. <!-- Generate sortList from the baltic:item sort attributes up to this level in the current dimension. -->
  121. <sortList>
  122. <xsl:apply-templates select="baltic:item" mode="generate_sortItems"/>
  123. </sortList>
  124. <xsl:element name="propertyList"/>
  125. </repeaterGroup>
  126. </xsl:otherwise>
  127. </xsl:choose>
  128. </xsl:template>
  129. <!-- End of templates that generate repeaterGroups. -->
  130. </xsl:stylesheet>