123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152 |
- <?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).
- -->
- <!--
- Transform to merge the report execution option with the options array. This should go away once the report
- options are deprecated.
- -->
- <xsl:stylesheet version="1.0"
- xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/"
- xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:bus="http://developer.cognos.com/schemas/bibus/3/"
- xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
- exclude-result-prefixes="cm xsl bus xsi SOAP-ENC">
-
- <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
- <xsl:template match="/root/*" priority="1">
- <options xmlns="" xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="bus:option[]">
- <value xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="bus:option[]">
- <!-- copy all the options that do not require special handling -->
- <xsl:copy-of select="*[local-name()='options']/*[local-name()='value']/*[local-name()='item' and not (contains(' selectionBasedFeatures prompt outputFormat outputLocale outputPageOrientation outputPageDefinition allowAnnotations ', concat(' ', *[local-name()='name'], ' ')))]"/>
-
- <!-- special handling for the other options -->
- <!-- format -->
- <xsl:choose>
- <xsl:when test="cm:executionFormat != ''">
- <item xsi:type="cm:runOptionStringArray">
- <name xsi:type="cm:runOptionEnum">outputFormat</name>
- <value xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="xsd:string[1]">
- <item xsi:type="xsd:string"><xsl:value-of select="cm:executionFormat"/></item>
- </value>
- </item>
- </xsl:when>
- <xsl:otherwise>
- <xsl:copy-of select="*[local-name() = 'options']/*[local-name() = 'value']/*[local-name() = 'item' and ./*[local-name() = 'name' and . = 'outputFormat']]"/>
- </xsl:otherwise>
- </xsl:choose>
-
- <!-- language -->
- <xsl:choose>
- <xsl:when test="cm:executionLocale != ''">
- <item xsi:type="cm:runOptionStringArray">
- <name xsi:type="cm:runOptionEnum">outputLocale</name>
- <value xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="xsd:string[1]">
- <item xsi:type="xsd:string"><xsl:value-of select="cm:executionLocale"/></item>
- </value>
- </item>
- </xsl:when>
- <xsl:otherwise>
- <xsl:copy-of select="*[local-name() = 'options']/*[local-name() = 'value']/*[local-name() = 'item' and ./*[local-name() = 'name' and . = 'outputLocale']]"/>
- </xsl:otherwise>
- </xsl:choose>
-
- <!-- page orientation -->
- <xsl:choose>
- <xsl:when test="cm:executionPageOrientation != ''">
- <item xsi:type="bus:runOptionString">
- <name xsi:type="bus:runOptionEnum">outputPageOrientation</name>
- <value xsi:type="xsd:string"><xsl:value-of select="cm:executionPageOrientation"/></value>
- </item>
- </xsl:when>
- <xsl:otherwise>
- <xsl:copy-of select="*[local-name() = 'options']/*[local-name() = 'value']/*[local-name() = 'item' and ./*[local-name() = 'name' and . = 'outputPageOrientation']]"/>
- </xsl:otherwise>
- </xsl:choose>
- <!-- selectionBasedFeatures -->
- <xsl:choose>
- <xsl:when test="*[local-name() = 'options']/*[local-name() = 'value']/*[local-name() = 'item' and ./*[local-name() = 'name' and . = 'selectionBasedFeatures']] != ''">
- <xsl:copy-of select="*[local-name() = 'options']/*[local-name() = 'value']/*[local-name() = 'item' and ./*[local-name() = 'name' and . = 'selectionBasedFeatures']]"/>
- </xsl:when>
- <xsl:otherwise>
- <item xsi:type="bus:runOptionBoolean">
- <name xsi:type="bus:runOptionEnum">selectionBasedFeatures</name>
- <value xsi:type="xsd:boolean">true</value>
- </item>
- </xsl:otherwise>
- </xsl:choose>
- <!-- allowAnnotations -->
- <xsl:choose>
- <xsl:when test="*[local-name() = 'options']/*[local-name() = 'value']/*[local-name() = 'item' and ./*[local-name() = 'name' and . = 'allowAnnotations']] != ''">
- <xsl:copy-of select="*[local-name() = 'options']/*[local-name() = 'value']/*[local-name() = 'item' and ./*[local-name() = 'name' and . = 'allowAnnotations']]"/>
- </xsl:when>
- <xsl:otherwise>
- <item xsi:type="bus:runOptionBoolean">
- <name xsi:type="bus:runOptionEnum">allowAnnotations</name>
- <value xsi:type="xsd:boolean">false</value>
- </item>
- </xsl:otherwise>
- </xsl:choose>
- <!-- writeCompleteHistory -->
- <xsl:choose>
- <xsl:when test="*[local-name() = 'options']/*[local-name() = 'value']/*[local-name() = 'item' and ./*[local-name() = 'name' and . = 'writeCompleteHistory']] != ''">
- <xsl:copy-of select="*[local-name() = 'options']/*[local-name() = 'value']/*[local-name() = 'item' and ./*[local-name() = 'name' and . = 'writeCompleteHistory']]"/>
- </xsl:when>
- <xsl:otherwise>
- <item xsi:type="bus:monitorOptionBoolean">
- <name xsi:type="bus:monitorOptionEnum">writeCompleteHistory</name>
- <value xsi:type="xsd:boolean">true</value>
- </item>
- </xsl:otherwise>
- </xsl:choose>
-
- <!-- paper size -->
- <xsl:choose>
- <xsl:when test="cm:executionPageDefinition/cm:pageDefinition/cm:searchPath != ''">
- <item xsi:type="bus:runOptionString">
- <name xsi:type="bus:runOptionEnum">outputPageDefinition</name>
- <value xsi:type="xsd:string"><xsl:value-of select="cm:executionPageDefinition/cm:pageDefinition/cm:searchPath"/></value>
- </item>
- </xsl:when>
- <xsl:otherwise>
- <xsl:copy-of select="*[local-name() = 'options']/*[local-name() = 'value']/*[local-name() = 'item' and ./*[local-name() = 'name' and . = 'outputPageDefinition']]"/>
- </xsl:otherwise>
- </xsl:choose>
- <!-- prompt -->
- <xsl:choose>
- <xsl:when test="cm:executionPrompt != ''">
- <item xsi:type="cm:runOptionBoolean">
- <name xsi:type="cm:runOptionEnum">prompt</name>
- <value xsi:type="xsd:boolean"><xsl:value-of select="cm:executionPrompt"/></value>
- </item>
- </xsl:when>
- <xsl:otherwise>
- <xsl:copy-of select="*[local-name() = 'options']/*[local-name() = 'value']/*[local-name() = 'item' and ./*[local-name() = 'name' and . = 'prompt']]"/>
- </xsl:otherwise>
- </xsl:choose>
- </value>
- </options>
- </xsl:template>
-
-
- </xsl:stylesheet>
|