1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 |
- <?xml version="1.0"?>
- <!--
- Licensed Materials - Property of IBM
- IBM Cognos Products: fmmd
- (C) Copyright IBM Corp. 2003, 2013
- US Government Users Restricted Rights - Use, duplication or disclosure
- restricted by GSA ADP Schedule Contract with IBM Corp.
- -->
- <!--
- ===============================================================================
- Model Upgrade 57 to 58 Notes:
- This is an XSLT transformation from a Bering schema version 57 model to a Bering
- schema version 58 model
- This Upgrade is required to accomodate the following Model Schema changes made in Bering:
- * Semi-aggregate, regular aggregate and aggregationRule properties values have now
- been unified into a common single set of values. For relational and SAP models
- all deprecated enums will be mapped to unknown. Lightweight model sources are
- unaffected because the model is imported on demand.
- The following aggregate values will be deprecated and replaced with 'unknown'
- - any
- - averageNonZero
- - countNonZero
- - external
- - currentPeriod
- - firstPeriod
- - lastPeriod
- ===============================================================================
- -->
- <xsl:stylesheet xmlns="http://www.developer.cognos.com/schemas/bmt/58/0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:fmfunc="http://www.developer.cognos.com/bmt" xmlns:xalan="http://xml.apache.org/xalan" exclude-result-prefixes="fmfunc xalan">
- <xsl:include href="fmmd_generalTemplates.xsl"/>
- <xsl:strip-space elements="*"/>
- <xsl:output encoding="utf-8" method="xml" indent="no"/>
- <!-- =============================================================================== -->
- <!-- Step 1: Semi-aggregate, regular aggregate and aggregationRule properties values
- have now been unified.
- -->
- <!--
- Template: Remove the redundant custom property 'SAPAggregate'
- -->
- <xsl:template match="*[local-name() = 'queryItem' or local-name() = 'measure']/*[local-name() = 'property' and @*[local-name() = 'name' and . = 'SAPAggregate']]"/>
- <!--
- Template: Map the deprecated aggregate values
- -->
- <xsl:template match="*[local-name() = 'queryItem' or local-name() = 'measure']/*[local-name() = 'aggregationRule' or local-name() = 'regularAggregate' or local-name() = 'semiAggregate']/text()">
- <xsl:choose>
- <xsl:when test=". = 'any'">unknown</xsl:when>
- <xsl:when test=". = 'averageNonZero'">unknown</xsl:when>
- <xsl:when test=". = 'external'">unknown</xsl:when>
- <xsl:when test=". = 'currentPeriod'">unknown</xsl:when>
- <xsl:when test=". = 'firstPeriod'">unknown</xsl:when>
- <xsl:when test=". = 'lastPeriod'">unknown</xsl:when>
- <xsl:when test=". = 'countNonZero'">
- <!-- countNonZero was wrong for SAPBW Bering models -->
- <xsl:choose>
- <xsl:when test="ancestor::*[local-name() = 'querySubject' or local-name() = 'dimension'][1][*[local-name() = 'definition']/*[local-name() = 'mdQuery']]">unknown</xsl:when>
- <xsl:otherwise>
- <xsl:copy/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:when>
- <xsl:otherwise>
- <xsl:copy/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
- <!-- WO #1678-->
- <!-- NOTE: The property name "SAP BW Variables" is hard coded and not localized-->
- <xsl:template match="*[local-name()='dataSource']/*[local-name()='property' and @*[local-name()='name' and .='SAP BW Variables']]/*/*[local-name()='property' and @*[local-name()='name' and .='type']]">
- <xsl:variable name="varType" select="."/>
- <xsl:choose>
- <xsl:when test="$varType = 'characteristic' or $varType = 'hierarchicalNode'">
- <xsl:call-template name="myCopy"/>
- <xsl:element name="property">
- <xsl:attribute name="name">showKeyAndCaption</xsl:attribute>
- <xsl:attribute name="type">boolean</xsl:attribute>
- <xsl:value-of select="'false'"/>
- </xsl:element>
- </xsl:when>
- <xsl:otherwise>
- <xsl:call-template name="myCopy"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
- <!-- =============================================================================== -->
- <!-- Global variables: -->
- <!-- =============================================================================== -->
- <xsl:variable name="sEmptyNamespace" select="string(document('')/*/namespace::*[name()=''])"/>
- <xsl:variable name="nNewSchema" select="number(substring-before(substring-after($sEmptyNamespace, 'http://www.developer.cognos.com/schemas/bmt/'), '/'))"/>
- <xsl:variable name="nOldSchema" select="$nNewSchema - 1"/>
- </xsl:stylesheet>
|