123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!--
- Licensed Materials - Property of IBM
- IBM Cognos Products: HTS
- (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:dlgctrl="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/dialog/controller-templates/" xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt" xmlns:req-params="http://developer.cognos.com/schemas/request/params" exclude-result-prefixes="xsl dlgctrl xtsext req-params">
- <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
- <xsl:template match="/">
- <selectedEntries>
- <xsl:call-template name="decodeEntriesList">
- <xsl:with-param name="entriesList">
- <xsl:value-of select="/root/env/param[@name='selectedCamIds']"/>
- </xsl:with-param>
- <xsl:with-param name="type">
- <xsl:value-of select="/root/env/param[@name='type']"/>
- </xsl:with-param>
- <xsl:with-param name="currentEntries">
- <xsl:copy-of select="/root/env/param[@name='currentEntries']"/>
- </xsl:with-param>
- </xsl:call-template>
- </selectedEntries>
- </xsl:template>
- <xsl:template name="getBefore">
- <xsl:param name="entriesList"/>
- <xsl:variable name="before" select="substring-before($entriesList,',')"/>
- <xsl:variable name="after" select="substring-after($entriesList,',')"/>
- <xsl:choose>
- <!-- if the next entry does not start with CAMID then we must have an LDAP address e.g. CAMID("LDAP:u:uid=sysadmin1,ou=people") which includes a comma(used to delimit the list)-->
- <xsl:when test="starts-with($before,'CAMID') and starts-with($after,'CAMID')=false()">
- <!-- get the full camid by concatenating the two parts-->
- <xsl:variable name="camId">
- <xsl:call-template name="getCAMID">
- <xsl:with-param name="before" select="$before"/>
- <xsl:with-param name="after" select="$after"/>
- </xsl:call-template>
- </xsl:variable>
- <!-- return the 'before ',' entry-->
- <xsl:value-of select="$camId"/>
- </xsl:when>
- <!-- COGNOS namespace camid e.g. CAMID(":Authors")-->
- <xsl:otherwise><xsl:value-of select="$before"/></xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <xsl:template name="getAfter">
- <xsl:param name="entriesList"/>
- <xsl:variable name="before" select="substring-before($entriesList,',')"/>
- <xsl:variable name="after" select="substring-after($entriesList,',')"/>
- <xsl:choose>
- <!-- if the next entry does not start with CAMID then we must have an LDAP address e.g. CAMID("LDAP:u:uid=sysadmin1,ou=people") which includes a comma(used to delimit the list)-->
- <xsl:when test="starts-with($before,'CAMID') and starts-with($after,'CAMID')=false()">
- <!-- get the full camid by concatenating the two parts-->
- <xsl:variable name="camId">
- <xsl:call-template name="getCAMID">
- <xsl:with-param name="before" select="$before"/>
- <xsl:with-param name="after" select="$after"/>
- </xsl:call-template>
- </xsl:variable>
- <!-- return the 'after ',' entry-->
- <xsl:value-of select="substring-after($entriesList,$camId)"/>
- </xsl:when>
- <!-- COGNOS namespace camid e.g. CAMID(":Authors")-->
- <xsl:otherwise><xsl:value-of select="$after"/></xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <xsl:template name="getCAMID">
- <xsl:param name="after"/>
- <xsl:param name="before"/>
- <xsl:choose>
- <xsl:when test="substring-before($after,',')=''"><xsl:value-of select="concat($before,',',$after)"/></xsl:when>
- <xsl:otherwise><xsl:value-of select="concat($before,',',substring-before($after,')'),')')"/></xsl:otherwise>
- </xsl:choose>
- </xsl:template>
- <xsl:template name="decodeEntriesList">
- <xsl:param name="entriesList"/>
- <xsl:param name="type"/>
- <xsl:param name="currentEntries"/>
- <xsl:choose>
- <xsl:when test="contains($entriesList, ',')">
- <!-- get the 'before' list -->
- <xsl:variable name="before">
- <xsl:call-template name="getBefore">
- <xsl:with-param name="entriesList" select="$entriesList"/>
- </xsl:call-template>
- </xsl:variable>
- <!-- get the 'after' list -->
- <xsl:variable name="after">
- <xsl:call-template name="getAfter">
- <xsl:with-param name="entriesList" select="$entriesList"/>
- </xsl:call-template>
- </xsl:variable>
- <!-- build the <selectedEntry> structure -->
- <xsl:if test="$before != '' ">
- <xsl:call-template name="build">
- <xsl:with-param name="entriesList"><xsl:value-of select="$before"/></xsl:with-param>
- <xsl:with-param name="type"><xsl:value-of select="$type"/></xsl:with-param>
- <xsl:with-param name="currentEntries"><xsl:copy-of select="$currentEntries"/></xsl:with-param>
- </xsl:call-template>
- </xsl:if>
- <!--xsl:choose>
- <xsl:when test="$currentEntries/param/selectedEntry[./searchPath/text() = $before]">
- <selectedEntry>
- <type><xsl:value-of select="$type"/></type>
- <type><xsl:value-of select="$currentEntries/param/selectedEntry/type"/></type>
- <searchPath><xsl:value-of select="$before"/></searchPath>
- </selectedEntry>
- </xsl:when>
- <xsl:otherwise>
- <selectedEntry>
- <type><xsl:value-of select="$type"/></type>
- <searchPath><xsl:value-of select="$before"/></searchPath>
- </selectedEntry>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:if-->
- <!-- handle the next entry in the list-->
- <xsl:if test="$after != '' ">
- <xsl:call-template name="decodeEntriesList">
- <xsl:with-param name="entriesList"><xsl:value-of select="$after"/></xsl:with-param>
- <xsl:with-param name="type"><xsl:value-of select="$type"/></xsl:with-param>
- <xsl:with-param name="currentEntries"><xsl:copy-of select="$currentEntries"/></xsl:with-param>
- </xsl:call-template>
- </xsl:if>
- </xsl:when>
- <xsl:otherwise>
- <xsl:if test="$entriesList != '' ">
- <xsl:call-template name="build">
- <xsl:with-param name="entriesList"><xsl:value-of select="$entriesList"/></xsl:with-param>
- <xsl:with-param name="type"><xsl:value-of select="$type"/></xsl:with-param>
- <xsl:with-param name="currentEntries"><xsl:copy-of select="$currentEntries"/></xsl:with-param>
- </xsl:call-template>
- </xsl:if>
- <!--xsl:choose>
- <xsl:when test="$currentEntries/param/selectedEntry[./searchPath/text() = $entriesList] ">
- <selectedEntry>
- <type><xsl:value-of select="$type"/></type>
- <type><xsl:value-of select="$currentEntries/param/selectedEntry/type"/></type>
- <searchPath><xsl:value-of select="$entriesList"/></searchPath>
- </selectedEntry>
- </xsl:when>
- <xsl:otherwise>
- <selectedEntry>
- <type><xsl:value-of select="$type"/></type>
- <searchPath><xsl:value-of select="$entriesList"/></searchPath>
- </selectedEntry>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:if-->
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <xsl:template name="build">
- <xsl:param name="entriesList"/>
- <xsl:param name="type"/>
- <xsl:param name="currentEntries"/>
- <xsl:choose>
- <xsl:when test="$currentEntries/param/selectedEntry[./searchPath/text() = $entriesList] ">
- <selectedEntry>
- <type><xsl:value-of select="$type"/></type>
- <type><xsl:value-of select="$currentEntries/param/selectedEntry/type"/></type>
- <searchPath><xsl:value-of select="$entriesList"/></searchPath>
- </selectedEntry>
- </xsl:when>
- <xsl:otherwise>
- <selectedEntry>
- <type><xsl:value-of select="$type"/></type>
- <searchPath><xsl:value-of select="$entriesList"/></searchPath>
- </selectedEntry>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
- </xsl:stylesheet>
|