common.xslt 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3. Licensed Materials - Property of IBM
  4. IBM Cognos Products: ps
  5. (C) Copyright IBM Corp. 2005, 2011
  6. US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  7. -->
  8. <!--
  9. Copyright (C) 2008 Cognos ULC, an IBM Company. All rights reserved.
  10. Cognos (R) is a trademark of Cognos ULC, (formerly Cognos Incorporated).
  11. -->
  12. <xsl:stylesheet version="1.0"
  13. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  14. xmlns:xts="http://developer.cognos.com/schemas/xts/"
  15. xmlns:prt="http://developer.cognos.com/schemas/xts/iPrompting/logicsheets/common"
  16. xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt"
  17. xmlns:dp="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/dialog/presentation/"
  18. xmlns:out="dummy-uri"
  19. exclude-result-prefixes="xsl xts prt xtsext">
  20. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  21. <xsl:namespace-alias stylesheet-prefix="out" result-prefix="xsl"/>
  22. <xsl:template match="prt:javascripts">
  23. function cancel() {
  24. if ( document.formWarpRequest ) {
  25. if( window.timerID ) {
  26. clearTimeout(window.timerID);
  27. window.timerID=0;
  28. }
  29. document.formWarpRequest.method.value = 'cancel';
  30. document.formWarpRequest.submit();
  31. }
  32. }
  33. </xsl:template>
  34. <!--
  35. ===============================================================================================
  36. ut:renderValuePrompts
  37. ===============================================================================================
  38. -->
  39. <xsl:template match="prt:renderValuePrompts">
  40. <out:template match="*[local-name()='simpleParmValueItem']" mode="render-values">
  41. <out:choose>
  42. <out:when test="*[local-name()='display'] != ''">
  43. &#160;&apos;<out:value-of select="*[local-name()='display']"/>&apos;,
  44. </out:when>
  45. <out:when test="*[local-name()='use'] != ''">
  46. &#160;&apos;<out:value-of select="*[local-name()='use']"/>&apos;,
  47. </out:when>
  48. <out:otherwise>
  49. &#160;<xts:string id="IDS_VIEW_PROMPTS_NO_VALUE"/><xts:string id="IDS_LIST_SEPARATOR"/>
  50. </out:otherwise>
  51. </out:choose>
  52. </out:template>
  53. <out:template match="*[local-name()='simpleParmValueItem'][last()]" mode="render-values">
  54. <out:choose>
  55. <out:when test="*[local-name()='display'] != ''">
  56. &#160;&apos;<out:value-of select="*[local-name()='display']"/>&apos;<out:text/>
  57. </out:when>
  58. <out:when test="*[local-name()='use'] != ''">
  59. &#160;&apos;<out:value-of select="*[local-name()='use']"/>&apos;<out:text/>
  60. </out:when>
  61. <out:otherwise>
  62. &#160;<xts:string id="IDS_VIEW_PROMPTS_NO_VALUE"/><out:text/>
  63. </out:otherwise>
  64. </out:choose>
  65. <out:if test="not(position() = last())"><xts:string id="IDS_LIST_SEPARATOR"/></out:if>
  66. </out:template>
  67. <out:template match="*[local-name()='boundRangeParmValueItem' or local-name()='unboundedEndRangeParmValueItem' or local-name()='unboundedStartRangeParmValueItem']" mode="render-values">
  68. <out:variable name="startDisplay">
  69. <out:choose>
  70. <out:when test="*[local-name()='start']/*[local-name()='display'] != ''">
  71. <out:value-of select="*[local-name()='start']/*[local-name()='display']"/>
  72. </out:when>
  73. <out:otherwise>
  74. <out:value-of select="*[local-name()='start']/*[local-name()='use']"/>
  75. </out:otherwise>
  76. </out:choose>
  77. </out:variable>
  78. <out:variable name="endDisplay">
  79. <out:choose>
  80. <out:when test="*[local-name()='end']/*[local-name()='display'] != ''">
  81. <out:value-of select="*[local-name()='end']/*[local-name()='display']"/>
  82. </out:when>
  83. <out:otherwise>
  84. <out:value-of select="*[local-name()='end']/*[local-name()='use']"/>
  85. </out:otherwise>
  86. </out:choose>
  87. </out:variable>
  88. <out:choose>
  89. <out:when test="$startDisplay != '' and $endDisplay!=''">
  90. <out:choose>
  91. <out:when test="string($startDisplay) != string($endDisplay)">
  92. &#160;&apos;<xts:string id="IDS_OTHERRUN_BOUNDED_RANGE_VALUE">
  93. <xts:param name="startValue"><out:value-of select="$startDisplay"/></xts:param>
  94. <xts:param name="endValue"><out:value-of select="$endDisplay"/></xts:param>
  95. </xts:string>&apos;<out:text/>
  96. </out:when>
  97. <out:otherwise>
  98. &#160;&apos;<out:value-of select="$endDisplay"/>&apos;<out:text/>
  99. </out:otherwise>
  100. </out:choose>
  101. </out:when>
  102. <out:when test="$startDisplay != ''">
  103. &#160;&apos;<xts:string id="IDS_OTHERRUN_RANGED_START_PARAM_VALUE">
  104. <xts:param name="startValue"><out:value-of select="$startDisplay"/></xts:param>
  105. </xts:string>&apos;<out:text/>
  106. </out:when>
  107. <out:when test="$endDisplay != ''">
  108. &#160;&apos;<xts:string id="IDS_OTHERRUN_RANGED_END_PARAM_VALUE">
  109. <xts:param name="endValue"><out:value-of select="$endDisplay"/></xts:param>
  110. </xts:string>&apos;<out:text/>
  111. </out:when>
  112. <out:otherwise>
  113. &#160;<xts:string id="IDS_VIEW_PROMPTS_NO_VALUE"/>
  114. </out:otherwise>
  115. </out:choose>
  116. <out:if test="not(position() = last())"><xts:string id="IDS_LIST_SEPARATOR"/></out:if>
  117. </out:template>
  118. <out:template match="*[local-name()='hierarchicalParmValueItem']" mode="render-values">
  119. <out:param name="ancestorText" select="./*[local-name()='value']/*[local-name()='display']"/>
  120. <out:param name="position" select="'first'"/>
  121. <out:choose>
  122. <out:when test="*[local-name()='hierarchicalParmValueItem']">
  123. <out:for-each select="./*[local-name()='hierarchicalParmValueItem']">
  124. <out:variable name="pos">
  125. <out:choose>
  126. <out:when test="$position = 'first' and position() = '1'">first</out:when>
  127. <out:otherwise>not_first</out:otherwise>
  128. </out:choose>
  129. </out:variable>
  130. <out:apply-templates select="." mode="render-values">
  131. <out:with-param name="ancestorText" select="concat($ancestorText, ' &gt; ' ,*[local-name()='value']/*[local-name()='display'])"/>
  132. <out:with-param name="position" select="$pos"/>
  133. </out:apply-templates>
  134. </out:for-each>
  135. </out:when>
  136. <out:otherwise>
  137. <out:choose>
  138. <out:when test="$position='not_first'"><br/></out:when>
  139. <out:otherwise>&#160;</out:otherwise>
  140. </out:choose>
  141. <out:text>'</out:text>
  142. <out:value-of select="$ancestorText"/>
  143. <out:text>'</out:text>
  144. </out:otherwise>
  145. </out:choose>
  146. </out:template>
  147. <out:template match="text()" mode="render-values"/>
  148. </xsl:template>
  149. <!--
  150. ===============================================================================================
  151. ut:render-credential
  152. ===============================================================================================
  153. -->
  154. <xsl:template match="prt:renderCredentialPrompts">
  155. <out:template name="render-credential">
  156. <out:param name="credential" select="."/>
  157. <out:param name="pos"/>
  158. <out:variable name="dsConnections" select="/root/dataSources/cm:queryResponse/cm:queryReply/cm:dataSourceConnection"/>
  159. <xts:string id="IDS_VIEW_PROMPTS_DATASOUCE_CONNECTION">
  160. <xts:param name="datasource_name">
  161. <out:value-of select="$dsConnections[$pos]/cm:parent/cm:dataSource/cm:defaultName"/>
  162. </xts:param>
  163. <xts:param name="connection_name">
  164. <out:value-of select="$dsConnections[$pos]/cm:defaultName"/>
  165. </xts:param>
  166. </xts:string>
  167. <out:choose>
  168. <out:when test="$credential/dataSourceSignon != ''">
  169. <xsl:value-of select="' '"/>
  170. <xts:string id="IDS_VIEW_PROMPTS_DATASOURCE_SIGNON">
  171. <xts:param name="signon_name">
  172. <out:value-of select="$dsConnections[$pos]/../following-sibling::*[1]/cm:dataSourceSignon/cm:defaultName"/>
  173. </xts:param>
  174. </xts:string>
  175. </out:when>
  176. <out:when test="$credential/username != '' and $credential/password != ''">
  177. <out:variable name="signon_name">
  178. <xts:string id="IDS_VIEW_PROMPTS_USERID_PASSWORD"/>
  179. </out:variable>
  180. <xsl:value-of select="' '"/>
  181. <xts:string id="IDS_VIEW_PROMPTS_DATASOURCE_SIGNON">
  182. <xts:param name="signon_name">
  183. <out:value-of select="$signon_name"/>
  184. </xts:param>
  185. </xts:string>
  186. </out:when>
  187. <out:when test="$credential/username != ''">
  188. <out:variable name="signon_name">
  189. <xts:string id="IDS_VIEW_PROMPTS_USERID_ONLY"/>
  190. </out:variable>
  191. <xsl:value-of select="' '"/>
  192. <xts:string id="IDS_VIEW_PROMPTS_DATASOURCE_SIGNON">
  193. <xts:param name="signon_name">
  194. <out:value-of select="$signon_name"/>
  195. </xts:param>
  196. </xts:string>
  197. </out:when>
  198. <out:when test="$credential/password != ''">
  199. <out:variable name="signon_name">
  200. <xts:string id="IDS_VIEW_PROMPTS_PASSWORD_ONLY"/>
  201. </out:variable>
  202. <xsl:value-of select="' '"/>
  203. <xts:string id="IDS_VIEW_PROMPTS_DATASOURCE_SIGNON">
  204. <xts:param name="signon_name">
  205. <out:value-of select="$signon_name"/>
  206. </xts:param>
  207. </xts:string>
  208. </out:when>
  209. </out:choose>
  210. </out:template>
  211. </xsl:template>
  212. <xsl:template match="*">
  213. <xsl:copy>
  214. <xsl:copy-of select="@*"/>
  215. <xsl:apply-templates/>
  216. </xsl:copy>
  217. </xsl:template>
  218. </xsl:stylesheet>