123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!--
- Licensed Materials - Property of IBM
- IBM Cognos Products: ps
- (C) Copyright IBM Corp. 2005, 2013
- 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:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bus="http://developer.cognos.com/schemas/bibus/3/" xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/" exclude-result-prefixes="xsd xsi bus cm SOAP-ENV SOAP-ENC">
- <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
- <!-- global variables -->
- <xsl:variable name="xtscm" select="'http://developer.cognos.com/schemas/xts-cm/1/'"/>
- <xsl:variable name="xsd-prefix" select="'xsd'"/>
- <!-- main entry point -->
- <xsl:template match="/">
- <xsl:apply-templates/>
- </xsl:template>
- <!-- eat the soap header, if present -->
- <xsl:template match="SOAP-ENV:Header"/>
- <!-- process query, add, delete, update, move and copy responses -->
- <xsl:template match="bus:queryResponse|bus:addResponse|bus:deleteResponse|bus:updateResponse|bus:moveResponse|bus:copyResponse|bus:exportResponse|bus:importResponse|*[local-name()='listArchivesResponse']" priority="1">
- <xsl:element name="{local-name()}" namespace="{$xtscm}">
- <xsl:apply-templates/>
- </xsl:element>
- </xsl:template>
-
- <!-- process the cm cache query -->
- <xsl:template match="bus:queryCacheResult" priority="1">
- <xsl:element name="queryResponse" namespace="{$xtscm}">
- <xsl:apply-templates/>
- </xsl:element>
- </xsl:template>
-
- <xsl:template match="*[local-name()='getDeploymentOptionsResponse']|*[local-name()='getArchiveOptionsResponse']" priority="1">
- <xsl:element name="{local-name()}" namespace="{$xtscm}">
- <xsl:element name="deploymentOptions" namespace="{$xtscm}">
- <xsl:apply-templates/>
- </xsl:element>
- </xsl:element>
- </xsl:template>
- <xsl:template match="deploymentReport" priority="1">
- <xsl:element name="{local-name()}" namespace="{$xtscm}">
- <xsl:element name="deploymentOptions" namespace="{$xtscm}">
- <xsl:apply-templates/>
- </xsl:element>
- </xsl:element>
- </xsl:template>
- <!-- history details-->
- <xsl:template match="detail" priority="1">
- <xsl:element name="{local-name()}" namespace="{$xtscm}">
- <xsl:value-of select="value" disable-output-escaping="no"/>
- </xsl:element>
- </xsl:template>
- <xsl:template match="copyFault[fault]" priority="1">
- <xsl:copy-of select="."/>
- </xsl:template>
- <!-- handle the count for delete, update, move and copy -->
- <xsl:template match="count[@xsi:type='xsd:integer']" priority="1">
- <xsl:attribute name="{local-name()}"><xsl:value-of select="."/></xsl:attribute>
- </xsl:template>
- <!-- handle array type -->
- <xsl:template match="*[substring-after(@xsi:type, ':')='Array']" priority="2">
- <xsl:apply-templates/>
- </xsl:template>
-
- <!-- handle queryCacheResult type -->
- <xsl:template match="*[local-name()='result' and substring-after(@xsi:type, ':')='queryCacheResult']" priority="2">
- <xsl:apply-templates/>
- </xsl:template>
- <!-- transform an item in an array to its equivalent element -->
- <!-- Note: array elements are normally contained in <item>. Axis1.4 can create array elements with name identical to their array name -->
- <!-- See the ps unittest "postprocess" for more details on the syntax -->
- <xsl:template match="*[local-name()='item' or (substring-after(../@xsi:type, ':')='Array' and substring-after(@xsi:type, ':')!='Array' and local-name(.)=local-name(..))]" priority="1">
- <xsl:variable name="element-name">
- <xsl:choose>
- <xsl:when test="@xsi:type">
- <xsl:value-of select="substring-after(@xsi:type, ':')"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="substring-before(substring-after(../@SOAP-ENC:arrayType, ':'), '[')"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:element name="{$element-name}" namespace="{$xtscm}">
- <xsl:variable name="type" select="substring-before(substring-after(../@SOAP-ENC:arrayType, ':'),'[')"/>
- <xsl:choose>
- <!-- special case: if type is 'baseClass', add an element 'objectClass' -->
- <xsl:when test="$type='baseClass'">
- <xsl:variable name="object-class" select="substring-after(@xsi:type, ':')"/>
- <xsl:if test="$object-class!='baseClass'">
- <xsl:element name="objectClass" namespace="{$xtscm}">
- <xsl:value-of select="$object-class"/>
- </xsl:element>
- </xsl:if>
- <xsl:apply-templates/>
- </xsl:when>
- <!-- special case: multilingual token array -->
- <xsl:when test="$type='multilingualToken'">
- <xsl:attribute name="xml:lang"><xsl:value-of select="locale"/></xsl:attribute>
- <xsl:attribute name="type"><xsl:value-of select="@xsi:type"/></xsl:attribute>
- <xsl:apply-templates select="*[not(self::locale)]"/>
- </xsl:when>
- <!-- special case: multilingual string array -->
- <xsl:when test="$type='multilingualString'">
- <xsl:attribute name="xml:lang"><xsl:value-of select="locale"/></xsl:attribute>
- <xsl:attribute name="type"><xsl:value-of select="@xsi:type"/></xsl:attribute>
- <xsl:apply-templates select="*[not(self::locale)]"/>
- </xsl:when>
- <!-- special case: localeMap entry array -->
- <xsl:when test="$type='localeMapEntry'">
- <xsl:attribute name="xml:key"><xsl:value-of select="key"/></xsl:attribute>
- <xsl:attribute name="type"><xsl:value-of select="@xsi:type"/></xsl:attribute>
- <xsl:apply-templates select="*[not(self::key)]"/>
- </xsl:when>
- <!-- special case: retentionRule -->
- <xsl:when test="$type='retentionRule'">
- <xsl:call-template name="elements2attributes"/>
- </xsl:when>
- <!-- special case: gatewayMapping -->
- <xsl:when test="$type='gatewayMapping'">
- <xsl:call-template name="elements2attributes"/>
- </xsl:when>
- <!-- special case: packageDeploymentInfo -->
- <xsl:when test="$type='packageDeploymentInfo'">
- <xsl:for-each select="child::*">
- <xsl:choose>
- <xsl:when test="local-name() = 'sourceName' or local-name() = 'targetName'">
- <xsl:element name="{local-name()}" namespace="{$xtscm}">
- <xsl:apply-templates/>
- </xsl:element>
- </xsl:when>
- <xsl:otherwise>
- <xsl:apply-templates select="."/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:for-each>
- </xsl:when>
- <!-- special case: deploymentOption DEPRECATED. Will be removed in next major release.-->
- <!-- only options on a deployment object should be matched. Other options items should never make it to this point -->
- <xsl:when test="$type='deploymentOption' or $type='option'">
- <xsl:call-template name="elements2attributes-value2node"/>
- </xsl:when>
- <!--simpleParmValueItem contains simple properties such as "display" and "use" elements that have single value. Also, inherited properties such as "inclusive".
- The routingHintObject (hints) contains simple item properties such as objectClass and value.
- Here is an example of format that is expected from CM for routing:
- <routingTable xsi:type="cm:routingTableEntryArrayProp">
- <value xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="cm:routingTableEntry[1]">
- <item xsi:type="tns:routingTableEntry">
- <rule xsi:type="tns:routingRuleObject">
- <hints xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="routingHintObject[1]">
- <item xsi:type="tns:routingHintObject">
- <objectClass xsi:type="tns:classEnum">package</objectClass>
- <value xsi:type="xsd:string">GO Sales</value>
- </item>
- </hints>
- </rule>
- <serverGroupName xsi:type="xsd:string">sg1</serverGroupName>
- </item>
- </value>
- </routingTable>
- This will be transformed to this:
- <routingTableEntry>
- <rule type="tns:routingRuleObject">
- <routingHintObject>
- <objectClass>package</objectClass>
- <value>GO Sales</value>
- </routingHintObject>
- <routingHintObject>
- <objectClass>role</objectClass>
- <value>role1</value>
- </routingHintObject>
- </rule>
- <serverGroupName>sg1</serverGroupName>
- </routingTableEntry>
- -->
- <xsl:when test="$element-name = 'simpleParmValueItem' or $element-name='routingHintObject'">
- <xsl:for-each select="*">
- <xsl:element name="{local-name()}" namespace="{$xtscm}">
- <xsl:if test="@xsi:nil != ''">
- <xsl:attribute name="nil"><xsl:value-of select="@xsi:nil"/></xsl:attribute>
- </xsl:if>
- <xsl:value-of select="."/>
- </xsl:element>
- </xsl:for-each>
- </xsl:when>
- <xsl:when test="$element-name='parameterAssignmentDataItem'">
- <parameterName>
- <xsl:value-of select="./parameterName"/>
- </parameterName>
- <dataItemName>
- <xsl:value-of select="./dataItemName"/>
- </dataItemName>
- </xsl:when>
- <xsl:when test="$element-name='parameterAssignmentExpression'">
- <parameterName>
- <xsl:value-of select="./parameterName"/>
- </parameterName>
- <expression>
- <xsl:value-of select="./expression"/>
- </expression>
- </xsl:when>
- <!-- handle everything else -->
- <xsl:otherwise>
- <xsl:apply-templates/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:element>
- </xsl:template>
- <!-- translate the schemaInfo element into attributes -->
- <xsl:template match="*[substring-after(@xsi:type, ':')='schemaInfo']" priority="1">
- <xsl:call-template name="elements2attributes"/>
- </xsl:template>
- <!-- process all xsi:type -->
- <xsl:template match="*[@xsi:type!='']" priority="0">
- <xsl:choose>
- <xsl:when test="starts-with(@xsi:type,concat($xsd-prefix,':'))">
- <!-- handle xsd:xxxxxx types -->
- <xsl:choose>
- <xsl:when test="local-name()='value'">
- <xsl:choose>
- <!-- if we're dealing with runOptions or options then we need the value element -->
- <xsl:when test="ancestor::*[local-name() = 'runOptions']">
- <xsl:element name="{local-name()}" namespace="{$xtscm}">
- <xsl:apply-templates/>
- </xsl:element>
- </xsl:when>
- <!-- special case: we want only the content of xsd value -->
- <xsl:otherwise>
- <xsl:attribute name="type"><xsl:value-of select="../@xsi:type"/></xsl:attribute>
- <xsl:apply-templates/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:when>
- <!-- special case: permission/name -->
- <xsl:when test="local-name()='name' and substring-after(../@xsi:type, ':')='permission'">
- <xsl:attribute name="name"><xsl:value-of select="."/></xsl:attribute>
- </xsl:when>
- <xsl:otherwise>
- <!-- include the element and continue processing -->
- <xsl:element name="{local-name()}" namespace="{$xtscm}">
- <xsl:apply-templates/>
- </xsl:element>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:when>
- <xsl:otherwise>
- <xsl:variable name="localName" select="local-name()"/>
- <!-- handle cm:xxxxxx types -->
- <xsl:choose>
- <!-- special case: multilingualString -->
- <xsl:when test="$localName='value' and substring-after(@xsi:type, ':')='multilingualString'">
- <xsl:attribute name="xml:lang"><xsl:value-of select="locale"/></xsl:attribute>
- <xsl:attribute name="type"><xsl:value-of select="@xsi:type"/></xsl:attribute>
- <xsl:apply-templates select="*[not(self::locale)]"/>
- </xsl:when>
- <!-- special case: multilingualToken -->
- <xsl:when test="$localName='value' and substring-after(@xsi:type, ':')='multilingualToken'">
- <xsl:attribute name="xml:lang"><xsl:value-of select="locale"/></xsl:attribute>
- <xsl:attribute name="type"><xsl:value-of select="@xsi:type"/></xsl:attribute>
- <xsl:apply-templates select="*[not(self::locale)]"/>
- </xsl:when>
- <xsl:when test="$localName='value' and (substring-after(@xsi:type, ':')='baseReportActionEnum' or substring-after(@xsi:type, ':')='severityEnum' or substring-after(@xsi:type, ':')='powerPlayReportActionEnum')">
- <xsl:attribute name="type"><xsl:value-of select="../@xsi:type"/></xsl:attribute>
- <xsl:apply-templates/>
- </xsl:when>
- <!-- special case: userCapabilityPermission/userCapability -->
- <xsl:when test="local-name()='userCapability' and substring-after(../@xsi:type, ':')='userCapabilityPermission'">
- <xsl:attribute name="userCapability"><xsl:value-of select="."/></xsl:attribute>
- </xsl:when>
- <!-- special case: permission/access -->
- <xsl:when test="$localName='access' and (substring-after(../@xsi:type, ':')='permission' or substring-after(../@xsi:type, ':')='userCapabilityPermission')">
- <xsl:attribute name="access"><xsl:value-of select="."/></xsl:attribute>
- </xsl:when>
- <!-- special case: We need to disable output escaping for properties that contain XML data.
- Property Object
- =====================================================
- portalPage account
- state runTimeState
- executionDetails runHistory
- specification report/query
- advancedSettings config stuff
- -->
- <xsl:when test="$localName='portalPage' or $localName='state' or $localName='executionDetails' or ($localName='specification' and @type!='powerPlayServiceSpecificationProp') or $localName='advancedSettings'">
- <xsl:element name="{local-name()}" namespace="{$xtscm}">
- <xsl:attribute name="type"><xsl:value-of select="@xsi:type"/></xsl:attribute>
- <xsl:apply-templates select="*[substring-after(@xsi:type, ':')='schemaInfo']"/>
- <xsl:value-of select="value" disable-output-escaping="yes"/>
- </xsl:element>
- </xsl:when>
- <xsl:when test="$localName='report' or $localName='dispatcherID'">
- <xsl:element name="{local-name()}" namespace="{$xtscm}">
- <xsl:attribute name="type"><xsl:value-of select="@xsi:type"/></xsl:attribute>
- <xsl:apply-templates select="*[substring-after(@xsi:type, ':')='schemaInfo']"/>
- <!-- don't want the XML to be expanded - it'll pick up a namespace attribute otherwise -->
- <xsl:value-of select="value"/>
- </xsl:element>
- </xsl:when>
- <!-- special case for deploymentOptions. deploymentOptions are still needed to be processed in the post-process.xslt. Do not do a simple copy of options if they are on a deployment object.-->
- <xsl:when test="$localName='options' and substring-after(../@xsi:type, ':')!='exportDeployment' and substring-after(../@xsi:type, ':')!='importDeployment' and substring-after(../@xsi:type,':')!='powerPlayReport'">
- <!-- Make sure all the attribute values that start with 'cm:' get replaced with 'bus:' -->
- <xsl:apply-templates select="." mode="options"/>
- </xsl:when>
- <xsl:when test="$localName='options' and ( substring-after(../@xsi:type,':')='powerPlayReport')">
- <xsl:element name="{local-name()}" namespace="{$xtscm}">
- <xsl:for-each select="value/item">
- <xsl:variable name="class" select="substring-after(@xsi:type, ':')"/>
- <xsl:element name="{$class}" namespace="{$xtscm}">
- <cm:name>
- <xsl:value-of select="name"/>
- </cm:name>
- <cm:value>
- <xsl:value-of select="value"/>
- </cm:value>
- </xsl:element>
- </xsl:for-each>
- </xsl:element>
- </xsl:when>
- <!-- For searchPathStoreID add another element <id> containing the GUID only -->
- <xsl:when test="$localName = 'storeID'">
- <xsl:variable name="value">
- <xsl:choose>
- <xsl:when test="value and string(./value) != ''"><xsl:value-of select="value"/></xsl:when>
- <xsl:when test="string(child::node()) != ''"><xsl:value-of select="normalize-space(string(child::node()))"/></xsl:when>
- <xsl:otherwise></xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:element name="{local-name()}" namespace="{$xtscm}">
- <xsl:attribute name="type"><xsl:value-of select="@xsi:type"/></xsl:attribute>
- <xsl:if test="substring(@xsi:type, string-length(@xsi:type)-3) = 'Prop' and not(value)">
- <xsl:attribute name="nil">true</xsl:attribute>
- </xsl:if>
- <xsl:value-of select="$value"/>
- </xsl:element>
- </xsl:when>
- <xsl:otherwise>
- <!-- include the element and continue processing -->
- <xsl:element name="{local-name()}" namespace="{$xtscm}">
- <xsl:attribute name="type"><xsl:value-of select="@xsi:type"/></xsl:attribute>
- <xsl:if test="substring(@xsi:type, string-length(@xsi:type)-3) = 'Prop' and not(value)">
- <xsl:attribute name="nil">true</xsl:attribute>
- </xsl:if>
- <xsl:apply-templates/>
- </xsl:element>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
- <!--
- When dealing with options we have to replace all the 'cm:' in attribute values with 'bus:'. Since we deal with options in
- their raw form and when we're updating CM we're the namespace prefix 'bus' as the http://developer.cognos.com/schemas/bibus/3/. We
- don't specify the namespace prefix 'cm' in our update requests, so if we leave 'cm:' in the attribute values CM doesn't think that
- the attribute value has a namespace and they'll add it. This causes us to get 'cm:cm:<attribute value>' when we query CM after an
- update. Trakker bug 472828
- -->
- <xsl:template match="*" mode="options">
- <xsl:element name="{local-name()}">
- <xsl:for-each select="@*">
- <xsl:attribute name="{name()}">
- <xsl:choose>
- <xsl:when test="starts-with(.,'cm:')"><xsl:value-of select="concat('bus:',substring-after(.,'cm:'))"/></xsl:when>
- <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
- </xsl:choose>
- </xsl:attribute>
- </xsl:for-each>
- <xsl:apply-templates mode="options"/>
- </xsl:element>
- </xsl:template>
- <!-- REVISE: quick hack for IB#22 only -->
- <xsl:template match="permissions[./value/@xsi:nil='true']" priority="1">
- <xsl:element name="{local-name()}" namespace="{$xtscm}">
- <xsl:apply-templates/>
- <xsl:text>read write execute setPolicy traverse</xsl:text>
- </xsl:element>
- </xsl:template>
- <!-- convert the permissions array of NMTOKEN into a string of tokens -->
- <xsl:template match="permissions[@xsi:type='cm:nmtokenArrayProp']" priority="1">
- <xsl:element name="{local-name()}" namespace="{$xtscm}">
- <xsl:attribute name="type">xsd:string</xsl:attribute>
- <xsl:apply-templates select="*[substring-after(@xsi:type, ':')='schemaInfo']"/>
- <xsl:value-of select="normalize-space(value)"/>
- </xsl:element>
- </xsl:template>
- <!-- convert a data source's capabilities properties into an array of values -->
- <xsl:template match="capabilities[@xsi:type='cm:anyURIArrayProp']" priority="1">
- <xsl:element name="dataSourceCapabilities" namespace="{$xtscm}">
- <xsl:attribute name="type">xsd:string</xsl:attribute>
- <xsl:apply-templates select="*[substring-after(@xsi:type, ':')='schemaInfo']"/>
- <xsl:for-each select="./value/item">
- <xsl:element name="capability" namespace="{$xtscm}"><xsl:value-of select="."/></xsl:element>
- </xsl:for-each>
- </xsl:element>
- </xsl:template>
- <!-- convert the effectiveUserCapabilities -->
- <xsl:template match="effectiveUserCapabilities" priority="1">
- <xsl:element name="{local-name()}" namespace="{$xtscm}">
- <xsl:for-each select="./value/item">
- <xsl:variable name="capability" select="string(.)"/>
- <xsl:if test="$capability != ''">
- <xsl:element name="{$capability}" namespace="{$xtscm}"/>
- </xsl:if>
- </xsl:for-each>
- </xsl:element>
- </xsl:template>
- <xsl:template match="mostRecentEventList[@xsi:type='cm:baseClassArrayProp']" priority="1">
- <xsl:element name="{local-name()}" namespace="{$xtscm}">
- <xsl:if test="not(value/item)">
- <xsl:attribute name="nil">true</xsl:attribute>
- </xsl:if>
- <xsl:if test="value/item">
- <xsl:value-of select="value/item/searchPath/value/."/>
- </xsl:if>
- </xsl:element>
- </xsl:template>
- <!-- grab the text -->
- <xsl:template match="text()" priority="0">
- <!-- XLTC hack, check for empty text node -->
- <xsl:if test="normalize-space(.)!=''">
- <xsl:value-of select="."/>
- </xsl:if>
- </xsl:template>
- <xsl:template name="elements2attributes">
- <xsl:for-each select="child::*">
- <xsl:attribute name="{local-name()}"><xsl:value-of select="."/></xsl:attribute>
- </xsl:for-each>
- </xsl:template>
- <xsl:template name="elements2attributes-value2node">
- <xsl:for-each select="child::*[local-name() != 'value']">
- <xsl:attribute name="{local-name()}"><xsl:value-of select="."/></xsl:attribute>
- </xsl:for-each>
- <xsl:apply-templates select="child::*[local-name() = 'value']"/>
- </xsl:template>
- </xsl:stylesheet>
|