123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320 |
- <?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:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- xmlns:bus="http://developer.cognos.com/schemas/bibus/3/"
- xmlns:impl="http://www.ibm.com/xmlns/prod/cognos/internal/hts/_1"
- xmlns:hta="http://www.example.org/WS-HT/api"
- xmlns:ht="http://www.example.org/WS-HT"
- xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
- xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt"
- exclude-result-prefixes="xsl xsi SOAP-ENC xtsext bus xsd">
- <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
- <xsl:key name="param" match="/root/*[local-name()='param']" use="@name"/>
- <xsl:template match="/root">
- <impl:createNotificationManualTask xmlns:impl="http://www.ibm.com/xmlns/prod/cognos/internal/hts/_1" xmlns:hta="http://www.example.org/WS-HT/api" xmlns:ht="http://www.example.org/WS-HT" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <impl:beplNotification name="Notification_instance_name">
- <xsl:choose>
- <xsl:when test="/root/*[local-name()='requestParams']/*[local-name()='param' and @name='agentStudio'] = 'true'">
- <xsl:choose>
- <xsl:when test="/root/param[@name='m_ro_priority_radio']='priority'">
- <xsl:if test="/root/param[@name='m_ro_priority']">
- <impl:priority>
- <xsl:value-of select="/root/param[@name='m_ro_priority']"/>
- </impl:priority>
- </xsl:if>
- </xsl:when>
- <xsl:when test="/root/param[@name='m_ro_priority_radio']='item'">
- <xsl:if test="/root/param[@name='m_ro_priority_item']">
- <impl:priority>
- <xsl:value-of select="/root/param[@name='m_ro_priority_item']"/>
- </impl:priority>
- </xsl:if>
- </xsl:when>
- </xsl:choose>
- </xsl:when>
- <xsl:otherwise>
- <xsl:if test="/root/param[@name='m_ro_priority']">
- <impl:priority>
- <xsl:value-of select="/root/param[@name='m_ro_priority']"/>
- </impl:priority>
- </xsl:if>
- </xsl:otherwise>
- </xsl:choose>
- <impl:peopleAssignments>
- <xsl:if test="/root/param[@name='to']/param[@name='to' or @name='toGroup' or @name='toAddress']">
- <ht:recipients>
- <ht:from logicalPeopleGroup="CAM">
- <ht:literal>
- <ht:organizationalEntity>
- <xsl:if test="/root/param[@name='to']/param[@name='to']">
- <ht:users>
- <xsl:for-each select="/root/param[@name='to']/param[@name='to']">
- <ht:user>
- <xsl:value-of select="."/>
- </ht:user>
- </xsl:for-each>
- </ht:users>
- </xsl:if>
- <xsl:if test="/root/param[@name='to']/param[@name='toGroup' or @name='toAddress']">
- <ht:groups>
- <xsl:for-each select="/root/param[@name='to']/param[@name='toGroup' or @name='toAddress']">
- <ht:group>
- <xsl:value-of select="."/>
- </ht:group>
- </xsl:for-each>
- </ht:groups>
- </xsl:if>
- </ht:organizationalEntity>
- </ht:literal>
- </ht:from>
- </ht:recipients>
- </xsl:if>
- <xsl:if test="/root/param[@name='cc']/param[@name='cc' or @name='ccGroup' or @name='ccAddress']">
- <ht:taskStakeholders>
- <ht:from logicalPeopleGroup="CAM">
- <ht:literal>
- <ht:organizationalEntity>
- <xsl:if test="/root/param[@name='cc']/param[@name='cc'] ">
- <ht:users>
- <xsl:for-each select="/root/param[@name='cc']/param[@name='cc']">
- <ht:user>
- <xsl:value-of select="."/>
- </ht:user>
- </xsl:for-each>
- </ht:users>
- </xsl:if>
- <xsl:if test="/root/param[@name='cc']/param[@name='ccGroup' or @name='ccAddress']">
- <ht:groups>
- <xsl:for-each select="/root/param[@name='cc']/param[@name='ccGroup' or @name='ccAddress']">
- <ht:group>
- <xsl:value-of select="."/>
- </ht:group>
- </xsl:for-each>
- </ht:groups>
- </xsl:if>
- </ht:organizationalEntity>
- </ht:literal>
- </ht:from>
- </ht:taskStakeholders>
- </xsl:if>
- <ht:businessAdministrators>
- <ht:from logicalPeopleGroup="CAM">
- <ht:literal>
- <ht:organizationalEntity>
- <ht:groups>
- <ht:group>CAMID(":Server Administrators")</ht:group>
- </ht:groups>
- </ht:organizationalEntity>
- </ht:literal>
- </ht:from>
- </ht:businessAdministrators>
- </impl:peopleAssignments>
- </impl:beplNotification>
- <impl:manualTask>
- <!-- placeholder for the preview -->
- <impl:preview/>
- <!-- placeholder for the eventID's - though not sure these are needed -->
- <impl:parentEventId/>
- <impl:eventId/>
- <!-- add the task icon path in - this is filled server side -->
- <impl:taskIconPath/>
- <!-- need to set the link in ASV - when we know the searchPAth to the report output to set -->
- <xsl:if test="/root/*[local-name()='requestParams']/*[local-name()='param' and @name='agentStudio'] = 'true'">
- <xsl:if test="/root/*[local-name()='attachments']/*[local-name()='item']">
- <!-- attachments -->
- <impl:taskLinksList>
- <xsl:for-each select="/root/*[local-name()='attachments']/*[local-name()='item']">
- <impl:taskLink>
- <!-- if we have a locale then append to the attachment name -->
- <xsl:choose>
- <xsl:when test="*[local-name()='locale'] != ''">
- <impl:display>
- <xsl:value-of select="concat(*[local-name()='defaultName'],'_',*[local-name()='locale'])"/>
- </impl:display>
- </xsl:when>
- <xsl:otherwise>
- <impl:display>
- <xsl:value-of select="*[local-name()='defaultName']"/>
- </impl:display>
- </xsl:otherwise>
- </xsl:choose>
- <impl:id>
- <xsl:value-of select="*[local-name()='searchPath']"/>
- </impl:id>
- <impl:format>
- <xsl:value-of select="*[local-name()='format']"/>
- </impl:format>
- <impl:locale>
- <xsl:value-of select="*[local-name()='locale']"/>
- </impl:locale>
- </impl:taskLink>
- </xsl:for-each>
- </impl:taskLinksList>
- </xsl:if>
- </xsl:if>
- <xsl:choose>
- <xsl:when test="/root/*[local-name()='requestParams']/*[local-name()='param' and @name='agentStudio'] = 'true'">
- <xsl:variable name="links" select="/root/*[local-name()='links']/*[local-name()='item']"/>
- <!-- links -->
- <xsl:if test="$links">
- <impl:linksList>
- <xsl:for-each select="$links">
- <impl:link>
- <impl:display>
- <xsl:value-of select="*[local-name()='displayName']"/>
- </impl:display>
- <impl:objectClass>
- <xsl:choose>
- <xsl:when test="*[local-name()='objectClass'] != ''">
- <xsl:value-of select="*[local-name()='objectClass']"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:text>nil</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- </impl:objectClass>
- <impl:id>
- <xsl:value-of select="*[local-name()='searchPath']"/>
- </impl:id>
- </impl:link>
- </xsl:for-each>
- </impl:linksList>
- </xsl:if>
- </xsl:when>
- <xsl:when test="/root/*[local-name()='requestParams']/*[local-name()='param' and @name='subscription'] = 'true'">
- <xsl:if test="/root/param[@name='m_ro_taskAsURL']='true'">
- <impl:linksList>
- <impl:link>
- <impl:display>TO BE REPLACED</impl:display>
- <impl:id>TO BE REPLACED</impl:id>
- </impl:link>
- </impl:linksList>
- </xsl:if>
- </xsl:when>
- </xsl:choose>
- <xsl:if test="key('param','m_ro_readExpiry_start')">
- <impl:startFor>
- <xsl:text>P</xsl:text>
- <!-- need to add the 'T' designator if specifying a time. In our case we need to resolve minutes or hours-->
- <xsl:if test="key('param','m_ro_readExpireUnit_start')='H' or key('param','m_ro_readExpireUnit_start')='M'">
- <xsl:text>T</xsl:text>
- </xsl:if>
- <xsl:value-of select="key('param','m_ro_readExpireUnitCount_start')"/>
- <xsl:value-of select="key('param','m_ro_readExpireUnit_start')"/>
- </impl:startFor>
- </xsl:if>
- <xsl:if test="/root/param[@name='m_ro_readReceipt']">
- <impl:recordReadReceipt>
- <xsl:value-of select="/root/param[@name='m_ro_readReceipt']"/>
- </impl:recordReadReceipt>
- </xsl:if>
- <xsl:if test="/root/param[@name='m_ro_sub_notifyOnCreation']">
- <impl:notifyOnCreation>
- <xsl:call-template name="makeSubscriptionParam">
- <xsl:with-param name="selected" select="/root/param[@name='m_ro_sub_notifyOnCreation']"/>
- </xsl:call-template>
- </impl:notifyOnCreation>
- </xsl:if>
- <xsl:if test="/root/param[@name='email_subject']">
- <impl:subject xml:lang="en-us">
- <xsl:value-of select="/root/param[@name='email_subject']"/>
- </impl:subject>
- </xsl:if>
- <!-- sort out the body -->
- <xsl:if test="key('param','email_body')!='' ">
- <xsl:call-template name="htmlBody"/>
- </xsl:if>
- </impl:manualTask>
- </impl:createNotificationManualTask>
- </xsl:template>
- <xsl:template name="makeSubscriptionParam">
- <xsl:param name="selected"/>
- <xsl:param name="global" select="'true'"/>
-
- <xsl:choose>
- <xsl:when test="$selected = 'true' or $selected = 'checked'">
- <xsl:choose>
- <xsl:when test="$global = 'true'">
- <xsl:text>GLOBAL_SUBSCRIBE</xsl:text>
- </xsl:when>
- <xsl:otherwise>
- <xsl:text>INDIVIDUAL_SUBSCRIBE</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:when>
- <xsl:otherwise>
- <xsl:choose>
- <xsl:when test="$global = 'true'">
- <xsl:text>GLOBAL_UNSUBSCRIBE</xsl:text>
- </xsl:when>
- <xsl:otherwise>
- <xsl:text>INDIVIDUAL_UNSUBSCRIBE</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
- <xsl:template name="htmlBody">
- <impl:description xml:lang="en-us" contentType="text/plain">
- <xsl:value-of select="key('param','email_body')"/>
- </impl:description>
- <xsl:variable name="body">
- <xsl:choose>
- <xsl:when test="key('param','hidden_richEditBody') != ''">
- <xsl:value-of select="key('param','hidden_richEditBody')"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="key('param','email_body')"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <!-- build up a head and meta element to palce in the HTML email. -->
- <xsl:variable name="head">
- <xsl:if test="key('param','richEditMode') = 'true'">
- <xsl:value-of select="'<HEAD><META name="user-entered-html-email-body"></META></HEAD>'"/>
- </xsl:if>
- </xsl:variable>
- <!-- make sure the body has openning and closing BODY and HTML tags -->
- <xsl:variable name="htmlBody">
- <xsl:choose>
- <xsl:when test="starts-with($body,'<HTML')">
- <xsl:value-of select="$body"/>
- </xsl:when>
- <xsl:when test="starts-with($body,'<BODY')">
- <xsl:value-of select="concat('<HTML>',$head, $body,'</HTML>')"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="concat('<HTML>', $head, '<BODY>',$body,'</BODY></HTML>')"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <!-- if we need to add a link in the body -->
- <xsl:variable name="completeBody">
- <xsl:choose>
- <xsl:when test="key('param','m_ro_emailAsURL')='true' and /root/*[local-name()='requestParams']/*[local-name()='param' and @name='linkToReport']!= ''">
- <xsl:value-of select="substring-before($htmlBody, '</BODY></HTML>')"/>
- <xsl:value-of select="'<BR/>'"/>
- <xsl:value-of select="/root/*[local-name()='requestParams']/*[local-name()='param' and @name='linkToReport']"/>
- <xsl:value-of select="'</BODY></HTML>'"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$htmlBody"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <impl:description xml:lang="en-us" contentType="text/html">
- <xsl:value-of select="$completeBody" disable-output-escaping="yes"/>
- </impl:description>
- </xsl:template>
- </xsl:stylesheet>
|