123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136 |
- <?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:cm="http://developer.cognos.com/schemas/xts-cm/1/">
- <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
- <xsl:key name="installed-components" match="/results/cm:queryResponse/cm:queryReply[2]/cm:installedComponent/cm:componentID/cm:value" use="."/>
- <xsl:variable name="parameters" select="/results/config//parameter"/>
- <xsl:variable name="isDispatcher" select="/results/cm:queryResponse/cm:queryReply[1]/*/cm:objectClass = 'dispatcher'"/>
- <xsl:variable name="sort-key" select="/results/sortkey"/>
- <xsl:variable name="sort_order">
- <xsl:choose>
- <xsl:when test="substring($sort-key,2)='d'">
- <xsl:value-of select="'descending'"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="'ascending'"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:template match="results" priority="1">
- <xsl:apply-templates/>
- </xsl:template>
- <!--we don't want these elements, just eat them -->
- <xsl:template match="parentInfo|isService|config|sortkey|productLocale|cm:ancestors|cm:behaviours|cm:creationTime|cm:defaultAction|cm:defaultDescription|cm:defaultName|cm:defaultScreenTip|cm:disabled|cm:displaySequence|cm:hasChildren|cm:modificationTime|cm:owner|cm:properties|cm:searchPath|cm:usage|cm:version" priority="2"/>
- <xsl:template match="cm:queryResponse/cm:queryReply[1]/node()" priority="2">
- <xsl:variable name="n" select="child::*"/>
- <xsl:element name="{local-name()}" namespace="{namespace-uri()}">
- <xsl:copy-of select="@*"/>
- <xsl:choose>
- <xsl:when test="$sort-key = ''">
- <xsl:for-each select="$parameters[substring-after(@type,':')!='optionArrayProp'] | $parameters[local-name($n[local-name()=$parameters/@name and substring-after(@type,':')='optionArrayProp']) != '' and substring-after(@type,':')='optionArrayProp']/enum">
- <xsl:variable name="p" select="self::node()"/>
- <xsl:apply-templates select="$n[local-name()=$p/@name]"/>
- <xsl:apply-templates select=".[local-name()='enum']">
- <xsl:with-param name="options" select="$n[local-name()='overrideOptions' or local-name()='serviceDefaultOptions' ]"/>
- </xsl:apply-templates>
- </xsl:for-each>
- </xsl:when>
- <xsl:when test="starts-with($sort-key,'c')">
- <xsl:for-each select="$parameters[substring-after(@type,':')!='optionArrayProp'] | $parameters[local-name($n[local-name()=$parameters/@name and substring-after(@type,':')='optionArrayProp']) != '' and substring-after(@type,':')='optionArrayProp']/enum">
- <xsl:sort select="concat(../@label,@label)" order="{$sort_order}" lang="{string(/results/productLocale)}"/>
- <xsl:variable name="p" select="self::node()"/>
- <xsl:apply-templates select="$n[local-name()=$p/@name] | .[local-name()='enum']"/>
- </xsl:for-each>
- </xsl:when>
- <xsl:otherwise>
- <xsl:for-each select="$parameters[substring-after(@type,':')!='optionArrayProp'] | $parameters[local-name($n[local-name()=$parameters/@name and substring-after(@type,':')='optionArrayProp']) != '' and substring-after(@type,':')='optionArrayProp']/enum">
- <xsl:sort select="concat(@label,local-name())" order="{$sort_order}" lang="{string(/results/productLocale)}"/>
- <xsl:variable name="p" select="self::node()"/>
- <xsl:apply-templates select="$n[local-name()=$p/@name] | .[local-name()='enum']"/>
- </xsl:for-each>
- </xsl:otherwise>
- </xsl:choose>
- <xsl:apply-templates select="$n[local-name()='permissions']"/>
- <xsl:apply-templates select="$n[local-name()='objectClass']"/>
- </xsl:element>
- </xsl:template>
- <!-- the query should be to get the defaultName, so just copy it as is -->
- <xsl:template match="cm:queryReply[position()=last()]">
- <xsl:copy-of select="."/>
- </xsl:template>
- <!-- ignore advanced settings property for dispatchers and configuration folders. -->
- <xsl:template match="cm:advancedSettings[contains(' dispatcher configurationFolder ', concat(' ', ../cm:objectClass, ' '))]" priority="2"/>
- <!--Handle enums for cm:optionArrayProp parameters to facilitate them to appear as 'vitual' parameters within the settings xts eg. accessibility and flash enums for overrideOptiona parm-->
- <xsl:template match="enum[./../@type='cm:optionArrayProp']" priority="2">
- <xsl:param name="options"/>
- <xsl:element name="{concat('optionArrayProp_',substring-after(@value,'#'))}">
- <xsl:attribute name="category"><xsl:value-of select="../../@name"/></xsl:attribute>
- <xsl:attribute name="group"><xsl:value-of select="../../@label"/></xsl:attribute>
- <xsl:attribute name="type"><xsl:value-of select="../@type"/></xsl:attribute>
- <xsl:copy-of select="@*"/>
- <!-- we've matched our property, so simply copy everything under it -->
- <xsl:copy-of select="* | text()"/>
- <xsl:element name="options">
- <xsl:copy-of select="$options"/>
- </xsl:element>
- </xsl:element>
- </xsl:template>
- <!-- process CM properties -->
- <xsl:template match="cm:*[@type!='' and @type!='cm:optionArrayProp']" priority="1">
- <xsl:variable name="name" select="local-name()"/>
- <xsl:variable name="p" select="$parameters[@name=$name]"/>
- <xsl:variable name="isROLAPInstalled" select="/results/rolapIntegration/configuration/property[@name='rolapIntegration'] = 'true'"/>
- <!--
- For services we don't query for the installed components, so just show the runtime parameters for that service.
- For configuration, dispatcher and configurationFolder check the installedComponents, and only show the runtime
- parameters if the second queryReply isn't empty (i.e make sure there's a dispatcher somewhere).
- For a user with read-only permissions on a dispatcher just show the runtime parameters with no service dependencies.
- Make sure we always copy permissions.
- -->
- <xsl:if test="
- (not($p/@serviceDependency) and /results/cm:queryResponse/cm:queryReply[2]/*)
- or /results/parentInfo = 'true'
- or $name = 'permissions'
- or /results/isService = 'true'
- or (
- key('installed-components', $p/@serviceDependency)
- and /results/isService = 'false'
- and /results/cm:queryResponse/cm:queryReply[2]/*
- )
- or (not($p/@serviceDependency) and ($isDispatcher or /results/cm:queryResponse/cm:queryReply[3]/*))
- ">
- <xsl:copy>
- <xsl:attribute name="category"><xsl:value-of select="$p/../@name"/></xsl:attribute>
- <xsl:attribute name="group"><xsl:value-of select="$p/../@label"/></xsl:attribute>
- <xsl:copy-of select="$p/@*"/>
- <xsl:copy-of select="@*"/>
- <xsl:copy-of select="$p/*[local-name()='enum']"/>
- <!-- we've matched our property, so simply copy everything under it -->
- <xsl:copy-of select="* | text()"/>
- </xsl:copy>
- </xsl:if>
- </xsl:template>
- <!-- match all unmatched nodes -->
- <xsl:template match="node()" priority="0">
- <xsl:element name="{name()}" namespace="{namespace-uri()}">
- <xsl:copy-of select="@*"/>
- <xsl:apply-templates/>
- </xsl:element>
- </xsl:template>
- <!-- copy just the text -->
- <xsl:template match="text()" priority="0">
- <xsl:copy-of select="."/>
- </xsl:template>
- </xsl:stylesheet>
|