generateEmailTo.xslt 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3. Licensed Materials - Property of IBM
  4. IBM Cognos Products: ps
  5. (C) Copyright IBM Corp. 2005, 2011
  6. US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  7. -->
  8. <!--
  9. Copyright (C) 2008 Cognos ULC, an IBM Company. All rights reserved.
  10. Cognos (R) is a trademark of Cognos ULC, (formerly Cognos Incorporated).
  11. -->
  12. <!--
  13. Checks cm response to see if user has an e-mail, if so make them the default recipient, otherwise default to no recipients
  14. -->
  15. <xsl:stylesheet version="1.0"
  16. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  17. xmlns:xts="http://developer.cognos.com/schemas/xts/"
  18. exclude-result-prefixes="xsl xts">
  19. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  20. <xsl:variable name="hasEmail" select="/root/*[local-name()='queryResponse']/*[local-name()='account']/*[local-name()='email'] != ''"/>
  21. <xsl:variable name="hasNotificationEmail" select="/root/*[local-name()='queryResponse']/*[local-name()='account']/*[local-name()='notificationEMail'] != ''"/>
  22. <xsl:variable name="isSubscription" select="/root/subscription"/>
  23. <xsl:template match="/root" priority="1">
  24. <xsl:if test="$hasEmail or ($isSubscription and $hasNotificationEmail)">
  25. <param name="to">
  26. <param name="to"><xsl:value-of select="/root/e_hp"/></param>
  27. </param>
  28. </xsl:if>
  29. </xsl:template>
  30. <xsl:template match="text()" priority="0"/>
  31. </xsl:stylesheet>