setParameters.xslt 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  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. 2011
  6. US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  7. -->
  8. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  9. xmlns:bus="http://developer.cognos.com/schemas/bibus/3/"
  10. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  11. xmlns:xs="http://www.w3.org/2001/XMLSchema"
  12. xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
  13. xmlns:SOAP-ENV="http://www.w3.org/2001/09/soap-envelope"
  14. SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
  15. <xsl:output method="xml" version="1.0" encoding="UTF-8"/>
  16. <xsl:template name="SetParameters">
  17. <bus:parameterValues xsi:type="bus:parameterValueArray" SOAP-ENC:arrayType="bus:parameterValue[]">
  18. <xsl:for-each select="/root/PromptValues/PromptValue">
  19. <item>
  20. <bus:name xsi:type="xs:string"><xsl:value-of select="@name"/></bus:name>
  21. <bus:value xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="bus:parmValueItem[]">
  22. <xsl:if test="not(./selectChoices)">
  23. <!-- could be a ambiguous prompt or a prompt which isn't mandatory -->
  24. <xsl:for-each select=".">
  25. <xsl:choose>
  26. <!-- deal with ambiguous connections and signons -->
  27. <xsl:when test="string(.) != ''">
  28. <item xsi:type="bus:simpleParmValueItem">
  29. <bus:inclusive xsi:type="xs:boolean">true</bus:inclusive>
  30. <bus:display xsi:type="xs:string"><xsl:value-of select="."/></bus:display>
  31. <bus:use xsi:type="xs:string"><xsl:value-of select="."/></bus:use>
  32. </item>
  33. </xsl:when>
  34. <xsl:otherwise>
  35. <item xsi:type="bus:simpleParmValueItem" xsi:nil="true"/>
  36. </xsl:otherwise>
  37. </xsl:choose>
  38. </xsl:for-each>
  39. </xsl:if>
  40. <xsl:for-each select="./selectChoices/selectOption">
  41. <item xsi:type="bus:simpleParmValueItem">
  42. <bus:inclusive xsi:type="xs:boolean">true</bus:inclusive>
  43. <xsl:choose>
  44. <xsl:when test="@displayValue!=''">
  45. <bus:display xsi:type="xs:string"><xsl:value-of select="@displayValue"/></bus:display>
  46. </xsl:when>
  47. <xsl:otherwise>
  48. <bus:display xsi:nil="true"/>
  49. </xsl:otherwise>
  50. </xsl:choose>
  51. <xsl:choose>
  52. <xsl:when test="@useValue!=''">
  53. <bus:use xsi:type="xs:string"><xsl:value-of select="@useValue"/></bus:use>
  54. </xsl:when>
  55. <xsl:otherwise>
  56. <bus:use xsi:nil="true"/>
  57. </xsl:otherwise>
  58. </xsl:choose>
  59. </item>
  60. </xsl:for-each>
  61. <xsl:for-each select="./selectChoices/selectBoundRange">
  62. <item xsi:type="bus:boundRangeParmValueItem">
  63. <bus:inclusive xsi:type="xs:boolean">true</bus:inclusive>
  64. <bus:start xsi:type="bus:simpleParmValueItem">
  65. <bus:inclusive xsi:type="xs:boolean">true</bus:inclusive>
  66. <bus:display xsi:type="xs:string"><xsl:value-of select="./start/@displayValue"/></bus:display>
  67. <bus:use xsi:type="xs:string"><xsl:value-of select="./start/@useValue"/></bus:use>
  68. </bus:start>
  69. <bus:end xsi:type="bus:simpleParmValueItem">
  70. <bus:inclusive xsi:type="xs:boolean">true</bus:inclusive>
  71. <bus:display xsi:type="xs:string"><xsl:value-of select="./end/@displayValue"/></bus:display>
  72. <bus:use xsi:type="xs:string"><xsl:value-of select="./end/@useValue"/></bus:use>
  73. </bus:end>
  74. </item>
  75. </xsl:for-each>
  76. <xsl:for-each select="./selectChoices/selectUnboundedEndRange">
  77. <item xsi:type="bus:unboundedEndRangeParmValueItem">
  78. <bus:inclusive xsi:type="xs:boolean">true</bus:inclusive>
  79. <bus:start xsi:type="bus:simpleParmValueItem">
  80. <bus:inclusive xsi:type="xs:boolean">true</bus:inclusive>
  81. <bus:display xsi:type="xs:string"><xsl:value-of select="./start/@displayValue"/></bus:display>
  82. <bus:use xsi:type="xs:string"><xsl:value-of select="./start/@useValue"/></bus:use>
  83. </bus:start>
  84. </item>
  85. </xsl:for-each>
  86. <xsl:for-each select="./selectChoices/selectUnboundedStartRange">
  87. <item xsi:type="bus:unboundedStartRangeParmValueItem">
  88. <bus:inclusive xsi:type="xs:boolean">true</bus:inclusive>
  89. <bus:end xsi:type="bus:simpleParmValueItem">
  90. <bus:inclusive xsi:type="xs:boolean">true</bus:inclusive>
  91. <bus:display xsi:type="xs:string"><xsl:value-of select="./end/@displayValue"/></bus:display>
  92. <bus:use xsi:type="xs:string"><xsl:value-of select="./end/@useValue"/></bus:use>
  93. </bus:end>
  94. </item>
  95. </xsl:for-each>
  96. <xsl:for-each select="./selectChoices/selectTreeOption">
  97. <xsl:call-template name="selectTreeOption"/>
  98. </xsl:for-each>
  99. </bus:value>
  100. </item>
  101. </xsl:for-each>
  102. </bus:parameterValues>
  103. </xsl:template>
  104. <xsl:template name="selectTreeOption">
  105. <item xsi:type="bus:hierarchicalParmValueItem">
  106. <bus:inclusive xsi:type="xs:boolean">true</bus:inclusive>
  107. <value xsi:type="bus:simpleParmValueItem">
  108. <bus:inclusive xsi:type="xs:boolean">true</bus:inclusive>
  109. <bus:display xsi:type="xs:string"><xsl:value-of select="./@displayValue"/></bus:display>
  110. <bus:use xsi:type="xs:string"><xsl:value-of select="./@useValue"/></bus:use>
  111. </value>
  112. <xsl:choose>
  113. <xsl:when test="./selectTreeOption">
  114. <subNodes xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="bus:hierarchicalParmValueItem[]" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  115. <xsl:for-each select="./selectTreeOption">
  116. <xsl:call-template name="selectTreeOption"/>
  117. </xsl:for-each>
  118. </subNodes>
  119. </xsl:when>
  120. <xsl:otherwise>
  121. <subNodes xsi:nil="true"/>
  122. </xsl:otherwise>
  123. </xsl:choose>
  124. </item>
  125. </xsl:template>
  126. </xsl:stylesheet>