123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269 |
- <?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.
- -->
- <!--
- ===============================================================================================
- Logic sheet for dealing with "special" properties stored in CM.
- ===============================================================================================
- -->
- <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:cms="http://developer.cognos.com/schemas/xts/logic-sheet/xslt/cms/1/" xmlns:xts="http://developer.cognos.com/schemas/xts/" xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt" xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/" xmlns:out="dummy-uri" exclude-result-prefixes="cms xtsext">
- <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
- <xsl:namespace-alias stylesheet-prefix="out" result-prefix="xsl"/>
- <!-- Apply "special" processing when saving certain CM poperties -->
- <xsl:template match="cms:prop-save">
- <!-- Handle unwritable properties -->
- <out:template match="*[local-name() = 'param'][@name = 'm_p_path']"/>
- <out:template match="*[local-name() = 'param'][@name = 'm_p_searchPath']"/>
- <!-- handle building the run options property -->
- <!-- we have to match all the runOptions that we support here since we have to associate a type (int, string, ...) to them to pass along to pre-process -->
- <out:template name="build_runOptions">
- <out:param name="env"/>
- <out:param name="jobStep" select="false()"/>
- <out:if test="$env/*[local-name()='param' and starts-with(@name,'m_ro_')]">
- <runOptions xmlns="http://developer.cognos.com/schemas/xts-cm/1/">
- <!-- all the runOptionBoolean (m_ro_email, m_ro_emailAsAsttachment, m_ro_emailAsURL, m_ro_print, m_ro_saveOutput) -->
- <out:for-each select="$env/*[@name = 'm_ro_burst' or @name='m_ro_print' or @name='m_ro_prompt']">
- <out:variable name="value" select="."/>
- <out:if test="$value != ''">
- <out:variable name="runOptionName" select="substring-after(@name, 'm_ro_')"/>
- <runOption class="runOptionBoolean">
- <name>
- <out:value-of select="$runOptionName"/>
- </name>
- <value type="boolean">
- <out:value-of select="."/>
- </value>
- </runOption>
- </out:if>
- </out:for-each>
- <!-- special cases were we have to save a value of false in CM -->
- <out:if test="not($jobStep) and not($env/*[@name='m_ro_burst']) and $env/*[@name='specify_burst']">
- <runOption class="runOptionBoolean">
- <name>burst</name>
- <value type="boolean">false</value>
- </runOption>
- </out:if>
- <!-- special cases were we have to save a value of false in CM -->
- <out:if test="not($env/*[@name='m_ro_prompt']) and $env/*[@name='changed_m_ro_prompt']">
- <runOption class="runOptionBoolean">
- <name>prompt</name>
- <value type="boolean">false</value>
- </runOption>
- </out:if>
- <!-- m_ro_outputPageDefinition, m_ro_outputPageOrientation -->
- <!-- only save these values if the PDF checkbox is checked and the specify checkbox is checked or not present -->
- <out:if test="$env/*[@name='m_ro_outputFormat_PDF'] = 'PDF' and (not($env/*[@name='changed_specify_format']) or $env/*[@name='specify_format']='checked')">
- <out:for-each select="$env/*[@name='m_ro_outputPageDefinition' or @name='m_ro_outputPageOrientation']">
- <out:if test=". != 'default'">
- <out:variable name="runOptionName" select="substring-after(@name, 'm_ro_')"/>
- <runOption class="runOptionString">
- <name>
- <out:value-of select="$runOptionName"/>
- </name>
- <value type="string">
- <out:value-of select="."/>
- </value>
- </runOption>
- </out:if>
- </out:for-each>
- </out:if>
- <!-- m_ro_printerAddress, m_ro_printer -->
- <!-- only save these values if the printer checkbox is checked -->
- <out:choose>
- <out:when test="$env/*[@name='m_ro_print']='true'">
- <out:for-each select="$env/*[@name='m_ro_printerAddress' or @name='m_ro_printer']">
- <out:variable name="runOptionName" select="substring-after(@name, 'm_ro_')"/>
- <!-- we use either 'printer' or 'printerAddress' to specify a printer.-->
- <out:if test="$env/*[@name='ro_printer_kw'] = $runOptionName">
- <runOption class="runOptionString">
- <name>
- <out:value-of select="$runOptionName"/>
- </name>
- <value type="string">
- <out:value-of select="."/>
- </value>
- </runOption>
- </out:if>
- </out:for-each>
- </out:when>
- <out:when test="not($jobStep)">
- <runOption class="runOptionBoolean">
- <name>print</name>
- <value type="boolean">false</value>
- </runOption>
- </out:when>
- </out:choose>
- <!-- if we're doing a saveAs -->
- <out:choose>
- <out:when test="$env/*[@name='save_how'] and $env/*[@name='save_how']='new_entry'">
- <runOption class="runOptionSaveAs">
- <name>saveAs</name>
- <property name="objectClass" type="reportSaveAsEnum">
- <out:value-of select="$env/*[@name='m_ro_saveAsType']"/>
- </property>
- <property name="objectName" type="multilingualToken">
- <item type="multilingualToken">
- <locale type="string">
- <out:value-of select="$contentLocale"/>
- </locale>
- <value type="string">
- <out:value-of select="$env/*[@name='m_ro_saveAsName']"/>
- </value>
- </item>
- </property>
- <property name="parentSearchPath" type="string">
- <out:value-of select="$env/*[@name='m_ro_saveAsPath']"/>
- </property>
- </runOption>
- </out:when>
- <out:when test="$env/*[@name='m_ro_saveOutput'] and $env/*[@name='m_ro_saveOutput']!=''">
- <runOption class="runOptionBoolean">
- <name>
- <out:value-of select="'saveOutput'"/>
- </name>
- <value type="boolean">
- <out:value-of select="$env/*[@name='m_ro_saveOutput']"/>
- </value>
- </runOption>
- </out:when>
- <out:when test="not($jobStep) and not($env/*[@name='m_ro_saveOutput'])">
- <runOption class="runOptionBoolean">
- <name>saveOutput</name>
- <value type="boolean">false</value>
- </runOption>
- </out:when>
- </out:choose>
- <out:if test="$env/*[@name='m_ro_email'] != ''">
- <runOption class="runOptionBoolean">
- <name>email</name>
- <value type="boolean">true</value>
- </runOption>
- </out:if>
- <!-- email related runOptions
- < if we're not emailing as an attachement, then set the runOption to false
- <out:if test="not($jobStep) and not($env/*[@name='m_ro_emailAsAttachment'])">
- <runOption class="runOptionBoolean">
- <name>emailAsAttachment</name>
- <value type="boolean">false</value>
- </runOption>
- </out:if>
- < if we're not emailing as a URL, then set the runOption to false
- <out:if test="not($jobStep) and not($env/*[@name='m_ro_emailAsURL'])">
- <runOption class="runOptionBoolean">
- <name>emailAsURL</name>
- <value type="boolean">false</value>
- </runOption>
- </out:if>
-
- <- emailSubject and emailBody - runOptionString
- <out:for-each select="$env/*[@name='m_ro_emailBody' or @name='m_ro_emailSubject']">
- <out:variable name="runOptionName" select="substring-after(@name, 'm_ro_')"/>
- <runOption class="runOptionMultilingualString">
- <name><out:value-of select="$runOptionName"/></name>
- <items type="cm:multilingualString">
- <item type="multilingualString">
- <locale type="string"><out:value-of select="$contentLocale"/></locale>
- <value type="string"><out:value-of select="."/></value>
- </item>
- </items>
- </runOption>
- </out:for-each>
-
- <- emailTo, emailToAddress - runOptionStringArray
- <out:if test="(not(/root/env/param[@name='m_ro_burst']) or $env/*[@name='visited_job_properties'] or $env/*[@name='run_with_options_job'])and /root/emailToRunOptions">
- <out:copy-of select="/root/emailToRunOptions/*"/>
- </out:if>
- </out:when>
- <out:when test="not($jobStep)">
- <runOption class="runOptionBoolean">
- <name>email</name>
- <value type="boolean">false</value>
- </runOption>
- </out:when>
- </out:choose-->
- <!-- copy the delivery options created by the email options page
- but we re wrap them, so they can pass through pre-process undigested-->
- <out:for-each select="$env/options/value/item">
- <xtscm:deliveryOption xmlns:xtscm="http://developer.cognos.com/schemas/xts-cm/1/" cmStyle="true">
- <out:copy-of select="."/>
- </xtscm:deliveryOption>
- </out:for-each>
- <!-- outputFormat - runOptionStringArray-->
- <out:if test="$env/*[starts-with(@name,'m_ro_outputFormat')] and (not($env/*[@name='changed_specify_format']) or $env/*[@name='specify_format']='checked')">
- <xsl:call-template name="build_runOptionArray">
- <xsl:with-param name="class" select="'runOptionStringArray'"/>
- <xsl:with-param name="type" select="'stringArray'"/>
- <xsl:with-param name="name" select="'outputFormat'"/>
- </xsl:call-template>
- </out:if>
- <!-- outputLocale - runOptionLanguageArray -->
- <out:if test="$env/*[@name='m_ro_outputLocale'] and (not($env/*[@name='changed_specify_language']) or $env/*[@name='specify_language']='checked')">
- <xsl:call-template name="build_runOptionArray">
- <xsl:with-param name="class" select="'runOptionLanguageArray'"/>
- <xsl:with-param name="type" select="'LanguageArray'"/>
- <xsl:with-param name="name" select="'outputLocale'"/>
- </xsl:call-template>
- </out:if>
- </runOptions>
- </out:if>
- </out:template>
- </xsl:template>
- <xsl:template name="build_runOptionArray">
- <xsl:param name="class"/>
- <xsl:param name="type"/>
- <xsl:param name="name"/>
- <runOption xmlns="http://developer.cognos.com/schemas/xts-cm/1/" class="{$class}">
- <name>
- <xsl:value-of select="$name"/>
- </name>
- <items>
- <out:for-each select="$env/*[starts-with(@name,concat('m_ro_','{$name}'))]">
- <out:if test="(@name!='m_ro_outputFormat_HTML' or $env/*[@name='m_ro_outputF_HTML_Type']='true') and (@name!='m_ro_outputFormat_XLS2000' or $env/*[@name='m_ro_outputF_XLS2000_Type']='true') and . != ''">
- <item>
- <out:value-of select="."/>
- </item>
- </out:if>
- </out:for-each>
- </items>
- </runOption>
- </xsl:template>
- <xsl:template match="*">
- <xsl:copy>
- <xsl:copy-of select="@*"/>
- <xsl:apply-templates/>
- </xsl:copy>
- </xsl:template>
-
- <!-- Apply "special" processing when saving certain CM poperties -->
- <xsl:template match="cms:build_keyItems">
- <out:template name="build_keyItems">
- <out:param name="keyItems"/>
- <out:variable name="before">
- <out:value-of select="substring-before($keyItems,';')"/>
- </out:variable>
- <out:variable name="after">
- <out:value-of select="substring-after($keyItems,';')"/>
- </out:variable>
- <out:if test="string-length(normalize-space($before)) > 0">
- <cm:item>
- <out:value-of select="normalize-space($before)"/>
- </cm:item>
- </out:if>
- <out:if test="string-length(normalize-space($after)) > 0">
- <out:call-template name="build_keyItems">
- <out:with-param name="keyItems">
- <out:value-of select="$after"/>
- </out:with-param>
- </out:call-template>
- </out:if>
- </out:template>
- </xsl:template>
- </xsl:stylesheet>
|