extractTaskParams.xslt 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  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. <!--
  9. ================================================================================
  10. extract and clean up the parameters for cm
  11. ===============================================================================================
  12. -->
  13. <xsl:stylesheet version="1.0" xmlns:xts="http://developer.cognos.com/schemas/xts/" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt" exclude-result-prefixes="xtsext">
  14. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  15. <xsl:template match="/">
  16. <xts:sequence>
  17. <xts:append select="/root">
  18. <xsl:element name="agent_items_params">
  19. <xsl:attribute name="xmlns:xs"><xsl:text>http://www.w3.org/2001/XMLSchema</xsl:text></xsl:attribute>
  20. <xsl:for-each select="/root/agent_item">
  21. <xsl:variable name="id" select="@id"/>
  22. <xsl:variable name="params">
  23. <xsl:value-of select="xtsext:web64decode( string( /root/agent_item[@id = $id]/param[@name='taskParameters'] ), true() )" disable-output-escaping="yes"/>
  24. </xsl:variable>
  25. <xsl:element name="agent_item_params">
  26. <xsl:attribute name="id"><xsl:value-of select="$id"/></xsl:attribute>
  27. <xsl:if test="./param[@name='taskParameters']">
  28. <xsl:copy-of select="$params"/>
  29. </xsl:if>
  30. </xsl:element>
  31. </xsl:for-each>
  32. </xsl:element>
  33. </xts:append>
  34. <!--remove the parameters without values... they only confuse cm -->
  35. <xts:delete select="/root/agent_items_params/agent_item_params/parameterData/parameterValues/item[not(./*[local-name()='value'])]"/>
  36. </xts:sequence>
  37. </xsl:template>
  38. </xsl:stylesheet>