123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!--
- Licensed Materials - Property of IBM
- IBM Cognos Products: ps
- (C) Copyright IBM Corp. 2005, 2015
- 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).
- -->
- <!-- Since runOptions can be saved in CM for a jobDefinition and in JSM for a schedule on a report, we need this transform
- to change what we send to JSM into CM syntax. It's a mini CM/pre-process specific to runOptions-->
- <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
- xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt"
- xmlns:bus="http://developer.cognos.com/schemas/bibus/3/"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- 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" exclude-result-prefixes="xsl xtsext bus xsi SOAP-ENV SOAP-ENC xsd">
- <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
- <!--
- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- process the xts syntax to the new Content Manager SOAP call
- -->
- <xsl:template match="*[local-name()='parameters']" priority="2">
- <parameterValues xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="bus:parameterValue[{count(*[local-name()='parameterValue'])}]">
- <xsl:apply-templates/>
- </parameterValues>
- </xsl:template>
- <!-- handle all "parameters" templates -->
- <xsl:template match="*[local-name()='parameterValue']">
- <item xsi:type="bus:parameterValue">
- <name xsi:type="xsd:string"><xsl:value-of select="*[local-name()='name']"/></name>
- <value xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="bus:parmValueItem[{count(*[not(self::*[local-name()='name'])])}]">
- <xsl:apply-templates select="*[not(self::*[local-name()='name'])]"/>
- </value>
- </item>
- </xsl:template>
- <xsl:template match="*[local-name()='simpleParmValueItem']">
- <item xsi:type="bus:simpleParmValueItem">
- <inclusive xsi:type="xsd:boolean"><xsl:value-of select="*[local-name()='inclusive']"/></inclusive>
- <xsl:call-template name="setDisplayAndUse">
- <xsl:with-param name="display"><xsl:value-of select="*[local-name()='display']"/></xsl:with-param>
- <xsl:with-param name="use"><xsl:value-of select="*[local-name()='use']"/></xsl:with-param>
- </xsl:call-template>
- </item>
- </xsl:template>
- <xsl:template match="*[local-name()='boundRangeParmValueItem']">
- <item xsi:type="bus:boundRangeParmValueItem">
- <xsl:choose>
- <xsl:when test="*[local-name()='inclusive']!=''">
- <inclusive xsi:type="xsd:boolean"><xsl:value-of select="*[local-name()='inclusive']"/></inclusive>
- </xsl:when>
- <xsl:otherwise>
- <inclusive xsi:type="xsd:boolean">true</inclusive>
- </xsl:otherwise>
- </xsl:choose>
- <start xsi:type="bus:simpleParmValueItem">
- <inclusive xsi:type="xsd:boolean"><xsl:value-of select="*[local-name()='start']/*[local-name()='inclusive']"/></inclusive>
- <xsl:call-template name="setDisplayAndUse">
- <xsl:with-param name="display"><xsl:value-of select="*[local-name()='start']/*[local-name()='display']"/></xsl:with-param>
- <xsl:with-param name="use"><xsl:value-of select="*[local-name()='start']/*[local-name()='use']"/></xsl:with-param>
- </xsl:call-template>
- </start>
- <end xsi:type="bus:simpleParmValueItem">
- <inclusive xsi:type="xsd:boolean"><xsl:value-of select="*[local-name()='end']/*[local-name()='inclusive']"/></inclusive>
- <xsl:call-template name="setDisplayAndUse">
- <xsl:with-param name="display"><xsl:value-of select="*[local-name()='end']/*[local-name()='display']"/></xsl:with-param>
- <xsl:with-param name="use"><xsl:value-of select="*[local-name()='end']/*[local-name()='use']"/></xsl:with-param>
- </xsl:call-template>
- </end>
- </item>
- </xsl:template>
- <xsl:template match="*[local-name()='unboundedEndRangeParmValueItem']">
- <item xsi:type="bus:unboundedEndRangeParmValueItem">
- <xsl:choose>
- <xsl:when test="*[local-name()='inclusive']!=''">
- <inclusive xsi:type="xsd:boolean"><xsl:value-of select="*[local-name()='inclusive']"/></inclusive>
- </xsl:when>
- <xsl:otherwise>
- <inclusive xsi:type="xsd:boolean">true</inclusive>
- </xsl:otherwise>
- </xsl:choose>
- <start xsi:type="bus:simpleParmValueItem">
- <inclusive xsi:type="xsd:boolean"><xsl:value-of select="*[local-name()='start']/*[local-name()='inclusive']"/></inclusive>
- <xsl:call-template name="setDisplayAndUse">
- <xsl:with-param name="display"><xsl:value-of select="*[local-name()='start']/*[local-name()='display']"/></xsl:with-param>
- <xsl:with-param name="use"><xsl:value-of select="*[local-name()='start']/*[local-name()='use']"/></xsl:with-param>
- </xsl:call-template>
- </start>
- </item>
- </xsl:template>
- <xsl:template match="*[local-name()='unboundedStartRangeParmValueItem']">
- <item xsi:type="bus:unboundedStartRangeParmValueItem">
- <xsl:choose>
- <xsl:when test="*[local-name()='inclusive']!=''">
- <inclusive xsi:type="xsd:boolean"><xsl:value-of select="*[local-name()='inclusive']"/></inclusive>
- </xsl:when>
- <xsl:otherwise>
- <inclusive xsi:type="xsd:boolean">true</inclusive>
- </xsl:otherwise>
- </xsl:choose>
- <end xsi:type="bus:simpleParmValueItem">
- <inclusive xsi:type="xsd:boolean"><xsl:value-of select="*[local-name()='end']/*[local-name()='inclusive']"/></inclusive>
- <xsl:call-template name="setDisplayAndUse">
- <xsl:with-param name="display"><xsl:value-of select="*[local-name()='end']/*[local-name()='display']"/></xsl:with-param>
- <xsl:with-param name="use"><xsl:value-of select="*[local-name()='end']/*[local-name()='use']"/></xsl:with-param>
- </xsl:call-template>
- </end>
- </item>
- </xsl:template>
- <!-- Match the first hierarchicalParmValueItem -->
- <xsl:template match="*[local-name()='hierarchicalParmValueItem' and parent::*[local-name() != 'hierarchicalParmValueItem']]">
- <item xsi:type="bus:hierarchicalParmValueItem">
- <xsl:choose>
- <xsl:when test="*[local-name()='inclusive']!=''">
- <inclusive xsi:type="xsd:boolean"><xsl:value-of select="*[local-name()='inclusive']"/></inclusive>
- </xsl:when>
- <xsl:otherwise>
- <inclusive xsi:type="xsd:boolean">true</inclusive>
- </xsl:otherwise>
- </xsl:choose>
- <value xsi:type="bus:simpleParmValueItem">
- <inclusive xsi:type="xsd:boolean"><xsl:value-of select="*[local-name()='value']/*[local-name()='inclusive']"/></inclusive>
- <xsl:call-template name="setDisplayAndUse">
- <xsl:with-param name="display"><xsl:value-of select="*[local-name()='value']/*[local-name()='display']"/></xsl:with-param>
- <xsl:with-param name="use"><xsl:value-of select="*[local-name()='value']/*[local-name()='use']"/></xsl:with-param>
- </xsl:call-template>
- </value>
- <xsl:apply-templates select="*[local-name()='hierarchicalParmValueItem']"/>
- </item>
- </xsl:template>
- <!-- Match all the sub hierarchicalParmValueItem parameters -->
- <xsl:template match="*[local-name()='hierarchicalParmValueItem' and parent::*[local-name() = 'hierarchicalParmValueItem']]">
- <subNodes xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="bus:hierarchicalParmValueItem[{count(*[local-name()='hierarchicalParmValueItem'])}]">
- <item xsi:type="bus:hierarchicalParmValueItem">
- <xsl:choose>
- <xsl:when test="*[local-name()='inclusive']!=''">
- <inclusive xsi:type="xsd:boolean"><xsl:value-of select="*[local-name()='inclusive']"/></inclusive>
- </xsl:when>
- <xsl:otherwise>
- <inclusive xsi:type="xsd:boolean">true</inclusive>
- </xsl:otherwise>
- </xsl:choose>
- <value xsi:type="bus:simpleParmValueItem">
- <inclusive xsi:type="xsd:boolean"><xsl:value-of select="*[local-name()='value']/*[local-name()='inclusive']"/></inclusive>
- <xsl:call-template name="setDisplayAndUse">
- <xsl:with-param name="display"><xsl:value-of select="*[local-name()='value']/*[local-name()='display']"/></xsl:with-param>
- <xsl:with-param name="use"><xsl:value-of select="*[local-name()='value']/*[local-name()='use']"/></xsl:with-param>
- </xsl:call-template>
- </value>
- <xsl:apply-templates select="*[local-name()='hierarchicalParmValueItem']"/>
- </item>
- </subNodes>
- </xsl:template>
- <!--
- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- generic text() handler
- -->
- <xsl:template match="text()" priority="0">
- <xsl:copy-of select="."/>
- </xsl:template>
- <!--
- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- check for empty values and set to "nil"
- -->
- <xsl:template name="setDisplayAndUse">
- <xsl:param name="display"/>
- <xsl:param name="use"/>
- <xsl:choose>
- <xsl:when test="$display!=''">
- <display xsi:type="xsd:string"><xsl:value-of select="$display"/></display>
- </xsl:when>
- <xsl:otherwise>
- <display xsi:nil="true"/>
- </xsl:otherwise>
- </xsl:choose>
- <xsl:choose>
- <xsl:when test="$use!=''">
- <use xsi:type="xsd:string"><xsl:value-of select="$use"/></use>
- </xsl:when>
- <xsl:otherwise>
- <use xsi:nil="true"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
- </xsl:stylesheet>
|