parseURL.xslt 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. <!--
  2. Licensed Materials - Property of IBM
  3. IBM Cognos Products: Viewer
  4. (C) Copyright IBM Corp. 2001, 2011
  5. US Government Users Restricted Rights - Use, duplication or
  6. disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  7. -->
  8. <xsl:stylesheet version="1.0"
  9. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  10. xmlns:xts="http://developer.cognos.com/schemas/xts/"
  11. exclude-result-prefixes="xsl xts">
  12. <xsl:output method="xml" encoding="UTF-8" indent="no"/>
  13. <xsl:template match="/root/env">
  14. <xts:sequence>
  15. <xts:replace select="/root/env/param[@name='inlineSpec' or @name='ui.spec']"><param name="ui.spec"><xsl:value-of select="/root/env/param[@name='inlineSpec' or @name='ui.spec']"/></param></xts:replace>
  16. <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>
  17. <xts:replace select="/root/env/param[@name='conversation' or @name='ui.conversation']"><param name="ui.conversation"><xsl:value-of select="/root/env/param[@name='conversation' or @name='ui.conversation']"/></param></xts:replace>
  18. <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>
  19. <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>
  20. <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>
  21. <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>
  22. <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>
  23. <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>
  24. <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>
  25. <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>
  26. <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>
  27. <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>
  28. <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>
  29. <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>
  30. <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>
  31. <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>
  32. <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>
  33. <xts:replace select="/root/env/param[@name='m_path' or @name='ui.folder']"><param name="ui.folder"><xsl:value-of select="/root/env/param[@name='m_path' or @name='ui.folder']"/></param></xts:replace>
  34. <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>
  35. <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>
  36. <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>
  37. <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>
  38. <xts:replace select="/root/env/param[@name='outputLocale' or @name='ui.outputLocale']"><param name="run.outputLocale"><xsl:value-of select="/root/env/param[@name='outputLocale' or @name='ui.outputLocale']"/></param></xts:replace>
  39. <xts:replace select="/root/env/param[@name='ui.action' or @name='method']">
  40. <param name="ui.action">
  41. <xsl:choose>
  42. <xsl:when test="string(/root/env/param[@name='ui.action' or @name='method'])='execute'">run</xsl:when>
  43. <xsl:otherwise><xsl:value-of select="/root/env/param[@name='ui.action' or @name='method']"/></xsl:otherwise>
  44. </xsl:choose>
  45. </param>
  46. </xts:replace>
  47. <xts:delete select="/root/env/param[@name='ui.object' or @name='m_obj' or @name='obj']"/>
  48. <xts:append select="/root/env">
  49. <xsl:choose>
  50. <xsl:when test="/root/env/param[@name='ui.object']">
  51. <param name="ui.object"><xsl:value-of select="/root/env/param[@name='ui.object']"/></param>
  52. </xsl:when>
  53. <xsl:when test="/root/env/param[@name='m_obj']">
  54. <param name="ui.object"><xsl:value-of select="/root/env/param[@name='m_obj']"/></param>
  55. </xsl:when>
  56. <xsl:when test="/root/env/param[@name='obj']">
  57. <param name="ui.object"><xsl:value-of select="/root/env/param[@name='obj']"/></param>
  58. </xsl:when>
  59. </xsl:choose>
  60. </xts:append>
  61. <xts:replace select="/root/env/param[@name='ui.gateway' or @name='gateway' or @name='gatewayURI']">
  62. <param name="ui.gateway">
  63. <xsl:value-of select="/root/env/param[@name='ui.gateway' or @name='gateway' or @name='gatewayURI']"/>
  64. </param>
  65. </xts:replace>
  66. <xts:replace select="/root/env/param[@name='run.outputFormat' or @name='ui.outputFormat' or @name='outputFormat']">
  67. <param name="run.outputFormat">
  68. <xsl:value-of select="/root/env/param[@name='run.outputFormat' or @name='ui.outputFormat' or @name='outputFormat']"/>
  69. </param>
  70. </xts:replace>
  71. <xts:replace select="/root/env/param[@name='ui.debug' or @name='debug' or @name='d']">
  72. <xsl:variable name="v" select="/root/env/param[@name='ui.debug' or @name='debug' or @name='d']"/>
  73. <param name="ui.debug">
  74. <xsl:choose>
  75. <xsl:when test="$v='1' or $v='true'">true</xsl:when>
  76. <xsl:otherwise>false</xsl:otherwise>
  77. </xsl:choose>
  78. </param>
  79. </xts:replace>
  80. <xts:replace select="/root/env/param[@name='cv.header' or @name='ui.header' or @name='nh']">
  81. <param name="cv.header">
  82. <xsl:choose>
  83. <xsl:when test="/root/env/param[@name='nh']='0'">true</xsl:when>
  84. <xsl:when test="/root/env/param[@name='nh']">false</xsl:when>
  85. <xsl:when test="/root/env/param[@name='ui.header']"><xsl:value-of select="/root/env/param[@name='ui.header']"/></xsl:when>
  86. <xsl:otherwise><xsl:value-of select="/root/env/param[@name='cv.header']"/></xsl:otherwise>
  87. </xsl:choose>
  88. </param>
  89. </xts:replace>
  90. <xts:replace select="/root/env/param[@name='cv.toolbar' or @name='ui.toolbar' or @name='tb']">
  91. <param name="cv.toolbar">
  92. <xsl:choose>
  93. <xsl:when test="/root/env/param[@name='tb']='1'">true</xsl:when>
  94. <xsl:when test="/root/env/param[@name='tb']='0'">false</xsl:when>
  95. <xsl:when test="/root/env/param[@name='ui.toolbar']"><xsl:value-of select="/root/env/param[@name='ui.toolbar']"/></xsl:when>
  96. <xsl:otherwise><xsl:value-of select="/root/env/param[@name='cv.toolbar']"/></xsl:otherwise>
  97. </xsl:choose>
  98. </param>
  99. </xts:replace>
  100. <xts:replace select="/root/env/param[@name='cv.navlinks' or @name='ui.navlinks' or @name='nl']">
  101. <param name="cv.navlinks">
  102. <xsl:choose>
  103. <xsl:when test="/root/env/param[@name='nl']='1'">true</xsl:when>
  104. <xsl:when test="/root/env/param[@name='nl']='0'">false</xsl:when>
  105. <xsl:when test="/root/env/param[@name='ui.navlinks']"><xsl:value-of select="/root/env/param[@name='ui.navlinks']"/></xsl:when>
  106. <xsl:otherwise><xsl:value-of select="/root/env/param[@name='cv.navlinks']"/></xsl:otherwise>
  107. </xsl:choose>
  108. </param>
  109. </xts:replace>
  110. <xsl:choose>
  111. <xsl:when test="not(/root/env/param[@name='cv.id']) or /root/env/param[@name='cv.id']=''">
  112. <xts:delete select="/root/env/param[@name='cv.id']"/>
  113. <xts:append select="/root/env">
  114. <xsl:variable name="cvTempId"><xsl:value-of select="generate-id()"/></xsl:variable>
  115. <param name="cv.id"><xsl:value-of select="$cvTempId"/></param>
  116. </xts:append>
  117. </xsl:when>
  118. <xsl:otherwise>
  119. <xts:append select="/root/env">
  120. </xts:append>
  121. </xsl:otherwise>
  122. </xsl:choose>
  123. <xsl:if test="string(/root/env/param[@name='specificationType'])='Analysis'">
  124. <xts:replace select="/root/env/param[@name='specificationType']">
  125. <param name="specificationType">reportServiceAnalysisSpecification</param>
  126. </xts:replace>
  127. </xsl:if>
  128. </xts:sequence>
  129. </xsl:template>
  130. </xsl:stylesheet>