mergeLiteralParameters.xslt 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3. Licensed Materials - Property of IBM
  4. IBM Cognos Products: AGS
  5. (C) Copyright IBM Corp. 2005, 2008
  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:xts="http://developer.cognos.com/schemas/xts/"
  10. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  11. xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
  12. xmlns:xtscm="http://developer.cognos.com/schemas/xts-cm/1/"
  13. exclude-result-prefixes="xts xsl xsi SOAP-ENC xtscm">
  14. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  15. <xsl:template match="/">
  16. <xts:sequence>
  17. <xsl:for-each select="/root/parameters/xtscm:parameterValue">
  18. <xsl:variable name="param_name" select="./xtscm:name"/>
  19. <!--replace existing params by param name (or append if not there) -->
  20. <xts:delete select="/root/agent_item/parameterData/parameterValues/item[./name = '{$param_name}']"/>
  21. <xts:append select="/root/agent_item/parameterData/parameterValues">
  22. <!-- must transform any params from rs to cm style -->
  23. <xts:transform src="transforms/portal/parameters/pre-WARP-process.xslt" processor="XSLT">
  24. <xsl:copy-of select="."/>
  25. </xts:transform>
  26. </xts:append>
  27. </xsl:for-each>
  28. <xsl:for-each select="/root/env/param[starts-with(@name, 'pv_ndz_')]">
  29. <xsl:variable name="param_name" select="substring-before(substring-after(@name, 'pv_ndz_'), '_pv_ndz')"/>
  30. <xsl:variable name="param_value" select="."/>
  31. <!--replace existing params by param name (or append if not there) -->
  32. <xts:delete select="/root/agent_item/parameterData/parameterValues/item[./name = '{$param_name}']"/>
  33. <xts:append select="/root/agent_item/parameterData/parameterValues">
  34. <item xsi:type="cm:parameterValue">
  35. <name xsi:type="xsd:string"><xsl:value-of select="$param_name"/></name>
  36. <value xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="cm:parmValueItem[1]">
  37. <item xsi:type="bus:simpleParmValueItem">
  38. <inclusive xsi:type="xsd:boolean">true</inclusive>
  39. <display xsi:type="xsd:string"><xsl:value-of select="$param_value"/></display>
  40. <use xsi:type="xsd:string"><xsl:value-of select="$param_value"/></use>
  41. </item>
  42. </value>
  43. </item>
  44. </xts:append>
  45. </xsl:for-each>
  46. </xts:sequence>
  47. </xsl:template>
  48. </xsl:stylesheet>