123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 |
- <?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.
- -->
- <!--XSLT version 14-->
- <!--XSL Transformation from a schema v14 model to a valid BMT schema v15 model-->
- <xsl:stylesheet xmlns="http://www.developer.cognos.com/schemas/bmt/15/0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <xsl:output encoding="utf-8" method="xml" indent="yes"/>
- <!--root match-->
- <xsl:template match="/">
- <!--make sure that this transformation is performed on a schema v14 model-->
- <xsl:if test="not(contains(/*[local-name() = 'project']/@xsi:schemaLocation, 'http://www.developer.cognos.com/schemas/bmt/14')) ">
- <xsl:message terminate="yes">The input file for this transformer must be a schema v14 model.</xsl:message>
- </xsl:if>
- <xsl:apply-templates/>
- </xsl:template>
- <!-- general copy -->
- <xsl:template match="*">
- <xsl:element name="{name(.)}">
- <xsl:for-each select="@*">
- <xsl:attribute name="{name(.)}"><xsl:value-of select="."/></xsl:attribute>
- </xsl:for-each>
- <xsl:apply-templates/>
- </xsl:element>
- </xsl:template>
- <!--change the project attribute to v15 version-->
- <xsl:template match="*[local-name()='project'] ">
- <xsl:element name="project" namespace="http://www.developer.cognos.com/schemas/bmt/15/0">
- <xsl:for-each select="@*">
- <xsl:choose>
- <!--change schema from v14 to v15-->
- <xsl:when test="name(.) = 'xsi:schemaLocation'">
- <xsl:attribute name="{name(.)}"><xsl:value-of select="'http://www.developer.cognos.com/schemas/bmt/15/0 BMTModelSpecification.xsd'"/></xsl:attribute>
- </xsl:when>
- <xsl:otherwise>
- <xsl:attribute name="{name(.)}"><xsl:value-of select="."/></xsl:attribute>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:for-each>
- <xsl:apply-templates/>
- </xsl:element>
- </xsl:template>
- <!-- property position are changed globally -->
- <xsl:template match="*[local-name() = 'querySubject' or local-name()='relationship' or local-name()='level' or local-name()='hierarchy'] ">
- <xsl:element name="{ local-name() }">
- <xsl:for-each select="@*">
- <xsl:attribute name="{name(.)}"><xsl:value-of select="."/></xsl:attribute>
- </xsl:for-each>
- <xsl:apply-templates select="*[local-name() = 'name' or local-name()='description' or local-name()='lastChanged' or local-name()='screenTip' or local-name()='property']"/>
- <xsl:apply-templates select="*[not(local-name() = 'name' or local-name()='description' or local-name()='lastChanged' or local-name()='screenTip' or local-name()='property')]"/>
- </xsl:element>
- </xsl:template>
- <!-- change position for MIMEType, precision, property, displayType and promptInfo-->
- <xsl:template match="* [ local-name() = 'queryItem' ]">
- <queryItem>
- <xsl:apply-templates select="*[ local-name() = 'name' ]"/>
- <xsl:apply-templates select="*[ local-name() = 'description' ]"/>
- <xsl:apply-templates select="*[ local-name() = 'lastChanged' ]"/>
- <xsl:apply-templates select="*[ local-name() = 'screenTip' ]"/>
- <xsl:apply-templates select="*[ local-name() = 'property' ]"/>
- <xsl:apply-templates select="*[ local-name() = 'columnName' ]"/>
- <xsl:apply-templates select="*[ local-name() = 'hidden' ]"/>
- <xsl:apply-templates select="*[ local-name() = 'usage' ]"/>
- <xsl:apply-templates select="*[ local-name() = 'format' ]"/>
- <xsl:apply-templates select="*[ local-name() = 'currency' ]"/>
- <xsl:apply-templates select="*[ local-name() = 'datatype' ]"/>
- <xsl:apply-templates select="*[ local-name() = 'precision' ]"/>
- <xsl:apply-templates select="*[ local-name() = 'scale' ]"/>
- <xsl:apply-templates select="*[ local-name() = 'size' ]"/>
- <xsl:apply-templates select="*[ local-name() = 'nullable' ]"/>
- <xsl:apply-templates select="*[ local-name() = 'displayType' ]"/>
- <xsl:apply-templates select="*[ local-name() = 'MIMEType' ]"/>
- <xsl:apply-templates select="*[ local-name() = 'promptInfo' ]"/>
- <xsl:apply-templates select="*[ local-name() = 'regularAggregate' ]"/>
- <xsl:apply-templates select="*[ local-name() = 'semiAggregate' ]"/>
- <xsl:apply-templates select="*[ local-name() = 'unSortable' ]"/>
- <xsl:apply-templates select="*[ local-name() = 'collationSequenceName' ]"/>
- <xsl:apply-templates select="*[ local-name() = 'collationSequenceLevel' ]"/>
- <xsl:apply-templates select="*[ local-name() = 'originalCollationSequenceName' ]"/>
- <xsl:apply-templates select="*[ local-name() = 'originalEncodingName' ] "/>
- </queryItem>
- </xsl:template>
- </xsl:stylesheet>
|