123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270 |
- <?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 55 to 56 Notes:
- This is an XSLT transformation from a Bering schema version 55 model to a Bering
- schema version 56 model.
- This Upgrade is required to accomodate the following Model Schema changes.
- * type of scopeRelationship/scope/measureScope/excluded from xs:string to xs:boolean.. default value is 'false'
- * measure/dbAggregationRule has been moved to measure/aggregationRule
- In addition to the schema changes, some queryItem formatting changes were made in
- Bering that need to be addressed.
- * percentage scale's representation has changed to a negative value.
- * the following strings have changed
- Baltic Bering
- ====== ======
- "hide century" ==> "hideCentury"
- "show century" ==> "showCentury"
- "1 digit" ==> "1-digit"
- "2 digits" ==> "2-digits"
- "3 digits" ==> "3-digits"
- "short name" ==> "shortName"
- "full name" ==> "fullName"
- ===============================================================================
- -->
- <xsl:stylesheet xmlns="http://www.developer.cognos.com/schemas/bmt/56/0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <xsl:include href="fmmd_generalTemplates.xsl"/>
- <xsl:strip-space elements="*"/>
- <xsl:output encoding="utf-8" method="xml" indent="no"/>
- <!-- Template: change the type of scopeRelationship/scope/measureScope/excluded from xs:string to xs:boolean.. default value is 'false' -->
- <xsl:template match="*[local-name()='scopeRelationship']/*[local-name()='scope']/*[local-name()='measureScope' and @*[local-name()='excluded']]">
- <xsl:element name="{local-name(.)}">
- <xsl:choose>
- <xsl:when test="@*[local-name()='excluded'] = 'excluded'">
- <xsl:attribute name="excluded">true</xsl:attribute>
- </xsl:when>
- <xsl:otherwise>
- <!-- NOTE: default is false -->
- <!--
- <xsl:attribute name="excluded">false</xsl:attribute>
- -->
- </xsl:otherwise>
- </xsl:choose>
- <!-- copy the children nodes -->
- <xsl:apply-templates select="./*"/>
- </xsl:element>
- </xsl:template>
- <!-- Template: measure/dbAggregationRule has been deleted in it's current location -->
- <xsl:template match="*[local-name()='dimension']//*[local-name()='measure']/*[local-name()='dbAggregationRule']"/>
- <!-- Template: measure/aggregationRule has been deleted in it's current location if the measure also had a dbAggregationRule -->
- <xsl:template match="*[local-name()='dimension']//*[local-name()='measure' and ./*[local-name()='dbAggregationRule']]/*[local-name()='aggregationRule']"/>
- <!-- Template: old measure/dbAggregationRule is now measure/aggregationRule-->
- <xsl:template match="*[local-name()='dimension']//*[local-name()='measure' and ./*[local-name()='dbAggregationRule']]/*[local-name()='externalName' or local-name()='hidden' or local-name()='usage' or local-name()='format' or local-name()='currency' or local-name()='bmtcr1:datatype' or local-name()='precision' or local-name()='scale' or local-name()='size' or local-name()='nullable'][last()]">
- <!-- Copy the anchor element over -->
- <xsl:call-template name="myCopy"/>
- <!-- Insert the new aggregationRule -->
- <xsl:element name="aggregationRule">
- <xsl:value-of select="../*[local-name()='dbAggregationRule']"/>
- </xsl:element>
- </xsl:template>
- <!-- Template: Convert queryItem formats -->
- <xsl:template match="*[local-name()='queryItem' or local-name()='measure' or local-name()='calculation']/*[local-name()='format']/text()">
- <!-- Convert PercentScale value to a negative value -->
- <xsl:variable name="strLeftDelimiter" select="'percentScale=&quot;'"/>
- <xsl:variable name="strRightDelimiter" select="'&quot;'"/>
- <xsl:variable name="strPercentScale">
- <xsl:call-template name="substring-findDelimited">
- <xsl:with-param name="strString" select="."/>
- <xsl:with-param name="strLeftDelimiter" select="$strLeftDelimiter"/>
- <xsl:with-param name="strRightDelimiter" select="$strRightDelimiter"/>
- </xsl:call-template>
- </xsl:variable>
- <xsl:variable name="nPercentScale" select="number($strPercentScale)"/>
- <xsl:variable name="PercentScale">
- <xsl:choose>
- <xsl:when test="$nPercentScale > 0">
- <xsl:call-template name="substring-replace">
- <xsl:with-param name="strString" select="."/>
- <xsl:with-param name="strFind" select="concat($strLeftDelimiter, $nPercentScale, $strRightDelimiter)"/>
- <xsl:with-param name="strReplace" select="concat($strLeftDelimiter, '-', $nPercentScale, $strRightDelimiter)"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="."/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <!-- showYears -->
- <!-- Convert showYears="show Century" ==> showYears="showCentury" -->
- <xsl:variable name="showCentury">
- <xsl:call-template name="substring-replace">
- <xsl:with-param name="strString" select="$PercentScale"/>
- <xsl:with-param name="strFind" select="'showYears=&quot;show century&quot;'"/>
- <xsl:with-param name="strReplace" select="'showYears=&quot;showCentury&quot;'"/>
- </xsl:call-template>
- </xsl:variable>
- <!-- Convert showYears="hide Century" ==> showYears="hideCentury" -->
- <xsl:variable name="hideCentury">
- <xsl:call-template name="substring-replace">
- <xsl:with-param name="strString" select="$showCentury"/>
- <xsl:with-param name="strFind" select="'showYears=&quot;hide century&quot;'"/>
- <xsl:with-param name="strReplace" select="'showYears=&quot;hideCentury&quot;'"/>
- </xsl:call-template>
- </xsl:variable>
- <!-- showMonths -->
- <!-- Convert showMonths="1 digit" ==> showMonths="1-digit" -->
- <xsl:variable name="showMonths_1digit">
- <xsl:call-template name="substring-replace">
- <xsl:with-param name="strString" select="$hideCentury"/>
- <xsl:with-param name="strFind" select="'showMonths=&quot;1 digit&quot;'"/>
- <xsl:with-param name="strReplace" select="'showMonths=&quot;1-digit&quot;'"/>
- </xsl:call-template>
- </xsl:variable>
- <!-- Convert showMonths="2 digits" ==> showMonths="2-digits" -->
- <xsl:variable name="showMonths_2digits">
- <xsl:call-template name="substring-replace">
- <xsl:with-param name="strString" select="$showMonths_1digit"/>
- <xsl:with-param name="strFind" select="'showMonths=&quot;2 digits&quot;'"/>
- <xsl:with-param name="strReplace" select="'showMonths=&quot;2-digits&quot;'"/>
- </xsl:call-template>
- </xsl:variable>
- <!-- Convert showMonths="short name" ==> showMonths="shortName" -->
- <xsl:variable name="showMonths_shortName">
- <xsl:call-template name="substring-replace">
- <xsl:with-param name="strString" select="$showMonths_2digits"/>
- <xsl:with-param name="strFind" select="'showMonths=&quot;short name&quot;'"/>
- <xsl:with-param name="strReplace" select="'showMonths=&quot;shortName&quot;'"/>
- </xsl:call-template>
- </xsl:variable>
- <!-- Convert showMonths="full name" ==> showMonths="fullName" -->
- <xsl:variable name="showMonths_fullName">
- <xsl:call-template name="substring-replace">
- <xsl:with-param name="strString" select="$showMonths_shortName"/>
- <xsl:with-param name="strFind" select="'showMonths=&quot;full name&quot;'"/>
- <xsl:with-param name="strReplace" select="'showMonths=&quot;fullName&quot;'"/>
- </xsl:call-template>
- </xsl:variable>
- <!-- showWeekdays -->
- <!-- Convert showWeekdays="short name" ==> showWeekdays="shortName" -->
- <xsl:variable name="showWeekdays_shortName">
- <xsl:call-template name="substring-replace">
- <xsl:with-param name="strString" select="$showMonths_fullName"/>
- <xsl:with-param name="strFind" select="'showWeekdays=&quot;short name&quot;'"/>
- <xsl:with-param name="strReplace" select="'showWeekdays=&quot;shortName&quot;'"/>
- </xsl:call-template>
- </xsl:variable>
- <!-- Convert showWeekdays="full name" ==> showWeekdays="fullName" -->
- <xsl:variable name="showWeekdays_fullName">
- <xsl:call-template name="substring-replace">
- <xsl:with-param name="strString" select="$showWeekdays_shortName"/>
- <xsl:with-param name="strFind" select="'showWeekdays=&quot;full name&quot;'"/>
- <xsl:with-param name="strReplace" select="'showWeekdays=&quot;fullName&quot;'"/>
- </xsl:call-template>
- </xsl:variable>
- <!-- showDays -->
- <!-- Convert showDays="1 digit" ==> showDays="1-digit" -->
- <xsl:variable name="showWeekdays_1digit">
- <xsl:call-template name="substring-replace">
- <xsl:with-param name="strString" select="$showWeekdays_fullName"/>
- <xsl:with-param name="strFind" select="'showDays=&quot;1 digit&quot;'"/>
- <xsl:with-param name="strReplace" select="'showDays=&quot;1-digit&quot;'"/>
- </xsl:call-template>
- </xsl:variable>
- <!-- Convert showDays="2 digits" ==> showDays="2-digits" -->
- <xsl:variable name="showWeekdays_2digits">
- <xsl:call-template name="substring-replace">
- <xsl:with-param name="strString" select="$showWeekdays_1digit"/>
- <xsl:with-param name="strFind" select="'showDays=&quot;2 digits&quot;'"/>
- <xsl:with-param name="strReplace" select="'showDays=&quot;2-digits&quot;'"/>
- </xsl:call-template>
- </xsl:variable>
- <!-- showHours -->
- <!-- Convert showHours="1 digit" ==> showHours="1-digit" -->
- <xsl:variable name="showHours_1digit">
- <xsl:call-template name="substring-replace">
- <xsl:with-param name="strString" select="$showWeekdays_2digits"/>
- <xsl:with-param name="strFind" select="'showHours=&quot;1 digit&quot;'"/>
- <xsl:with-param name="strReplace" select="'showHours=&quot;1-digit&quot;'"/>
- </xsl:call-template>
- </xsl:variable>
- <!-- Convert showHours="2 digits" ==> showHours="2-digits" -->
- <xsl:variable name="showHours_2digits">
- <xsl:call-template name="substring-replace">
- <xsl:with-param name="strString" select="$showHours_1digit"/>
- <xsl:with-param name="strFind" select="'showHours=&quot;2 digits&quot;'"/>
- <xsl:with-param name="strReplace" select="'showHours=&quot;2-digits&quot;'"/>
- </xsl:call-template>
- </xsl:variable>
- <!-- showMinutes -->
- <!-- Convert showMinutes="1 digit" ==> showMinutes="1-digit" -->
- <xsl:variable name="showMinutes_1digit">
- <xsl:call-template name="substring-replace">
- <xsl:with-param name="strString" select="$showHours_2digits"/>
- <xsl:with-param name="strFind" select="'showMinutes=&quot;1 digit&quot;'"/>
- <xsl:with-param name="strReplace" select="'showMinutes=&quot;1-digit&quot;'"/>
- </xsl:call-template>
- </xsl:variable>
- <!-- Convert showMinutes="2 digits" ==> showMinutes="2-digits" -->
- <xsl:variable name="showMinutes_2digits">
- <xsl:call-template name="substring-replace">
- <xsl:with-param name="strString" select="$showMinutes_1digit"/>
- <xsl:with-param name="strFind" select="'showMinutes=&quot;2 digits&quot;'"/>
- <xsl:with-param name="strReplace" select="'showMinutes=&quot;2-digits&quot;'"/>
- </xsl:call-template>
- </xsl:variable>
- <!-- showSeconds -->
- <!-- Convert showSeconds="1 digit" ==> showSeconds="1-digit" -->
- <xsl:variable name="showSeconds_1digit">
- <xsl:call-template name="substring-replace">
- <xsl:with-param name="strString" select="$showMinutes_2digits"/>
- <xsl:with-param name="strFind" select="'showSeconds=&quot;1 digit&quot;'"/>
- <xsl:with-param name="strReplace" select="'showSeconds=&quot;1-digit&quot;'"/>
- </xsl:call-template>
- </xsl:variable>
- <!-- Convert showSeconds="2 digits" ==> showSeconds="2-digits" -->
- <xsl:variable name="showSeconds_2digits">
- <xsl:call-template name="substring-replace">
- <xsl:with-param name="strString" select="$showSeconds_1digit"/>
- <xsl:with-param name="strFind" select="'showSeconds=&quot;2 digits&quot;'"/>
- <xsl:with-param name="strReplace" select="'showSeconds=&quot;2-digits&quot;'"/>
- </xsl:call-template>
- </xsl:variable>
- <!-- showMilliSeconds -->
- <!-- Convert showMilliSeconds="1 digit" ==> showMilliSeconds="1-digit" -->
- <xsl:variable name="showMilliSeconds_1digit">
- <xsl:call-template name="substring-replace">
- <xsl:with-param name="strString" select="$showSeconds_2digits"/>
- <xsl:with-param name="strFind" select="'showMilliSeconds=&quot;1 digit&quot;'"/>
- <xsl:with-param name="strReplace" select="'showMilliSeconds=&quot;1-digit&quot;'"/>
- </xsl:call-template>
- </xsl:variable>
- <!-- Convert showMilliSeconds="2 digits" ==> showMilliSeconds="2-digits" -->
- <xsl:variable name="showMilliSeconds_2digits">
- <xsl:call-template name="substring-replace">
- <xsl:with-param name="strString" select="$showMilliSeconds_1digit"/>
- <xsl:with-param name="strFind" select="'showMilliSeconds=&quot;2 digits&quot;'"/>
- <xsl:with-param name="strReplace" select="'showMilliSeconds=&quot;2-digits&quot;'"/>
- </xsl:call-template>
- </xsl:variable>
- <!-- Convert showMilliSeconds="3 digits" ==> showMilliSeconds="3-digits" -->
- <xsl:variable name="showMilliSeconds_3digits">
- <xsl:call-template name="substring-replace">
- <xsl:with-param name="strString" select="$showMilliSeconds_2digits"/>
- <xsl:with-param name="strFind" select="'showMilliSeconds=&quot;3 digits&quot;'"/>
- <xsl:with-param name="strReplace" select="'showMilliSeconds=&quot;3-digits&quot;'"/>
- </xsl:call-template>
- </xsl:variable>
- <xsl:value-of select="$showMilliSeconds_3digits"/>
- </xsl:template>
- <!-- Globlal 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>
|