12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!--
- Licensed Materials - Property of IBM
- IBM Cognos Products: AGS
- (C) Copyright IBM Corp. 2005, 2008
- US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
- -->
- <xsl:stylesheet version="1.0" xmlns:xts="http://developer.cognos.com/schemas/xts/" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt" xmlns:pf="http://developer.cognos.com/schemas/xts/pf" exclude-result-prefixes="xts xsl xtsext pf">
- <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
- <!-- include the serialization code -->
- <pf:serialize-xml/>
- <pf:variables/>
- <xsl:template match="/">
- <xsl:variable name="sq">"'</xsl:variable>
- <xsl:variable name="prevTabID" select="/root/env/param[@name='prevTabID']"/>
- <xsl:variable name="prevTabName">
- <xsl:choose>
- <xsl:when test="/root/agent_definition/items/item[id=$prevTabID]/type='message' and string-length(/root/env/param[@name='taskName'])=0">
- <xsl:text><xts:string id="AGS_EMAIL_WTASK"/></xsl:text>
- </xsl:when>
- <xsl:otherwise><xsl:value-of select="/root/env/param[@name='taskName']"/></xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xts:sequence>
- <!-- if this name exist before, we put a seq. number at the end -->
- <xsl:choose>
- <!-- don't include yourself in the count - so remove the item which has the same TabID -->
- <xsl:when test="count(/root/agent_definition/items/item[not(id = $prevTabID) and name=$prevTabName])>0">
- <xsl:variable name="task_name">
- <xsl:call-template name="buildTaskName">
- <!-- should this be localized - it's going to show up in the UI -->
- <xsl:with-param name="prevTabID" select="$prevTabID"/>
- <xsl:with-param name="baseName" select="$prevTabName"/>
- <xsl:with-param name="suffix" select="'0'"/>
- </xsl:call-template>
- </xsl:variable>
- <xts:replace select="/root/env/param[@name='taskName']">
- <param name="taskName"><xsl:value-of select="$task_name"/></param>
- </xts:replace>
- </xsl:when>
- <xsl:otherwise>
- <xts:replace select="/root/env/param[@name='taskName']">
- <param name="taskName"><xsl:value-of select="$prevTabName"/></param>
- </xts:replace>
- </xsl:otherwise>
- </xsl:choose>
- </xts:sequence>
- </xsl:template>
- <!-- mini template to generate a unique task name -->
- <xsl:template name="buildTaskName">
- <xsl:param name="prevTabID"/>
- <xsl:param name="baseName"/>
- <xsl:param name="suffix"/>
- <!-- build the task name we want -->
- <xsl:variable name="taskName">
- <xsl:value-of select="normalize-space($baseName)"/>
- <xsl:if test="number($suffix) != 0">
- <!-- append the suffix -->
- <xsl:value-of select="$suffix"/>
- </xsl:if>
- </xsl:variable>
- <xsl:choose>
- <!-- again - have to ignore it's current state from the comparison -->
- <xsl:when test="/root/agent_definition/items/item[not(id = $prevTabID) and name=$taskName]">
- <xsl:call-template name="buildTaskName">
- <xsl:with-param name="prevTabID" select="$prevTabID"/>
- <xsl:with-param name="baseName" select="normalize-space($baseName)"/>
- <xsl:with-param name="suffix" select="string(number($suffix)+1)"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$taskName"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
- </xsl:stylesheet>
|