12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- <?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.
- -->
- <xsl:stylesheet version="1.0"
- xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- xmlns:xts="http://developer.cognos.com/schemas/xts/"
- xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt"
- exclude-result-prefixes="xsl xts xtsext">
- <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
-
- <xsl:template match="/root">
- <!--
- append a ; to the end of each field so we can user '<displayName>;' to check if an added recipient is in a given field. We might
- end up with two ; at the end of the field, but it won't cause any issues.
- -->
- <xsl:variable name="toField" select="concat(/root/toField,';')"/>
- <xsl:variable name="ccField" select="concat(/root/ccField,';')"/>
- <xsl:variable name="bccField" select="concat(/root/bccField,';')"/>
- <!-- build up a list of the newly added recipients -->
- <xsl:element name="addedRecipients">
- <xsl:for-each select="*[local-name()='addedRecipients']/*[local-name()='item']">
- <xsl:variable name="displayName" select="concat(*[local-name()='displayName'],';')"/>
- <xsl:variable name="emailTo" select="contains($toField,$displayName)"/>
- <xsl:variable name="emailCc" select="contains($ccField,$displayName)"/>
- <xsl:variable name="emailBcc" select="contains($bccField,$displayName)"/>
-
- <xsl:if test="$emailTo or $emailCc or $emailBcc">
- <xsl:element name="item">
- <xsl:copy-of select="*[local-name() != 'type']"/>
- <xsl:if test="$emailTo">
- <xsl:element name="type">to</xsl:element>
- </xsl:if>
- <xsl:if test="$emailCc">
- <xsl:element name="type">cc</xsl:element>
- </xsl:if>
- <xsl:if test="$emailBcc">
- <xsl:element name="type">bcc</xsl:element>
- </xsl:if>
- </xsl:element>
- </xsl:if>
- </xsl:for-each>
- </xsl:element>
- </xsl:template>
-
- <xsl:template match="text()" priority="0"/>
- </xsl:stylesheet>
|