<?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 30--> <!--XSL Transformation from a schema v30 model to a valid BMT schema v31 model--> <xsl:stylesheet xmlns="http://www.developer.cognos.com/schemas/bmt/31/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 v30 model--> <xsl:if test="not(contains(/*[local-name() = 'project']/@xsi:schemaLocation, 'http://www.developer.cognos.com/schemas/bmt/30')) "> <xsl:message terminate="yes">The input file for this transformer must be a schema v30 model.</xsl:message> </xsl:if> <xsl:apply-templates select="node()"/> </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 select="node()"/> </xsl:element> </xsl:template> <!--change the schema to v31 version--> <xsl:template match="*[local-name()='project'] "> <xsl:element name="project" namespace="http://www.developer.cognos.com/schemas/bmt/31/0"> <xsl:for-each select="@*"> <xsl:choose> <!--change schema from v30 to v31--> <xsl:when test="name(.) = 'xsi:schemaLocation'"> <xsl:attribute name="{name(.)}"><xsl:value-of select="'http://www.developer.cognos.com/schemas/bmt/31/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 select="node()"/> </xsl:element> </xsl:template> <xsl:template match="*[local-name() = 'previewFilter' ] "> <previewFilters> <xsl:element name="{name(.)}"> <xsl:apply-templates select="node()"/> </xsl:element> </previewFilters> </xsl:template> <xsl:template match="comment()"> <xsl:copy/> </xsl:template> </xsl:stylesheet>