1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!--
- Licensed Materials - Property of IBM
- IBM Cognos Products: ASV
- (C) Copyright IBM Corp. 2005, 2010
- US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
- -->
- <!--
- Transform used to change a CM response into the same structure returned by add recipients.
- Usefull since it allow us to use the same transforms to update the to, cc and bcc fields and also
- to update the email recipients blob.
- -->
- <xsl:stylesheet version="1.0"
- xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- xmlns:xts="http://developer.cognos.com/schemas/xts/"
- exclude-result-prefixes="xsl xts">
- <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
- <xsl:key name="recipient-to" match="/root/*[local-name()='defaultOptions']/*[local-name()='to']/*[local-name()='searchPath']" use="."/>
- <xsl:key name="recipient-cc" match="/root/*[local-name()='defaultOptions']/*[local-name()='cc']/*[local-name()='searchPath']" use="."/>
- <xsl:key name="recipient-bcc" match="/root/*[local-name()='defaultOptions']/*[local-name()='bcc']/*[local-name()='searchPath']" use="."/>
- <xsl:key name="recipients" match="/root/*[local-name()='defaultOptions']/*[local-name()='to' or local-name()='cc' or local-name()='bcc']/*[local-name()='searchPath']" use="."/>
- <xsl:template match="/root" priority="1">
- <xsl:copy-of select="/root/item"/>
-
- <!-- get the list of unique recipients -->
- <xsl:variable name="unique-recipients" select="/root/*[local-name()='defaultOptions']/*[local-name()='to' or local-name()='cc' or local-name()='bcc']/*[generate-id(.) = generate-id(key('recipients',.))]"/>
-
- <!-- if we found a recipient who isn't in our selected entries list then add him as unknown -->
- <xsl:for-each select="$unique-recipients[not(. = /root/item/searchPath)]">
- <xsl:variable name="searchPath" select="."/>
- <item>
- <searchPath><xsl:value-of select="$searchPath"/></searchPath>
- <userName/>
- <defaultName><xts:string id="IDS_OTHERRUN_EMAIL_UNKNOWN_RECIPIENT_WITH_COUNT"><xts:param name="count"><xsl:value-of select="position()"/></xts:param></xts:string></defaultName>
-
- <xsl:if test="key('recipient-to',$searchPath)">
- <type>to</type>
- </xsl:if>
- <xsl:if test="key('recipient-cc',$searchPath)">
- <type>cc</type>
- </xsl:if>
- <xsl:if test="key('recipient-bcc',$searchPath)">
- <type>bcc</type>
- </xsl:if>
-
- <!-- add an unkown flag. Needed to rebuild the recipients list if the user decides to
- remove all the unknown recipients -->
- <unknown>true</unknown>
- </item>
- </xsl:for-each>
- </xsl:template>
-
- <xsl:template match="text()" priority="0"/>
- </xsl:stylesheet>
|