123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143 |
- <?xml version="1.0"?>
- <!--
- Licensed Materials - Property of IBM
- IBM Cognos Products: fmmd
- (C) Copyright IBM Corp. 2003, 2010
- US Government Users Restricted Rights - Use, duplication or disclosure
- restricted by GSA ADP Schedule Contract with IBM Corp.
- -->
- <!--XSLT version 1-->
- <!--
- =============================================================
- Action Log Upgrade 1.1.377.0 Notes:
-
- The level and hierarchy properties under a query subject have been renamed to _level and _hierarchy.
- This was done to avoid naming conflicts with the new level and hierarchy objects.
- ModifyComplex actions that modify either the level or hierarchy properties will be modified to modify
- the _level or _hierarchy properties.
- =============================================================
- -->
- <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <xsl:output method="xml" indent="yes"/>
- <!--root match -->
- <xsl:template match="/">
- <!--make sure that this transformation is performed on the correct version of FM Action Log -->
- <xsl:if test="not(/*[local-name() = 'bmtactionlog']) ">
- <xsl:message terminate="yes">The input file for this transformer must be a FM Action log. Exiting...</xsl:message>
- </xsl:if>
- <xsl:apply-templates/>
- </xsl:template>
- <!-- Default copy override: CData fix -->
- <xsl:template match="value/text()">
- <xsl:if test="name(.) = 'cdata'">
- <xsl:text disable-output-escaping="yes"><![CDATA[</xsl:text>
- <xsl:value-of disable-output-escaping="yes" select="."/>
- <xsl:text disable-output-escaping="yes">]]></xsl:text>
- </xsl:if>
- <xsl:if test="not(name(.) = 'cdata')">
- <xsl:value-of disable-output-escaping="no" select="."/>
- </xsl:if>
- </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 actionlog version to latest version-->
- <xsl:template match="*[local-name()='bmtactionlog']">
- <xsl:element name="bmtactionlog">
- <xsl:for-each select="@*">
- <xsl:attribute name="{name(.)}"><xsl:value-of select="."/></xsl:attribute>
- </xsl:for-each>
- <!--Insert/Update the version tag-->
- <xsl:attribute name="version">2.0.377.0</xsl:attribute>
- <xsl:apply-templates select="node()"/>
- </xsl:element>
- </xsl:template>
- <!-- Helper function: Substring Replace-->
- <xsl:template name="substring-replace">
- <xsl:param name="string"/>
- <xsl:param name="search"/>
- <xsl:param name="replace"/>
- <xsl:choose>
- <xsl:when test="contains($string, $search)">
- <xsl:value-of select="concat(substring-before($string, $search), $replace)"/>
- <xsl:call-template name="substring-replace">
- <xsl:with-param name="string" select="substring-after($string, $search)"/>
- <xsl:with-param name="search" select="$search"/>
- <xsl:with-param name="replace" select="$replace"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$string"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
- <!-- Action Log Upgrade 2.0.377.0: change level and hierarchy to _level and _hierarchy -->
- <xsl:template match="/bmtactionlog/transaction/action[@type = 'ModifyComplex']/inputparams/param[@seq='2']/value">
- <!-- standard copy -->
- <xsl:choose>
- <xsl:when test="contains(., '<level>')">
- <xsl:element name="value">
- <xsl:call-template name="substring-replace">
- <xsl:with-param name="string" select="."/>
- <xsl:with-param name="search" select="string('level>')"/>
- <xsl:with-param name="replace" select="string('_level>')"/>
- </xsl:call-template>
- </xsl:element>
- </xsl:when>
- <xsl:when test="contains(., '<hierarchy>')">
- <xsl:element name="value">
- <xsl:call-template name="substring-replace">
- <xsl:with-param name="string" select="."/>
- <xsl:with-param name="search" select="string('hierarchy>')"/>
- <xsl:with-param name="replace" select="string('_hierarchy>')"/>
- </xsl:call-template>
- </xsl:element>
- </xsl:when>
- <xsl:when test="contains(.,'<functionSetID>')">
- <xsl:variable name="newValue">
- <xsl:call-template name="substring-replace">
- <xsl:with-param name="string" select="."/>
- <xsl:with-param name="search">
- <xsl:text disable-output-escaping="no"><functionSetID></xsl:text>
- </xsl:with-param>
- <xsl:with-param name="replace">
- <xsl:text disable-output-escaping="no"><functionSet><functionSetID></xsl:text>
- </xsl:with-param>
- </xsl:call-template>
- </xsl:variable>
- <xsl:variable name="newValue2">
- <xsl:call-template name="substring-replace">
- <xsl:with-param name="string" select="$newValue"/>
- <xsl:with-param name="search">
- <xsl:text disable-output-escaping="no"></functionSetID></xsl:text>
- </xsl:with-param>
- <xsl:with-param name="replace">
- <xsl:text disable-output-escaping="no"></functionSetID></functionSet></xsl:text>
- </xsl:with-param>
- </xsl:call-template>
- </xsl:variable>
- <xsl:element name="value">
- <xsl:value-of select="$newValue2" disable-output-escaping="no"/>
- </xsl:element>
- </xsl:when>
- <xsl:otherwise>
- <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:otherwise>
- </xsl:choose>
- </xsl:template>
- </xsl:stylesheet>
|