mergeModelParameters.xslt 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xtscm="http://developer.cognos.com/schemas/xts-cm/1/" xmlns:bus="http://developer.cognos.com/schemas/bibus/3/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xts="http://developer.cognos.com/schemas/xts/" xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt" exclude-result-prefixes="xts xtsext">
  2. <!--
  3. Licensed Materials - Property of IBM
  4. IBM Cognos Products: AGS
  5. (C) Copyright IBM Corp. 2005, 2009
  6. US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  7. -->
  8. <xsl:template match="/">
  9. <xts:sequence>
  10. <!-- go throught the rest of the parameters and decode their contents -->
  11. <xsl:for-each select="/root/env/param[starts-with(@name, 'pv_dz_')]">
  12. <xsl:variable name="param_name" select="substring-before(substring-after(@name, 'pv_dz_'), '_pv_dz')"/>
  13. <xsl:variable name="param_value" select="text()"/>
  14. <xsl:variable name="param_selection" select="concat('pv_cb_',$param_name,'_pv_cb')"/>
  15. <xsl:if test="$param_value and not($param_value = '')">
  16. <xsl:if test="/root/agent_item/parameterData/parameterAssignments/parameterAssignment[./parameterName = $param_name]">
  17. <xts:delete select="/root/agent_item/parameterData/parameterAssignments/parameterAssignment[./parameterName = '{$param_name}']" />
  18. </xsl:if>
  19. <xts:append select="/root/agent_item/parameterData/parameterAssignments">
  20. <parameterAssignment>
  21. <dataItemName>
  22. <xsl:value-of select="$param_value"/>
  23. </dataItemName>
  24. <parameterName>
  25. <xsl:value-of select="$param_name"/>
  26. </parameterName>
  27. </parameterAssignment>
  28. </xts:append>
  29. <xsl:if test="/root/env/param[@name = $param_selection] = 1"> <!-- This is a model so delete the literal-->
  30. <xts:delete select="/root/agent_item/parameterData/parameterValues/item[./*[local-name() = 'name'] = '{$param_name}']"/>
  31. </xsl:if>
  32. </xsl:if>
  33. <xsl:if test="not($param_value) or $param_value = ''">
  34. <!-- one has been removed-->
  35. <xsl:if test="/root/agent_item/parameterData/parameterAssignments/parameterAssignment[./parameterName = $param_name]">
  36. <xts:delete select="/root/agent_item/parameterData/parameterAssignments/parameterAssignment[./parameterName = '{$param_name}']" />
  37. </xsl:if>
  38. </xsl:if>
  39. </xsl:for-each>
  40. <!--at this point remove any parameters that dont have values.... they will be re presented if the prompt values dialog is called -->
  41. <xts:delete select="/root/agent_item/parameterData/parameterValues/item[not(./*[local-name() = 'value']/*[local-name() = 'item'])]"/>
  42. <!-- get rid of the form vars passed in by the promptValues page -->
  43. <xts:delete select="/root/env/param[starts-with(@name,'pv_')]"/>
  44. </xts:sequence>
  45. </xsl:template>
  46. </xsl:stylesheet>