123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140 |
- <?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 53 to 54 Notes:
- This is an XSLT transformation from a Bering schema version 53 model to a Bering
- schema version 54 model.
- This Upgrade is required to accomodate the following Model Schema changes.
- Steps:
- ======
- 1. Levelcuts will be removed.
- This was added to support convergent levels. This feature has been removed for
- Bering and it's been decided that we will use a different approach. This is an interim
- step simply to keep valid those few models out there that have levelShortcuts
- NOTE: The levelShortcut was never implemented by the query engines.
- 2. New Roles property will replace existing query item role and roleName properties.
- This upgrade is only for internal use. Existing role properties with a value 'caption'
- will be converted to the new role property format. The new role value will be set
- to '_memberCaption'
- All other roles will be deleted. NOTE: The role property is defined in the
- BmtModelBehaviour.xsl file as a multi-lingual string.
- <xsd:element name="roles" minOccurs="0">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="role" maxOccurs="unbounded">
- <xsd:complexType>
- <xsd:simpleContent>
- <xsd:extension base="xsd:string">
- <xsd:attribute name="locale" type="xsd:language" use="required"/>
- </xsd:extension>
- </xsd:simpleContent>
- </xsd:complexType>
- </xsd:element>
- </xsd:sequence>
- </xsd:complexType>
- </xsd:element>
- 3. Rename dimensions property to hierarchies
- Add new property under calculation object called datasources (no upgrade is required).
- Also under calculations rename dimensions property to hierarchies.
- NOTE: Change requested by OP.
- 4. Empty maxVersions elements will be removed.
- Packages which are published with versioning turned off previously resulted in an
- empty element which would break schema validation.
- ============================================================================================ -->
- <xsl:stylesheet xmlns="http://www.developer.cognos.com/schemas/bmt/54/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"/>
- <!-- ============================================================================================ -->
- <!-- Step #1: LevelShortcuts will be removed. -->
- <!-- Template: Delete any existing levelShortcut -->
- <xsl:template match="*[local-name()='levelShortcut']"/>
- <!-- ============================================================================================ -->
- <!-- Step #2: New Roles property will replace existing query item role and roleName properties -->
- <!-- Template: Delete any existing queryItem role -->
- <xsl:template match="*[local-name()='queryItem']/*[local-name()='role']"/>
- <!-- Template: Create new 'roles' property -->
- <xsl:template match="*[local-name()='queryItem' and *[local-name()='role' and .='caption']]">
- <xsl:variable name="roles">
- <xsl:element name="roles">
- <xsl:element name="role"><xsl:attribute name="locale"><xsl:value-of select="/*[local-name()='project']/*[local-name()='defaultLocale']"/></xsl:attribute>_memberCaption</xsl:element>
- </xsl:element>
- </xsl:variable>
- <!-- A <roles> group must be inserted before the collation properties-->
- <xsl:element name="queryItem">
- <xsl:call-template name="myCopyAttributes"/>
- <xsl:for-each select="node()">
- <xsl:choose>
- <xsl:when test="*[local-name()='collationSequenceName']">
- <xsl:copy-of select="$roles"/>
- <xsl:call-template name="myCopy"/>
- </xsl:when>
- <xsl:when test="*[local-name()='collationSequenceLevel'] and not(../*[local-name()='collationSequenceName'])">
- <xsl:copy-of select="$roles"/>
- <xsl:call-template name="myCopy"/>
- </xsl:when>
- <xsl:when test="*[local-name()='originalCollationSequenceName'] and not(../*[local-name()='collationSequenceLevel']) and not(../*[local-name()='collationSequenceName'])">
- <xsl:copy-of select="$roles"/>
- <xsl:call-template name="myCopy"/>
- </xsl:when>
- <xsl:when test="*[local-name()='originalEncodingName'] and not(../*[local-name()='originalCollationSequenceName']) and not(../*[local-name()='collationSequenceLevel']) and not(../*[local-name()='collationSequenceName'])">
- <xsl:copy-of select="$roles"/>
- <xsl:call-template name="myCopy"/>
- </xsl:when>
- <xsl:when test="position() = last()">
- <xsl:apply-templates select="."/>
- <xsl:copy-of select="$roles"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:apply-templates select="."/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:for-each>
- </xsl:element>
- </xsl:template>
- <!-- ============================================================================================ -->
- <!-- Step #3: Rename dimensions property to hierarchies. -->
- <!-- Template: Rename the dimension property -->
- <xsl:template match="*[local-name()='calculation']/*[local-name()='dimensions']">
- <xsl:call-template name="myCopy">
- <xsl:with-param name="elemName">hierarchies</xsl:with-param>
- </xsl:call-template>
- </xsl:template>
- <!-- ============================================================================================ -->
- <!-- Step #4: Empty maxVersions elements will be removed. -->
- <!-- Template: Delete in the packages/package any empty <maxVersions/> elements -->
- <xsl:template match="*[local-name()='packages']/*[local-name()='package']/*[local-name()='maxVersions' and . = '']"/>
- <!-- ============================================================================================ -->
- <!-- 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>
|