123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200 |
- <?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: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">
- <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 select="SOAP-ENV:Body/bus:queryResponse"/>
- </xsl:template>
- <xsl:template match="bus:queryResponse">
- <queryResponse xmlns="http://developer.cognos.com/schemas/xts-cm/1/">
- <queryReply>
- <xsl:apply-templates select="queryResult/replies/item[1]/queryResult/item | returns/item[1]/queryResult/item"/>
- </queryReply>
- <queryReply>
- <xsl:apply-templates select="queryResult/replies/item[2]/queryResult/item | returns/item[2]/queryResult/item"/>
- </queryReply>
- <queryReply>
- <xsl:apply-templates select="queryResult/replies/item[3]/queryResult/item | returns/item[3]/queryResult/item"/>
- </queryReply>
- <xsl:apply-templates select="queryResult/cacheValidator"/>
- </queryResponse>
- </xsl:template>
- <xsl:template match="item">
- <xsl:variable name="class" select="substring-after(@xsi:type, ':')"/>
- <xsl:element name="{$class}" namespace="http://developer.cognos.com/schemas/xts-cm/1/">
- <cm:objectClass><xsl:value-of select="$class"/></cm:objectClass>
- <xsl:apply-templates select="*[not(contains(@xsi:type, 'ArrayProp'))]"/>
- <xsl:if test="base">
- <cm:base>
- <xsl:apply-templates select="base/value/item"/>
- </cm:base>
- </xsl:if>
- <xsl:if test="target">
- <cm:target>
- <xsl:apply-templates select="target/value/item"/>
- </cm:target>
- </xsl:if>
- <xsl:if test="metadataModelPackage">
- <cm:metadataModelPackage>
- <xsl:apply-templates select="metadataModelPackage/value/item"/>
- </cm:metadataModelPackage>
- </xsl:if>
- <xsl:if test="portalPages">
- <cm:portalPages>
- <xsl:apply-templates select="portalPages/value/item"/>
- </cm:portalPages>
- </xsl:if>
- <xsl:apply-templates select="ancestors"/>
- <xsl:apply-templates select="permissions"/>
- <xsl:apply-templates select="effectiveUserCapabilities"/>
- <xsl:apply-templates select="userInterfaces"/>
- <xsl:apply-templates select="defaultOutputFormat"/>
- <xsl:apply-templates select="options"/>
- <xsl:apply-templates select="mostRecentEventList"/>
- </xsl:element>
- </xsl:template>
- <xsl:template match="*[not(contains(@xsi:type, 'ArrayProp'))]" priority="-99">
- <!-- simple properties -->
- <xsl:element name="{local-name()}" namespace="http://developer.cognos.com/schemas/xts-cm/1/">
- <xsl:choose>
- <xsl:when test="starts-with(local-name(),'execution') and not(value)">
- <xsl:attribute name="nil">true</xsl:attribute>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="value"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:element>
- <xsl:if test="local-name() = 'storeID'">
- <xsl:element name="searchPathID" namespace="http://developer.cognos.com/schemas/xts-cm/1/"><xsl:value-of select="concat('storeID("', normalize-space(.), '")')"/></xsl:element>
- </xsl:if>
- </xsl:template>
-
- <xsl:template match="specification">
- <xsl:element name="{local-name()}" namespace="{$xtscm}">
- <xsl:attribute name="type"><xsl:value-of select="@xsi:type"/></xsl:attribute>
- <xsl:value-of select="value" disable-output-escaping="yes"/>
- </xsl:element>
- </xsl:template>
- <xsl:template match="ancestors">
- <cm:ancestors>
- <xsl:for-each select="value/item">
- <cm:ancestorInfo>
- <cm:objectClass><xsl:value-of select="objectClass"/></cm:objectClass>
- <cm:searchPath><xsl:value-of select="searchPath"/></cm:searchPath>
- <cm:title><xsl:value-of select="title"/></cm:title>
- <cm:storeID><xsl:value-of select="storeID"/></cm:storeID>
- </cm:ancestorInfo>
- </xsl:for-each>
- </cm:ancestors>
- </xsl:template>
- <xsl:template match="permissions">
- <cm:permissions>
- <xsl:for-each select="value/item">
- <xsl:if test="position() > 1"><xsl:text> </xsl:text></xsl:if>
- <xsl:value-of select="."/>
- </xsl:for-each>
- </cm:permissions>
- </xsl:template>
-
- <xsl:template match="effectiveUserCapabilities">
- <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="options">
- <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:choose>
- <xsl:when test="value/item"><xsl:value-of select="value/item[1]"/></xsl:when>
- <xsl:otherwise><xsl:value-of select="value"/></xsl:otherwise>
- </xsl:choose>
- </cm:value>
- </xsl:element>
- </xsl:for-each>
- </xsl:element>
- </xsl:template>
-
- <xsl:template match="userInterfaces">
- <cm:userInterfaces>
- <xsl:for-each select="value/item">
- <cm:uiComponentEnum>
- <xsl:value-of select="."/>
- </cm:uiComponentEnum>
- </xsl:for-each>
- </cm:userInterfaces>
- </xsl:template>
- <xsl:template match="defaultOutputFormat">
- <cm:defaultOutputFormat>
- <xsl:if test="not(value/item)">
- <xsl:attribute name="nil">true</xsl:attribute>
- </xsl:if>
- <xsl:if test="value/item">
- <cm:string><xsl:value-of select="value/item"/></cm:string>
- </xsl:if>
- </cm:defaultOutputFormat>
- </xsl:template>
- <xsl:template match="*[local-name() = 'cacheValidator']">
- <xsl:element name="validator" namespace="http://developer.cognos.com/schemas/xts-cm/1/">
- <xsl:if test="string(.)!='NOT_SUPPORTED'"><xsl:value-of select="."/></xsl:if>
- </xsl:element>
- </xsl:template>
-
- <xsl:template match="state">
- <xsl:value-of select="./value" disable-output-escaping="yes"/>
- </xsl:template>
-
- <xsl:template match="mostRecentEventList">
- <cm:mostRecentEventList>
- <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>
- </cm:mostRecentEventList>
- </xsl:template>
- </xsl:stylesheet>
|