123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!--
- Licensed Materials - Property of IBM
- IBM Cognos Products: cogadmin
- (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:xts="http://developer.cognos.com/schemas/xts/"
- xmlns:cm="http://developer.cognos.com/schemas/bibus/3/"
- xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
- exclude-result-prefixes="cm xsl xts SOAP-ENV">
- <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
- <xsl:variable name="xtscm" select="'http://developer.cognos.com/schemas/xts-cm/1/'"/>
- <xsl:key name="installed-components" match="/root/cm:queryResponse/*/item[2]/queryResult/item/componentID/value" use="."/>
- <xsl:template match="/root">
- <xsl:apply-templates/>
- </xsl:template>
- <!-- eat the soap header, if present -->
- <xsl:template match="SOAP-ENV:Header"/>
-
- <xsl:template match="advancedSettings" priority="3">
- <xsl:element name="advancedSettings">
- <xsl:copy-of select="@*"/>
- <xsl:element name="value">
- <xsl:value-of select="value" disable-output-escaping="yes"/>
- </xsl:element>
- </xsl:element>
- </xsl:template>
- <xsl:template match="config">
- <xsl:variable name="environment" select="/root/config/section[@name = 'environment']"/>
- <xsl:element name="config">
- <xsl:element name="section">
- <xsl:attribute name="name">advancedSettings</xsl:attribute>
- <xsl:attribute name="label"><xsl:value-of select="$environment/parameter[@name = 'advancedSettings']/@label"/></xsl:attribute>
- <xsl:element name="parameter">
- <xsl:copy-of select="$environment/parameter[@name = 'advancedSettings']/@*"/>
- </xsl:element>
- </xsl:element>
- <xsl:apply-templates/>
- </xsl:element>
- </xsl:template>
-
- <xsl:template match="parameter[@name = 'advancedSettings']"/>
-
- <xsl:template match="*" priority="-2">
- <xsl:variable name="objectClass" select="../objectClass/value/."/>
- <xsl:choose>
- <xsl:when test="($objectClass = 'configuration') or ($objectClass = 'dispatcher')">
- <xsl:variable name="isAcquired" select="string(./schemaInfo/acquired/.) = 'true'"/>
- <xsl:variable name="propertyName" select="local-name()"/>
- <xsl:variable name="serviceDependency" select="string(/root/config/section/parameter[@name = $propertyName]/@serviceDependency)"/>
- <xsl:choose>
- <!-- Copy the local element when the service dependency is empty i.e. the element might or might not be related to the settings -->
- <xsl:when test="$serviceDependency = ''">
- <xsl:copy>
- <xsl:copy-of select="@*"/>
- <xsl:apply-templates/>
- </xsl:copy>
- </xsl:when>
- <!-- Copy the local element: The element is related to the settings and satisfy the conditions. -->
- <xsl:when test="($serviceDependency != '') and (key('installed-components', string($serviceDependency)) != '') and not($isAcquired)">
- <xsl:copy>
- <xsl:copy-of select="@*"/>
- <xsl:apply-templates/>
- </xsl:copy>
- </xsl:when>
- </xsl:choose>
- </xsl:when>
- <xsl:otherwise>
- <xsl:copy>
- <xsl:copy-of select="@*"/>
- <xsl:apply-templates/>
- </xsl:copy>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- </xsl:stylesheet>
|