xform_58to59.xsl 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. <?xml version="1.0"?>
  2. <!--
  3. Licensed Materials - Property of IBM
  4. IBM Cognos Products: fmmd
  5. (C) Copyright IBM Corp. 2003, 2013
  6. US Government Users Restricted Rights - Use, duplication or disclosure
  7. restricted by GSA ADP Schedule Contract with IBM Corp.
  8. -->
  9. <!--
  10. ===============================================================================
  11. Model Upgrade 58 to 59 Notes:
  12. This is an XSLT transformation from a Bering schema version 58 model to a Blacksea
  13. schema version 59 model
  14. This Upgrade is required to accomodate the following Model Schema changes made in Bering:
  15. * Lightweight models now require an indicator on the project identifying them as such.
  16. * Switch all 'embedded' externalize methods to 'default'.
  17. ===============================================================================
  18. -->
  19. <xsl:stylesheet xmlns="http://www.developer.cognos.com/schemas/bmt/59/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">
  20. <xsl:include href="fmmd_generalTemplates.xsl"/>
  21. <xsl:strip-space elements="*"/>
  22. <xsl:output encoding="utf-8" method="xml" indent="no"/>
  23. <!-- =============================================================================== -->
  24. <!-- Step 1: Models missing a datasource object are assumed to contain lightweight
  25. OLAP models.
  26. NOTE: Override the template in the fmmd_generalTemplates.xsl
  27. -->
  28. <!-- Template: Update the schema version-->
  29. <xsl:template match="/*[local-name()='project'] ">
  30. <xsl:element name="project" namespace="{$sEmptyNamespace}">
  31. <xsl:if test="not(/*[local-name()='project']/*[local-name()='dataSources']/*[local-name()='dataSource'])">
  32. <xsl:attribute name="useMFW">true</xsl:attribute>
  33. </xsl:if>
  34. <xsl:for-each select="@*">
  35. <xsl:choose>
  36. <!-- Update the schema # -->
  37. <xsl:when test="name(.) = 'xsi:schemaLocation'">
  38. <xsl:attribute name="{name(.)}"><xsl:value-of select="concat($sEmptyNamespace, ' BMTModelSpecification.xsd')"/></xsl:attribute>
  39. </xsl:when>
  40. <xsl:otherwise>
  41. <xsl:attribute name="{name(.)}"><xsl:value-of select="."/></xsl:attribute>
  42. </xsl:otherwise>
  43. </xsl:choose>
  44. </xsl:for-each>
  45. <xsl:apply-templates select="node()"/>
  46. </xsl:element>
  47. </xsl:template>
  48. <!-- =============================================================================== -->
  49. <!-- Step 2: Switch all 'embedded' externalize methods to 'default'.
  50. The 'embedded' externalize method has been deprecated.
  51. -->
  52. <xsl:template match="*[local-name()='querySubject']/*[local-name()='externalizeMethod']/text()">
  53. <xsl:choose>
  54. <xsl:when test=". = 'embedded'">default</xsl:when>
  55. <xsl:otherwise>
  56. <xsl:copy/>
  57. </xsl:otherwise>
  58. </xsl:choose>
  59. </xsl:template>
  60. <!-- =============================================================================== -->
  61. <!-- Global variables: -->
  62. <!-- =============================================================================== -->
  63. <xsl:variable name="sEmptyNamespace" select="string(document('')/*/namespace::*[name()=''])"/>
  64. <xsl:variable name="nNewSchema" select="number(substring-before(substring-after($sEmptyNamespace, 'http://www.developer.cognos.com/schemas/bmt/'), '/'))"/>
  65. <xsl:variable name="nOldSchema" select="$nNewSchema - 1"/>
  66. </xsl:stylesheet>