modelItemFields.xsl 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  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. <!-- written 14-07-2004 -->
  9. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xts="http://developer.cognos.com/schemas/xts/" xmlns:xtscm="http://developer.cognos.com/schemas/xts-cm/1/" xmlns:utml="http://developer.cognos.com/schemas/xts/logicsheet/xslt/formlogic/" exclude-result-prefixes="xsl xts utml">
  10. <xsl:output method="xml" indent="no" encoding="UTF-8"/>
  11. <xsl:template match="/">
  12. <xts:sequence>
  13. <xts:append>
  14. <modelItemFields>
  15. <modelItemField id="AgentTask-condition">
  16. <name>detailExpression</name>
  17. <value>
  18. <xsl:value-of select="/root/agentDefinitionCondition/detailExpression"/>
  19. </value>
  20. </modelItemField>
  21. <modelItemField id="AgentTask-condition">
  22. <name>summaryExpression</name>
  23. <value>
  24. <xsl:value-of select="/root/agentDefinitionCondition/summaryExpression"/>
  25. </value>
  26. </modelItemField>
  27. <modelItemField id="SummaryEventKey">
  28. <name>Summary_event_key</name>
  29. <value>
  30. <xsl:value-of select="/root/agent_definition/summaryEventKey"/>
  31. </value>
  32. </modelItemField>
  33. <xsl:for-each select="/root/agentTasks/item">
  34. <xsl:variable name="pos" select="position()"/>
  35. <xsl:variable name="id" select="/root/agent_definition/items/item[position() = $pos]/id"/>
  36. <xsl:choose>
  37. <xsl:when test="@type='url'">
  38. <modelItemField id="{$id}">
  39. <name>url_description</name>
  40. <value>
  41. <xsl:value-of select="./param[@name='url_description']"/>
  42. </value>
  43. </modelItemField>
  44. <modelItemField id="{$id}">
  45. <name>url_screentip</name>
  46. <value>
  47. <xsl:value-of select="./param[@name='url_screentip']"/>
  48. </value>
  49. </modelItemField>
  50. <modelItemField id="{$id}">
  51. <name>url_name</name>
  52. <value>
  53. <xsl:value-of select="./param[@name='url_name']"/>
  54. </value>
  55. </modelItemField>
  56. </xsl:when>
  57. <xsl:when test="@type='message'">
  58. <xsl:variable name="option-items" select="/root/agentTaskDefinitions/*[local-name() ='queryResponse']/*[local-name()='agentTaskDefinition' and position()=$pos]/*[local-name()='taskObject']/*/*[local-name() ='memo']/*[local-name()='options']/*[local-name()='value']"/>
  59. <!--xsl:message>
  60. bud subject item value = <xsl:value-of select="$option-items/*[local-name()='item' and ./*[local-name()='name'] = 'subject']/*[local-name() = 'value']"/>
  61. bud toaddress item value = <xsl:value-of select="$option-items/*[local-name()='item' and ./*[local-name()='toAddress'] = 'subject']/*[local-name() = 'value']"/>
  62. budlocal subject item value = <xsl:value-of select="$option-items/item[./name='subject']/value"/>
  63. bud item = <xsl:value-of select="$option-items/*[local-name()='item']"/>
  64. </xsl:message-->
  65. <modelItemField id="{$id}">
  66. <name>email_to</name>
  67. <value>
  68. <xsl:for-each select="$option-items/item[./name='toAddress']/*[local-name()='value']/*[local-name()='item']">
  69. <xsl:value-of select="text()"/>
  70. </xsl:for-each>
  71. </value>
  72. </modelItemField>
  73. <modelItemField id="{$id}">
  74. <name>email_cc</name>
  75. <value>
  76. <xsl:for-each select="$option-items/item[./name='ccAddress']/*[local-name()='value']/*[local-name()='item']">
  77. <xsl:value-of select="text()"/>
  78. </xsl:for-each>
  79. </value>
  80. </modelItemField>
  81. <modelItemField id="{$id}">
  82. <name>email_bcc</name>
  83. <value>
  84. <xsl:for-each select="$option-items/item[./name='bccAddress']/*[local-name()='value']/*[local-name()='item']">
  85. <xsl:value-of select="text()"/>
  86. </xsl:for-each>
  87. </value>
  88. </modelItemField>
  89. <modelItemField id="{$id}">
  90. <name>email_subject</name>
  91. <value>
  92. <xsl:value-of select="$option-items/item[./name='subject']/*[local-name()='value']"/>
  93. </value>
  94. </modelItemField>
  95. <modelItemFieldGroup>
  96. <modelItemField id="{$id}">
  97. <name>email_body</name>
  98. <value>
  99. <xsl:value-of select="$option-items/*[local-name()='item'][./*[local-name()='name']='memoPart']/*[local-name()='value']/*[local-name()='parts']/*[local-name()='item']//*[local-name()='text']"/>
  100. </value>
  101. </modelItemField>
  102. <!--modelItemField id="{$id}">
  103. <name>editbody</name>
  104. <value>
  105. <xsl:value-of select="$option-items/item[./name='memoPart']/value/parts/item/text"/>
  106. </value>
  107. </modelItemField-->
  108. </modelItemFieldGroup>
  109. </xsl:when>
  110. <xsl:when test="@type='sql' or @type='web' or @type='agent' or @type='report'">
  111. <modelItemFieldGroup id="{$id}">
  112. <xsl:if test="@type='agent' or @type='report'">
  113. <xsl:attribute name="promptablePath">
  114. <xsl:text>storeID(&apos;</xsl:text>
  115. <xsl:value-of select="@targetStoreID"/>
  116. <xsl:text>&apos;)</xsl:text>
  117. </xsl:attribute>
  118. <xsl:attribute name="promptableName">
  119. <xsl:value-of select="./param[@name='taskName']"/>
  120. </xsl:attribute>
  121. </xsl:if>
  122. <xsl:for-each select="/root/transformedParams/parameterData[position() = $pos]/parameterAssignments/parameterAssignment">
  123. <modelItemField id="{$id}">
  124. <name>pv_dz_<xsl:value-of select="./parameterName"/>_pv_dz</name>
  125. <value>
  126. <xsl:value-of select="./dataItemName"/>
  127. </value>
  128. </modelItemField>
  129. </xsl:for-each>
  130. </modelItemFieldGroup>
  131. </xsl:when>
  132. </xsl:choose>
  133. <modelItemField id="{$id}">
  134. <name>Action_topic_filter</name>
  135. <value>
  136. <xsl:value-of select="/root/agent_definition/items/item[position() = $pos]/suppression/param[@name='Action_topic_filter']"/>
  137. </value>
  138. </modelItemField>
  139. </xsl:for-each>
  140. </modelItemFields>
  141. </xts:append>
  142. </xts:sequence>
  143. </xsl:template>
  144. </xsl:stylesheet>