rvlogic.xsl 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3. Licensed Materials - Property of IBM
  4. IBM Cognos Products: Viewer
  5. (C) Copyright IBM Corp. 2001, 2014
  6. US Government Users Restricted Rights - Use, duplication or
  7. disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  8. -->
  9. <xsl:stylesheet version="1.0"
  10. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  11. xmlns:rvl="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/rv/rvlogic/"
  12. xmlns:out="dummy-uri"
  13. xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt"
  14. xmlns:xts="http://developer.cognos.com/schemas/xts/"
  15. exclude-result-prefixes="xsl rvl xtsext xts">
  16. <xsl:output method="xml" encoding="UTF-8" indent="no"/>
  17. <xsl:namespace-alias stylesheet-prefix="out" result-prefix="xsl"/>
  18. <xsl:template match="rvl:drillThruForm">
  19. <!-- drill thru form -->
  20. <form name="stackForm" id="stackForm" method="post" style="margin:0px">
  21. <out:variable name="stack-idx">
  22. <out:value-of select="count( /root/env/param[ starts-with( @name, 'rvstack_' ) ] )"/>
  23. </out:variable>
  24. <out:variable name="stack-name" select="concat( 'rvstack_', $stack-idx )"/>
  25. <out:if test="$status = 'complete'">
  26. <input type="hidden">
  27. <out:attribute name="name"><out:value-of select="$stack-name"/></out:attribute>
  28. <out:attribute name="value">
  29. <out:variable name="envParams">
  30. <out:choose>
  31. <out:when test="/root/env/param[@name='ui.action']='view'">
  32. <out:text>&lt;param name="ui.action"&gt;view&lt;/param&gt;</out:text>
  33. </out:when>
  34. <out:otherwise>
  35. <out:text>&lt;param name="ui.action"&gt;currentPage&lt;/param&gt;</out:text>
  36. <out:text>&lt;param name="ui.conversation"&gt;</out:text>
  37. <out:variable name="markup-conv">
  38. <out:call-template name="serialize-xml">
  39. <out:with-param name="node-set" select="$conversation"/>
  40. </out:call-template>
  41. </out:variable>
  42. <out:value-of select="xtsext:cafaction(concat('sign_wrap_setpassportid_', $passport), xtsext:web64encode(string($markup-conv), true()))"/>
  43. <out:text>&lt;/param&gt;</out:text>
  44. <out:text>&lt;param name="m_tracking"&gt;</out:text>
  45. <out:variable name="markup-tracking">
  46. <out:call-template name="serialize-xml">
  47. <out:with-param name="node-set" select="/root/response/SOAP-ENV:Envelope/SOAP-ENV:Header/bus:biBusHeader/bus:tracking/*[local-name() = 'conversationContext']"/>
  48. </out:call-template>
  49. </out:variable>
  50. <out:value-of select="xtsext:cafaction(concat('sign_wrap_setpassportid_', $passport), xtsext:web64encode(string($markup-tracking), true()))"/>
  51. <out:text>&lt;/param&gt;</out:text>
  52. </out:otherwise>
  53. </out:choose>
  54. <out:for-each select="/root/env/*[@name='ui.name' or @name='ui.format' or @name='ui.object' or @name='session_prompts' or @name='run.outputFormat' or @name='ui.spec']">
  55. <out:call-template name="serialize-xml">
  56. <out:with-param name="node-set" select="."/>
  57. </out:call-template>
  58. </out:for-each>
  59. </out:variable>
  60. <out:variable name="markup">
  61. <out:choose>
  62. <out:when test="$reportName != ''">reportName = '<out:value-of select="xtsext:javascriptencode(string($reportName))"/>';</out:when>
  63. <out:otherwise>reportName = '<xts:string id="RV_PREVIOUS_REPORT" encode="javascript"/>';</out:otherwise>
  64. </out:choose>
  65. stackIdx = '<out:value-of select="xtsext:javascriptencode(string($stack-idx))"/>';
  66. envParams='<out:value-of select="xtsext:javascriptencode(string($envParams))"/>';
  67. </out:variable>
  68. <out:value-of select="xtsext:cafaction(concat('sign_wrap_setpassportid_', $passport), xtsext:web64encode( string( $markup ), true()))"/>
  69. </out:attribute>
  70. </input>
  71. </out:if>
  72. </form>
  73. </xsl:template>
  74. <xsl:template match="rvl:selectChoices">
  75. <out:text>&lt;selectChoices </out:text>
  76. <out:variable name="name" select="./@name"/>
  77. <out:variable name="drillTargetLabel" select="../@label"/>
  78. <out:text>propertyToPass=&quot;</out:text>
  79. <out:choose>
  80. <out:when test="string(./@propertyToPass) != ''">
  81. <out:value-of select="./@propertyToPass"/>
  82. </out:when>
  83. <out:when test="/root/drillSpecs/DRILLS/DRILL[@label = string($drillTargetLabel)]/PARAMETER-PROPERTIES/Parameter[@name=string($name)]/@propertyToPass != ''">
  84. <out:value-of select="xtsext:xmlencode(string(/root/drillSpecs/DRILLS/DRILL[@label = string($drillTargetLabel)]/PARAMETER-PROPERTIES/Parameter[@name=string($name)]/@propertyToPass))"/>
  85. </out:when>
  86. </out:choose>
  87. <out:text>&quot;&gt;</out:text>
  88. <out:choose>
  89. <!--when selectChoices element is passed through, it's has already been xml encoded, so don't double encode it -->
  90. <out:when test="starts-with(normalize-space(string(./@value)), '&lt;selectChoices&gt;')">
  91. <out:value-of select="substring-after(./@value, '&lt;selectChoices&gt;')"/>
  92. </out:when>
  93. <out:otherwise>
  94. <out:choose>
  95. <out:when test="./@value!=''">
  96. <out:text>&lt;selectOption </out:text>
  97. <out:text>useValue=&quot;</out:text>
  98. <out:choose>
  99. <out:when test="./@mun != ''"><out:value-of select="xtsext:xmlencode(string(./@mun))"/></out:when>
  100. <out:otherwise><out:value-of select="xtsext:xmlencode(string(./@value))"/></out:otherwise>
  101. </out:choose>
  102. <out:text>&quot; </out:text>
  103. <out:text>displayValue=&quot;</out:text>
  104. <out:choose>
  105. <out:when test="./@mun"><out:value-of select="xtsext:xmlencode(string(./@value))"/></out:when>
  106. <out:when test="./@displayValue"><out:value-of select="xtsext:xmlencode(string(./@displayValue))"/></out:when>
  107. <out:otherwise><out:value-of select="xtsext:xmlencode(string(./@value))"/></out:otherwise>
  108. </out:choose>
  109. <out:text>&quot;</out:text>
  110. <out:if test="./@mun">
  111. <out:text> mun=&quot;</out:text><out:value-of select="xtsext:xmlencode(string(./@mun))"/><out:text>&quot;</out:text>
  112. </out:if>
  113. <out:text>/&gt;</out:text>
  114. <out:text>&lt;/selectChoices&gt;</out:text>
  115. </out:when>
  116. <out:otherwise><out:text>&lt;/selectChoices&gt;</out:text></out:otherwise>
  117. </out:choose>
  118. </out:otherwise>
  119. </out:choose>
  120. </xsl:template>
  121. <xsl:template match="rvl:selectChoicesNil">
  122. <out:text>&lt;selectChoices/&gt;</out:text>
  123. </xsl:template>
  124. <!-- the main engine -->
  125. <xsl:template match="*">
  126. <xsl:copy>
  127. <xsl:copy-of select="@*"/>
  128. <xsl:apply-templates/>
  129. </xsl:copy>
  130. </xsl:template>
  131. </xsl:stylesheet>