update_contact_recipients.xslt 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3. Licensed Materials - Property of IBM
  4. IBM Cognos Products: ASV
  5. (C) Copyright IBM Corp. 2005, 2010
  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"
  9. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  10. xmlns:xts="http://developer.cognos.com/schemas/xts/"
  11. xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt"
  12. exclude-result-prefixes="xsl xts xtsext">
  13. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  14. <xsl:key name="prev-recipient" match="/root/*[local-name()='previouslyAdded']/item/*[local-name()='searchPath']" use="."/>
  15. <xsl:template match="/root" priority="2">
  16. <!-- contacts -->
  17. <xsl:variable name="new_contact">
  18. <xsl:for-each select="/root/*[local-name()='selectedEntries']/*">
  19. <xsl:variable name="searchPath" select="*[local-name()='searchPath']"/>
  20. <xsl:if test="not(key('prev-recipient', $searchPath))">
  21. <xsl:variable name="displayName">
  22. <xsl:text/>
  23. <xsl:call-template name="createDisplayName">
  24. <xsl:with-param name="defaultName" select="*[local-name()='defaultName']"/>
  25. <xsl:with-param name="userName" select="*[local-name()='userName']"/>
  26. </xsl:call-template>
  27. <xsl:text/>
  28. </xsl:variable>
  29. <xsl:value-of select="concat($displayName,';')"/>
  30. </xsl:if>
  31. </xsl:for-each>
  32. </xsl:variable>
  33. <param name="contact">
  34. <xsl:value-of select="concat($new_contact, /root/env/param[@name='contact'])"/>
  35. </param>
  36. <xsl:if test="key('prev-recipient', /root/*[local-name()='selectedEntries']/*/*[local-name()='searchPath'])">
  37. <param name="duplicateEntryAdded">true</param>
  38. </xsl:if>
  39. </xsl:template>
  40. <!-- build the value for the input field. Has the format of -->
  41. <xsl:template name="createDisplayName">
  42. <xsl:param name="userName" select="''"/>
  43. <xsl:param name="defaultName" select="''"/>
  44. <xsl:choose>
  45. <xsl:when test="$userName !=''">
  46. <xsl:text/>
  47. <xts:string id="IDS_EMAIL_DISPLAY_USER">
  48. <xts:param name="defaultName"><xsl:value-of select="$defaultName"/></xts:param>
  49. <xts:param name="userName"><xsl:value-of select="$userName"/></xts:param>
  50. </xts:string><xsl:text/>
  51. </xsl:when>
  52. <xsl:otherwise>
  53. <xsl:value-of select="$defaultName"/>
  54. </xsl:otherwise>
  55. </xsl:choose>
  56. </xsl:template>
  57. <xsl:template match="text()" priority="0"/>
  58. </xsl:stylesheet>