parseURL.xslt 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3. Licensed Materials - Property of IBM
  4. BI and PM: qs
  5. (C) Copyright IBM Corp. 2001, 2017
  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:pf="http://developer.cognos.com/schemas/xts/pf"
  16. xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt"
  17. exclude-result-prefixes="xsl xts pf xtsext">
  18. <xsl:output method="xml" encoding="UTF-8" indent="no"/>
  19. <xsl:template match="/root/env">
  20. <xts:sequence>
  21. <xts:replace select="/root/env/param[@name='m_name' or @name='ui.name']"><param name="ui.name"><xsl:value-of select="/root/env/param[@name='m_name' or @name='ui.name']"/></param></xts:replace>
  22. <xts:replace select="/root/env/param[@name='format' or @name='ui.format']"><param name="ui.format"><xsl:value-of select="/root/env/param[@name='format' or @name='ui.format']"/></param></xts:replace>
  23. <xts:replace select="/root/env/param[@name='drillThroughTargetParameterValues' or @name='ui.drillThroughTargetParameterValues']"><param name="ui.drillThroughTargetParameterValues"><xsl:value-of select="/root/env/param[@name='drillThroughTargetParameterValues' or @name='ui.drillThroughTargetParameterValues']"/></param></xts:replace>
  24. <xts:replace select="/root/env/param[@name='xslURL' or @name='run.xslURL']"><param name="run.xslURL"><xsl:value-of select="/root/env/param[@name='xslURL' or @name='run.xslURL']"/></param></xts:replace>
  25. <xts:replace select="/root/env/param[@name='prompt' or @name='run.prompt']"><param name="run.prompt"><xsl:value-of select="/root/env/param[@name='prompt' or @name='run.prompt']"/></param></xts:replace>
  26. <xts:replace select="/root/env/param[@name='primaryWaitThreshold' or @name='async.primaryWaitThreshold']"><param name="async.primaryWaitThreshold"><xsl:value-of select="/root/env/param[@name='primaryWaitThreshold' or @name='async.primaryWaitThreshold']"/></param></xts:replace>
  27. <xts:replace select="/root/env/param[@name='secondaryWaitThreshold' or @name='async.secondaryWaitThreshold']"><param name="async.secondaryWaitThreshold"><xsl:value-of select="/root/env/param[@name='secondaryWaitThreshold' or @name='async.secondaryWaitThreshold']"/></param></xts:replace>
  28. <xts:replace select="/root/env/param[@name='backURL' or @name='ui.backURL']"><param name="ui.backURL"><xsl:value-of select="/root/env/param[@name='backURL' or @name='ui.backURL']"/></param></xts:replace>
  29. <xts:replace select="/root/env/param[@name='errURL' or @name='ui.errURL']"><param name="ui.errURL"><xsl:value-of select="/root/env/param[@name='errURL' or @name='ui.errURL']"/></param></xts:replace>
  30. <xts:replace select="/root/env/param[@name='data' or @name='run.data']"><param name="run.data"><xsl:value-of select="/root/env/param[@name='data' or @name='run.data']"/></param></xts:replace>
  31. <xts:replace select="/root/env/param[@name='outputPageDefinition' or @name='run.outputPageDefinition']"><param name="run.outputPageDefinition"><xsl:value-of select="/root/env/param[@name='outputPageDefinition' or @name='run.outputPageDefinition']"/></param></xts:replace>
  32. <xts:replace select="/root/env/param[@name='outputPageOrientation' or @name='run.outputPageOrientation']"><param name="run.outputPageOrientation"><xsl:value-of select="/root/env/param[@name='outputPageOrientation' or @name='run.outputPageOrientation']"/></param></xts:replace>
  33. <xts:replace select="/root/env/param[@name='recordingEnabled' or @name='run.recordingEnabled']"><param name="run.recordingEnabled"><xsl:value-of select="/root/env/param[@name='recordingEnabled' or @name='run.recordingEnabled']"/></param></xts:replace>
  34. <xts:replace select="/root/env/param[@name='horizontalElements' or @name='run.horizontalElements']"><param name="run.horizontalElements"><xsl:value-of select="/root/env/param[@name='horizontalElements' or @name='run.horizontalElements']"/></param></xts:replace>
  35. <xts:replace select="/root/env/param[@name='verticalElements' or @name='run.verticalElements']"><param name="run.verticalElements"><xsl:value-of select="/root/env/param[@name='verticalElements' or @name='run.verticalElements']"/></param></xts:replace>
  36. <xts:replace select="/root/env/param[@name='attachmentEncoding' or @name='run.attachmentEncoding']"><param name="run.attachmentEncoding"><xsl:value-of select="/root/env/param[@name='attachmentEncoding' or @name='run.attachmentEncoding']"/></param></xts:replace>
  37. <xts:replace select="/root/env/param[@name='sh' or @name='ui.sh']"><param name="ui.sh"><xsl:value-of select="/root/env/param[@name='sh' or @name='ui.sh']"/></param></xts:replace>
  38. <xts:replace select="/root/env/param[@name='bm' or @name='ui.bookmark']"><param name="ui.bookmark"><xsl:value-of select="/root/env/param[@name='bm' or @name='ui.bookmark']"/></param></xts:replace>
  39. <xts:replace select="/root/env/param[@name='un' or @name='ui.username']"><param name="ui.username"><xsl:value-of select="/root/env/param[@name='un' or @name='ui.username']"/></param></xts:replace>
  40. <xts:replace select="/root/env/param[@name='cafcontextid' or @name='ui.cafcontextid']"><param name="ui.cafcontextid"><xsl:value-of select="/root/env/param[@name='cafcontextid' or @name='ui.cafcontextid']"/></param></xts:replace>
  41. <xts:replace select="/root/env/param[@name='markup_track']"><param name="markup_track"><xsl:value-of select="/root/env/param[@name='markup_track']"/></param></xts:replace>
  42. <xts:replace select="/root/env/param[@name='ui.action' or @name='method']">
  43. <param name="ui.action">
  44. <xsl:choose>
  45. <xsl:when test="string(/root/env/param[@name='ui.action' or @name='method'])='run'">execute</xsl:when>
  46. <xsl:when test="string(/root/env/param[@name='ui.action' or @name='method'])='newQuery'">new</xsl:when>
  47. <xsl:when test="string(/root/env/param[@name='ui.action' or @name='method'])='editQuery'">edit</xsl:when>
  48. <xsl:otherwise><xsl:value-of select="/root/env/param[@name='ui.action' or @name='method']"/></xsl:otherwise>
  49. </xsl:choose>
  50. </param>
  51. </xts:replace>
  52. <xts:replace select="/root/env/param[@name='ui.object' or @name='m_obj' or @name='obj']">
  53. <param name="ui.object">
  54. <xsl:choose>
  55. <xsl:when test="starts-with(string(/root/env/param[@name='ui.object' or @name='m_obj' or @name='obj']),'CAF')">
  56. <xsl:value-of select="xtsext:web64decode(xtsext:cafaction('sign_unwrap', string(/root/env/param[@name='ui.object' or @name='m_obj' or @name='obj'])), true())"/>
  57. </xsl:when>
  58. <xsl:otherwise>
  59. <xsl:value-of select="xtsext:web64decode(/root/env/param[@name='ui.object' or @name='m_obj' or @name='obj'],true())"/>
  60. </xsl:otherwise>
  61. </xsl:choose>
  62. </param>
  63. </xts:replace>
  64. <xts:replace select="/root/env/param[@name='ui.cacheContext']">
  65. <param name="ui.cacheContext">
  66. <xsl:choose>
  67. <xsl:when test="starts-with(string(/root/env/param[@name='ui.cacheContext']),'CAF')">
  68. <xsl:value-of select="xtsext:web64decode(xtsext:cafaction('sign_unwrap', string(/root/env/param[@name='ui.cacheContext'])), true())"/>
  69. </xsl:when>
  70. <xsl:otherwise>
  71. <xsl:value-of select="xtsext:web64decode(/root/env/param[@name='ui.cacheContext'],true())"/>
  72. </xsl:otherwise>
  73. </xsl:choose>
  74. </param>
  75. </xts:replace>
  76. <xts:replace select="/root/env/param[@name='conversation' or @name='ui.conversation']">
  77. <param name="ui.conversation">
  78. <xsl:choose>
  79. <xsl:when test="starts-with(string(/root/env/param[@name='conversation' or @name='ui.conversation']),'CAF')">
  80. <xsl:value-of select="xtsext:web64decode(xtsext:cafaction('sign_unwrap', string(/root/env/param[@name='conversation' or @name='ui.conversation'])), true())"/>
  81. </xsl:when>
  82. <xsl:otherwise>
  83. <xsl:value-of select="xtsext:web64decode(/root/env/param[@name='conversation' or @name='ui.conversation'],true())"/>
  84. </xsl:otherwise>
  85. </xsl:choose>
  86. </param>
  87. </xts:replace>
  88. <xts:replace select="/root/env/param[@name='inlineSpec' or @name='ui.spec']">
  89. <param name="ui.spec">
  90. <xsl:choose>
  91. <xsl:when test="starts-with(string(/root/env/param[@name='inlineSpec' or @name='ui.spec']),'CAF')">
  92. <xsl:value-of select="xtsext:web64decode(xtsext:cafaction('sign_unwrap', string(/root/env/param[@name='inlineSpec' or @name='ui.spec'])), true())"/>
  93. </xsl:when>
  94. <xsl:otherwise>
  95. <xsl:value-of select="xtsext:web64decode(/root/env/param[@name='inlineSpec' or @name='ui.spec'],true())"/>
  96. </xsl:otherwise>
  97. </xsl:choose>
  98. </param>
  99. </xts:replace>
  100. <xts:replace select="/root/env/param[@name='m_path' or @name='ui.folder']">
  101. <param name="ui.folder">
  102. <xsl:choose>
  103. <xsl:when test="starts-with(string(/root/env/param[@name='m_path' or @name='ui.folder']),'CAF')">
  104. <xsl:value-of select="xtsext:web64decode(xtsext:cafaction('sign_unwrap', string(/root/env/param[@name='m_path' or @name='ui.folder'])), true())"/>
  105. </xsl:when>
  106. <xsl:otherwise>
  107. <xsl:value-of select="xtsext:web64decode(/root/env/param[@name='m_path' or @name='ui.folder'],true())"/>
  108. </xsl:otherwise>
  109. </xsl:choose>
  110. </param>
  111. </xts:replace>
  112. <xts:replace select="/root/env/param[@name='ui.gateway' or @name='gateway' or @name='gatewayURI']">
  113. <param name="ui.gateway">
  114. <xsl:value-of select="/root/env/param[@name='ui.gateway' or @name='gateway' or @name='gatewayURI']"/>
  115. </param>
  116. </xts:replace>
  117. <xts:replace select="/root/env/param[@name='run.outputFormat' or @name='ui.outputFormat' or @name='outputFormat']">
  118. <param name="run.outputFormat">
  119. <xsl:value-of select="/root/env/param[@name='run.outputFormat' or @name='ui.outputFormat' or @name='outputFormat']"/>
  120. </param>
  121. </xts:replace>
  122. <xts:replace select="/root/env/param[@name='ui.debug' or @name='debug' or @name='d']">
  123. <xsl:variable name="v" select="/root/env/param[@name='ui.debug' or @name='debug' or @name='d']"/>
  124. <param name="ui.debug">
  125. <xsl:choose>
  126. <xsl:when test="$v='1' or $v='true'">true</xsl:when>
  127. <xsl:otherwise>false</xsl:otherwise>
  128. </xsl:choose>
  129. </param>
  130. </xts:replace>
  131. <xts:replace select="/root/env/param[@name='ui.header' or @name='nh']">
  132. <param name="ui.header">
  133. <xsl:choose>
  134. <xsl:when test="/root/env/param[@name='nh']">false</xsl:when>
  135. <xsl:otherwise><xsl:value-of select="/root/env/param[@name='ui.header']"/></xsl:otherwise>
  136. </xsl:choose>
  137. </param>
  138. </xts:replace>
  139. <xts:replace select="/root/env/param[@name='ui.toolbar' or @name='tb']">
  140. <param name="ui.toolbar">
  141. <xsl:choose>
  142. <xsl:when test="/root/env/param[@name='tb']='1'">true</xsl:when>
  143. <xsl:when test="/root/env/param[@name='tb']='0'">false</xsl:when>
  144. <xsl:otherwise><xsl:value-of select="/root/env/param[@name='ui.toolbar']"/></xsl:otherwise>
  145. </xsl:choose>
  146. </param>
  147. </xts:replace>
  148. </xts:sequence>
  149. </xsl:template>
  150. <pf:serialize-xml/>
  151. </xsl:stylesheet>