123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!--
- Licensed Materials - Property of IBM
- IBM Cognos Products: ASV
- (C) Copyright IBM Corp. 2005, 2010
- US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
- -->
- <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt" xmlns:bus="http://developer.cognos.com/schemas/bibus/3/" xmlns:pf="http://developer.cognos.com/schemas/xts/pf" exclude-result-prefixes="bus pf xtsext">
- <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
- <xsl:template match="/">
- <!-- build the value of the measure -->
- <xsl:choose>
- <xsl:when test="/selection/type">
- <param name="m_sub_type">
- <xsl:value-of select="/selection/type"/>
- </param>
- </xsl:when>
- <xsl:otherwise>
- <param name="m_sub_type">
- <xsl:text>nonMetric</xsl:text>
- </param>
- </xsl:otherwise>
- </xsl:choose>
- <xsl:if test="/selection/measure_value">
- <param name="m_sub_measure_value">
- <xsl:value-of select="/selection/measure_value"/>
- </param>
- </xsl:if>
- <!-- build the other variables - for between if they are there -->
- <xsl:if test="/selection/measure_value1">
- <param name="m_sub_measure_value1">
- <xsl:value-of select="/selection/measure_value1"/>
- </param>
- </xsl:if>
- <xsl:if test="/selection/measure_value_inclusive">
- <param name="m_sub_measure_value_inclusive">
- <xsl:value-of select="/selection/measure_value_inclusive"/>
- </param>
- </xsl:if>
- <xsl:if test="/selection/measure_value_inclusive1">
- <param name="m_sub_measure_value_inclusive1">
- <xsl:value-of select="/selection/measure_value_inclusive1"/>
- </param>
- </xsl:if>
- <xsl:if test="/selection/case_insensitive">
- <param name="m_sub_case_insensitive">
- <xsl:value-of select="/selection/case_insensitive"/>
- </param>
- </xsl:if>
- <!-- build the name of the operation -->
- <xsl:if test="/selection/operation">
- <param name="m_sub_operation">
- <xsl:value-of select="/selection/operation"/>
- </param>
- </xsl:if>
- <!-- copy over all the metric values -->
- <xsl:for-each select="/selection/*[starts-with(local-name(),'perfPattern')]">
- <param name="{concat('m_sub_', local-name())}">
- <xsl:value-of select="."/>
- </param>
- </xsl:for-each>
- <!-- select the type of the data -->
- <xsl:variable name="dtype">
- <xsl:value-of select="/selection/selections/query/selection/measures/measure/@dtype"/>
- </xsl:variable>
- <xsl:variable name="usage">
- <xsl:value-of select="/selection/selections/query/selection/measures/measure/@usage"/>
- </xsl:variable>
- <param name="m_subData_dtype_domain">
- <xsl:choose>
- <!-- values taken from the CCLDBType enumeration -->
- <xsl:when test="$dtype='1' or $dtype='25' or $dtype='26' or $dtype='27' or $dtype='28' or $dtype='29' or $dtype='30' or $dtype='31' or $dtype='32' or $dtype='34' or $dtype='35' or $dtype='36' or $dtype='43' or $dtype='45' or dtype='55' or $dtype='56'">
- <xsl:choose>
- <xsl:when test="$usage='2'">
- <xsl:text>string</xsl:text>
- </xsl:when>
- <xsl:otherwise>
- <xsl:text>invalid</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:when>
- <xsl:otherwise>
- <xsl:choose>
- <xsl:when test="$usage='2' or $usage='3'">
- <xsl:text>numeric</xsl:text>
- </xsl:when>
- <xsl:otherwise>
- <xsl:text>invalid</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:otherwise>
- </xsl:choose>
- </param>
- <!-- build the name of the measure -->
- <param name="m_subData_measure_name">
- <xsl:value-of select="/selection/selections/query/selection/measures/measure/item/bus:name"/>
- </param>
- <xsl:for-each select="/selection/selections/query/selection/rows/row">
- <xsl:variable name="name" select="concat(string(local-name()), string(position()))"/>
- <xsl:apply-templates select="." mode="buildRowColumnSectionParams">
- <xsl:with-param name="name">
- <xsl:value-of select="$name"/>
- </xsl:with-param>
- </xsl:apply-templates>
- </xsl:for-each>
- <!-- build all the select values for all the columns -->
- <xsl:for-each select="/selection/selections/query/selection/columns/column">
- <xsl:variable name="name" select="concat(string(local-name()), string(position()))"/>
- <xsl:apply-templates select="." mode="buildRowColumnSectionParams">
- <xsl:with-param name="name">
- <xsl:value-of select="$name"/>
- </xsl:with-param>
- </xsl:apply-templates>
- </xsl:for-each>
- <!-- build all the select values for the sections -->
- <xsl:for-each select="/selection/selections/query/selection/sections/section">
- <xsl:variable name="name" select="concat(string(local-name()), string(position()))"/>
- <xsl:apply-templates select="." mode="buildRowColumnSectionParams">
- <xsl:with-param name="name">
- <xsl:value-of select="$name"/>
- </xsl:with-param>
- </xsl:apply-templates>
- </xsl:for-each>
- <!-- wrap the selection spec up too -->
- <xsl:variable name="markup">
- <xsl:call-template name="serialize-xml">
- <xsl:with-param name="node-set">
- <xsl:copy-of select="/selection"/>
- </xsl:with-param>
- </xsl:call-template>
- </xsl:variable>
- <param name="m_subData_report">
- <xsl:value-of select="$markup"/>
- </param>
- </xsl:template>
- <!-- template to build parameters for the row/column values -->
- <xsl:template match="*" mode="buildRowColumnSectionParams">
- <xsl:param name="name"/>
- <!-- build the name of the value this entry -->
- <param name="m_subData_name_{$name}">
- <xsl:value-of select="./item/bus:name"/>
- </param>
- <!-- build the default value of this entry -->
- <param name="m_subData_defaultValue_{$name}">
- <xsl:value-of select="./item/bus:value/item/bus:display"/>
- </param>
- <!-- build the current selection -->
- <xsl:if test="(./selectAll and ./selectAll='false') or not(./selectAll)">
- <param name="m_sub_{$name}">
- <xsl:text>true</xsl:text>
- </param>
- </xsl:if>
- </xsl:template>
- <!-- serialization templates -->
- <pf:serialize-xml/>
- </xsl:stylesheet>
|