123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!--
- Licensed Materials - Property of IBM
- IBM Cognos Products: ps
- (C) Copyright IBM Corp. 2005, 2011
- US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
- -->
- <!--
- Copyright (C) 2008 Cognos ULC, an IBM Company. All rights reserved.
- Cognos (R) is a trademark of Cognos ULC, (formerly Cognos Incorporated).
- -->
- <xsl:stylesheet version="1.0"
- xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- xmlns:x="x"
- xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt"
- xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/"
- xmlns:xts="http://developer.cognos.com/schemas/xts/">
-
- <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
- <xsl:variable name="op" select="/root/env/param[@name='credential_op']"/>
- <xsl:variable name="passport" select="/root/credential/param[@name='CAM']/*[local-name() ='CAM']/*[local-name() = 'CAMPassport']/*[local-name() = 'id']"/>
- <xsl:template match="/">
- <xts:sequence>
- <xsl:choose>
- <!-- Delete operation -->
- <xsl:when test="$op='delete'">
- <xsl:for-each select="/root/env/param[starts-with(@name,'credential_chk_')]">
- <xsl:variable name="searchPath" select="."/>
- <xts:delete select="root/list/*/*[local-name() = 'searchPath' and . = '{$searchPath}']/.."/>
- </xsl:for-each>
- <!-- clean up the request -->
- <xts:delete select="/root/env/param[starts-with(@name,'credential_chk_')]"/>
- </xsl:when>
-
- <!-- Add operation -->
- <xsl:when test="/root/newEntries">
- <xsl:variable name="fragment">
- <xsl:for-each select="/root/newEntries/*">
- <xsl:choose>
- <xsl:when test="not(*[local-name()='searchPath'] = /root/list/*/cm:searchPath)">
- <xts:append select="/root/list">
- <xsl:element name="{local-name()}" namespace="http://developer.cognos.com/schemas/xts-cm/1/">
- <xsl:element name="objectClass" namespace="http://developer.cognos.com/schemas/xts-cm/1/">
- <xsl:value-of select="local-name()"/>
- </xsl:element>
- <xsl:element name="defaultName" namespace="http://developer.cognos.com/schemas/xts-cm/1/">
- <xsl:value-of select="*[local-name()='defaultName']"/>
- </xsl:element>
- <xsl:element name="searchPath" namespace="http://developer.cognos.com/schemas/xts-cm/1/">
- <xsl:value-of select="*[local-name()='searchPath']"/>
- </xsl:element>
- <xsl:element name="defaultDescription" namespace="http://developer.cognos.com/schemas/xts-cm/1/">
- <xsl:value-of select="*[local-name()='defaultDescription']"/>
- </xsl:element>
- <xsl:element name="defaultScreenTip" namespace="http://developer.cognos.com/schemas/xts-cm/1/">
- <xsl:value-of select="*[local-name()='defaultScreenTip']"/>
- </xsl:element>
- <xsl:element name="ancestors" namespace="http://developer.cognos.com/schemas/xts-cm/1/">
- <xsl:copy-of select="*[local-name()='ancestors']"/>
- </xsl:element>
- <xsl:if test="*[local-name()='userName']">
- <xsl:element name="userName" namespace="http://developer.cognos.com/schemas/xts-cm/1/">
- <xsl:value-of select="*[local-name()='userName']"/>
- </xsl:element>
- </xsl:if>
- </xsl:element>
- </xts:append>
- </xsl:when>
- <xsl:otherwise>
- <xts:append select="/root">
- <duplicateEntry/>
- </xts:append>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:for-each>
- </xsl:variable>
-
- <xsl:if test="$fragment">
- <xsl:if test="not(/root/list)">
- <xts:append select="root">
- <list/>
- </xts:append>
- </xsl:if>
- <xsl:copy-of select="$fragment"/>
- <xts:delete select="/root/newItems"/>
- </xsl:if>
- <xts:delete select="/root/env/param[@name='addentries_list']"/>
- </xsl:when>
- </xsl:choose>
- </xts:sequence>
- </xsl:template>
- </xsl:stylesheet>
|