123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!--
- Licensed Materials - Property of IBM
- IBM Cognos Products: AGS
- (C) Copyright IBM Corp. 2005, 2008
- US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
- -->
- <xts:morphlet resolverBase="prompting" xmlns:xts="http://developer.cognos.com/schemas/xts/" messageBase="messages/AGS.xml,messages/portal.xml" requiredCapability="canUseEventStudio">
- <!--
- ===============================================================================================
- appendDocument - add the results of the requests into the right place
- ===============================================================================================
- -->
- <xts:block id="appendDocument" mode="interpret" processor="XSLT" type="exec">
- <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:bus="http://developer.cognos.com/schemas/bibus/3/">
- <xsl:output method="xml" version="1.0" encoding="UTF-8"/>
- <xsl:template match="/root">
- <xsl:variable name="CRLF">
- <xsl:text>
</xsl:text>
- </xsl:variable>
- <xts:sequence>
- <xts:append>
- <metadataTree>
- <xsl:choose>
- <xsl:when test="contains(./SOAP-ENV:Envelope/SOAP-ENV:Body/*/bus:result/bus:details/item/bus:metadata, '<?xml')">
- <xsl:value-of select="xtsext:replace(substring-after(./SOAP-ENV:Envelope/SOAP-ENV:Body/*/bus:result/bus:details/item/bus:metadata, '?>'), string($CRLF), string('&#xA;'), false)" disable-output-escaping="yes"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="xtsext:replace(./SOAP-ENV:Envelope/SOAP-ENV:Body/*/bus:result/bus:details/item/bus:metadata, string($CRLF), string('&#xA;'), false)" disable-output-escaping="yes"/>
- </xsl:otherwise>
- </xsl:choose>
- </metadataTree>
- </xts:append>
- </xts:sequence>
- </xsl:template>
- </xsl:stylesheet>
- </xts:block>
- <!--
- ===============================================================================================
- format the response - turn the metadata into some other kinda XML.
- ===============================================================================================
- -->
- <xts:block id="format" type="exec" mode="output" processor="XSLT" mimeType="text/xml" condition="/root/metadataTree/ResponseRoot" dependency="appendDocument">
- <!-- get the debug logic sheet -->
- <xts:logicsheet path="logicsheets/debuglogic.xslt"/>
- <xts:logicsheet path="logicsheets/portal.xsl"/>
- <!-- apply the form logic -->
- <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xts="http://developer.cognos.com/schemas/xts/" xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt" xmlns:dbg="http://developer.cognos.com/schemas/xts/logicsheets/xslt/debug/" xmlns:bus="http://developer.cognos.com/schemas/bibus/3/" xmlns:pf="http://developer.cognos.com/schemas/xts/pf" exclude-result-prefixes="xsl xts dbg xtsext bus pf">
- <xsl:output method="xml" version="1.0" encoding="UTF-8"/>
- <!-- start the output -->
- <xsl:template match="/root">
- <xsl:if test="./metadataTree/ResponseRoot">
- <xsl:variable name="markup">
- <xsl:call-template name="serialize-xml">
- <xsl:with-param name="node-set">
- <xsl:apply-templates select="./metadataTree/ResponseRoot"/>
- </xsl:with-param>
- </xsl:call-template>
- </xsl:variable>
- <!-- output what we've got -->
- <asyncReply>
- <xsl:value-of select="$markup"/>
- </asyncReply>
- </xsl:if>
- </xsl:template>
- <xsl:template match="/root/metadataTree/ResponseRoot">
- <metadata>
- <a>
- <xsl:call-template name="elementEncode"><xsl:with-param name="strVal"><xsl:value-of select="/root/env/param[@name='context']"/></xsl:with-param></xsl:call-template>
- <xsl:call-template name="elementEncode"><xsl:with-param name="strVal"><xsl:value-of select="/root/metadataTree/ResponseRoot/decimalSeparator/@value"/></xsl:with-param></xsl:call-template>
- <xsl:call-template name="elementEncode"><xsl:with-param name="strVal"><xsl:value-of select="/root/metadataTree/ResponseRoot/listSeparator/@value"/></xsl:with-param></xsl:call-template>
- </a>
- <a>
- <xsl:call-template name="elementEncode"><xsl:with-param name="strVal"><xsl:value-of select="/root/metadataTree/ResponseRoot/package/@name"/></xsl:with-param></xsl:call-template>
- <xsl:call-template name="elementEncode"><xsl:with-param name="strVal"><xsl:value-of select="/root/metadataTree/ResponseRoot/package/@screenTip"/></xsl:with-param></xsl:call-template>
- </a>
- <xsl:for-each select="./folder | ./querySubject | ./queryItemFolder | ./dimension | ./hierarchy | ./level | ./measure | ./measureFolder | ./member">
- <xsl:variable name="parent">
- <xsl:value-of select="@_path"/>
- </xsl:variable>
- <xsl:call-template name="buildTreeItemResponseString">
- <xsl:with-param name="node" select="."/>
- <xsl:with-param name="parent" select="$parent"/>
- </xsl:call-template>
- </xsl:for-each>
- </metadata>
- </xsl:template>
- <xsl:template name="buildTreeItemResponseString">
- <xsl:param name="node"/>
- <xsl:param name="parent"/>
- <!-- we build the member folder only for normal metadata requests -->
- <xsl:if test="(local-name($node) = 'level' or local-name($node) = 'hierarchy') and (not(/root/env/param[@name='memberRequest']) or /root/env/param[@name='memberRequest']!='true')">
- <!-- build a response string for the member folder -->
- <a>
- <xsl:call-template name="elementEncode"><xsl:with-param name="strVal">memberFolder</xsl:with-param></xsl:call-template>
- <xsl:call-template name="elementEncode"><xsl:with-param name="strVal"><xts:string id="MEMBERS_FOLDER_NAME"/></xsl:with-param></xsl:call-template>
- <!-- empty screen tip and we use the name of the node for the screen tip -->
- <xsl:call-template name="elementEncode"><xsl:with-param name="strVal"><xsl:text></xsl:text></xsl:with-param></xsl:call-template>
- <xsl:call-template name="elementEncode"><xsl:with-param name="strVal"><xsl:value-of select="@_path"/></xsl:with-param></xsl:call-template>
- <xsl:call-template name="elementEncode"><xsl:with-param name="strVal"><xsl:value-of select="@_ref"/></xsl:with-param></xsl:call-template>
- </a>
- </xsl:if>
- <xsl:choose>
- <xsl:when test="./member">
- <xsl:for-each select="$node/*[local-name()='member'][position() < /root/env/param[@name='memberDisplayCountLimit']]">
- <a>
- <xsl:call-template name="buildResponseString">
- <xsl:with-param name="parent" select="$parent"/>
- </xsl:call-template>
- </a>
- </xsl:for-each>
- <xsl:if test="count(./member) > /root/env/param[@name='memberDisplayCountLimit']">
- <!-- there's more members than we can dispaly - so build a new element to define the search -->
- <a>
- <xsl:call-template name="elementEncode"><xsl:with-param name="strVal">memberSearch</xsl:with-param></xsl:call-template>
- <xsl:call-template name="elementEncode"><xsl:with-param name="strVal"><xts:string id="MEMBERS_SEARCH_NAME"/></xsl:with-param></xsl:call-template>
- <!-- empty screen tip and we use the name of the node for the screen tip -->
- <xsl:call-template name="elementEncode"><xsl:with-param name="strVal"><xsl:text></xsl:text></xsl:with-param></xsl:call-template>
- <!-- pass the path of the parent object as an attribute -->
- <xsl:call-template name="elementEncode"><xsl:with-param name="strVal"><xsl:value-of select="@_path"/></xsl:with-param></xsl:call-template>
- </a>
- </xsl:if>
- </xsl:when>
- <xsl:otherwise>
- <xsl:for-each select="$node/*">
- <a>
- <xsl:call-template name="buildResponseString">
- <xsl:with-param name="parent" select="$parent"/>
- </xsl:call-template>
- </a>
- </xsl:for-each>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
- <xsl:template name="buildResponseString">
- <xsl:param name="parent"/>
- <xsl:choose>
- <xsl:when test="@isNamespace='1'">
- <xsl:call-template name="elementEncode"><xsl:with-param name="strVal">namespace</xsl:with-param></xsl:call-template>
- </xsl:when>
- <xsl:when test="@isHierarchical='1'">
- <xsl:call-template name="elementEncode"><xsl:with-param name="strVal">rollupMeasure</xsl:with-param></xsl:call-template>
- </xsl:when>
- <xsl:when test="@type='measure'">
- <xsl:call-template name="elementEncode"><xsl:with-param name="strVal">measureDimension</xsl:with-param></xsl:call-template>
- </xsl:when>
- <xsl:when test="@calcType='nameSet'">
- <xsl:call-template name="elementEncode"><xsl:with-param name="strVal">namedSet</xsl:with-param></xsl:call-template>
- </xsl:when>
- <xsl:when test="@calcType='macros'">
- <xsl:call-template name="elementEncode"><xsl:with-param name="strVal">calculationConstant</xsl:with-param></xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <xsl:call-template name="elementEncode"><xsl:with-param name="strVal"><xsl:value-of select="name()"/></xsl:with-param></xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
- <xsl:choose>
- <xsl:when test="name()='member'">
- <xsl:call-template name="buildMemberItemResponseString"><xsl:with-param name="node" select="."/></xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <xsl:call-template name="elementEncode"><xsl:with-param name="strVal"><xsl:value-of select="@name"/></xsl:with-param></xsl:call-template>
- <xsl:call-template name="elementEncode"><xsl:with-param name="strVal"><xsl:value-of select="@screenTip"/></xsl:with-param></xsl:call-template>
- <xsl:call-template name="elementEncode"><xsl:with-param name="strVal"><xsl:value-of select="@_path"/></xsl:with-param></xsl:call-template>
- <xsl:call-template name="elementEncode"><xsl:with-param name="strVal"><xsl:value-of select="@_ref"/></xsl:with-param></xsl:call-template>
- <xsl:if test="not(name()='folder' or name()='querySubject' or name()='queryItemFolder' or name()='filter' or name()='dimension' or name()='hierarchy')">
- <xsl:call-template name="buildQueryItemResponseString">
- <xsl:with-param name="node" select="."/>
- </xsl:call-template>
- </xsl:if>
- <xsl:call-template name="elementEncode"><xsl:with-param name="strVal"><xsl:value-of select="$parent"/></xsl:with-param></xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
- <xsl:template name="buildMemberItemResponseString">
- <xsl:param name="node"/>
- <xsl:call-template name="elementEncode"><xsl:with-param name="strVal"><xsl:value-of select="$node/@_path"/></xsl:with-param></xsl:call-template>
- <xsl:call-template name="elementEncode"><xsl:with-param name="strVal"><xsl:value-of select="$node/@_ref"/></xsl:with-param></xsl:call-template>
- <xsl:call-template name="elementEncode"><xsl:with-param name="strVal"><xsl:value-of select="$node/@levelLabel"/></xsl:with-param></xsl:call-template>
- <xsl:call-template name="elementEncode"><xsl:with-param name="strVal"><xsl:value-of select="$node/@levelNumber"/></xsl:with-param></xsl:call-template>
- <xsl:call-template name="elementEncode"><xsl:with-param name="strVal"><xsl:value-of select="$node/@levelUniqueName"/></xsl:with-param></xsl:call-template>
- <xsl:call-template name="elementEncode"><xsl:with-param name="strVal"><xsl:value-of select="$node/@memberCaption"/></xsl:with-param></xsl:call-template>
- <xsl:call-template name="elementEncode"><xsl:with-param name="strVal"><xsl:value-of select="$node/@memberUniqueName"/></xsl:with-param></xsl:call-template>
- <xsl:call-template name="elementEncode"><xsl:with-param name="strVal"><xsl:value-of select="$node/@parentUniqueName"/></xsl:with-param></xsl:call-template>
- </xsl:template>
- <xsl:template name="buildQueryItemResponseString">
- <xsl:param name="node"/>
- <xsl:call-template name="elementEncode"><xsl:with-param name="strVal"><xsl:value-of select="$node/@datatype"/></xsl:with-param></xsl:call-template>
- <xsl:call-template name="elementEncode"><xsl:with-param name="strVal"><xsl:value-of select="$node/@usage"/></xsl:with-param></xsl:call-template>
- <xsl:call-template name="elementEncode">
- <xsl:with-param name="strVal">
- <xsl:call-template name="aggregateConversion">
- <xsl:with-param name="strVal"><xsl:value-of select="$node/@regularAggregate"/></xsl:with-param>
- </xsl:call-template>
- </xsl:with-param>
- </xsl:call-template>
- <xsl:call-template name="elementEncode">
- <xsl:with-param name="strVal">
- <xsl:call-template name="aggregateConversion">
- <xsl:with-param name="strVal"><xsl:value-of select="$node/@semiAggregate"/></xsl:with-param>
- </xsl:call-template>
- </xsl:with-param>
- </xsl:call-template>
- <xsl:call-template name="elementEncode"><xsl:with-param name="strVal"><xsl:value-of select="$node/@promptType"/></xsl:with-param></xsl:call-template>
- <xsl:call-template name="elementEncode"><xsl:with-param name="strVal"><xsl:value-of select="$node/@displayType"/></xsl:with-param></xsl:call-template>
- <xsl:call-template name="elementEncode"><xsl:with-param name="strVal"><xsl:value-of select="$node/@sortOnRef"/></xsl:with-param></xsl:call-template>
- <xsl:call-template name="elementEncode"><xsl:with-param name="strVal"><xsl:value-of select="$node/@promptCascadeOnRef"/></xsl:with-param></xsl:call-template>
- <xsl:call-template name="elementEncode"><xsl:with-param name="strVal"><xsl:value-of select="$node/@promptFilterItemRef"/></xsl:with-param></xsl:call-template>
- </xsl:template>
- <xsl:template name="elementEncode">
- <xsl:param name="strVal"/>
- <xsl:element name="b">
- <xsl:value-of select="$strVal"/>
- </xsl:element>
- </xsl:template>
- <xsl:template name="aggregateConversion">
- <xsl:param name="strVal"/>
- <xsl:choose>
- <xsl:when test="$strVal = 'sum'">total</xsl:when>
- <xsl:when test="$strVal = 'min'">minimum</xsl:when>
- <xsl:when test="$strVal = 'max'">maximum</xsl:when>
- <xsl:when test="$strVal = 'avg'">average</xsl:when>
- <xsl:when test="$strVal = 'count' or $strVal = 'calculated' or $strVal = 'countDistinct' or
- $strVal = 'standardDeviation' or $strVal = 'variance' or $strVal = 'median' or
- $strVal = 'automatic'"><xsl:value-of select="$strVal"/></xsl:when>
- <xsl:otherwise>none</xsl:otherwise>
- </xsl:choose>
- </xsl:template>
- <pf:serialize-xml/>
- </xsl:stylesheet>
- </xts:block>
- </xts:morphlet>
|