123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!--
- 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.
- -->
- <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
- <xsl:template match="*">
- <xsl:copy>
- <xsl:copy-of select="@*"/>
- <xsl:apply-templates/>
- </xsl:copy>
- </xsl:template>
- <xsl:template match="action">
- <xsl:if test="not(@type='Create' and inputparams/param[@seq='1']/value='14' and inputparams/param[@seq='2']/value='[].[parameterMaps]' )">
- <xsl:copy>
- <xsl:attribute name="seq"><xsl:value-of select="@seq"/></xsl:attribute>
- <xsl:attribute name="type"><xsl:choose><xsl:when test="@type='AddLanguage' ">AddLocale</xsl:when><xsl:otherwise><xsl:value-of select="@type"/></xsl:otherwise></xsl:choose></xsl:attribute>
- <xsl:variable name="action_type" select="@type"/>
- <xsl:for-each select="*">
- <xsl:choose>
- <xsl:when test="self::inputparams">
- <xsl:copy>
- <xsl:choose>
- <xsl:when test="$action_type='AddLocale' or $action_type='AddLanguage'">
- <param seq="1" type="stringCollection">
- <value>
- <xsl:value-of select="param[@seq='1']/value"/>
- </value>
- </param>
- <xsl:apply-templates select="param[@seq != '1']"/>
- </xsl:when>
- <xsl:when test="$action_type='CreateShortcut' or $action_type='LinkModel' or $action_type='ModelImport' ">
- <xsl:apply-templates select="*"/>
- <param seq="{count(param)+1}" type="integer">
- <value>1</value>
- </param>
- </xsl:when>
- <xsl:when test="$action_type='DBImport' ">
- <xsl:apply-templates select="param[@seq='1']"/>
- <param seq="2" type="{param[@seq='2']/@type}">
- <xsl:variable name="newValue">
- <xsl:call-template name="substring-replace">
- <xsl:with-param name="string">
- <xsl:apply-templates select="param[@seq='2']/value"/>
- </xsl:with-param>
- <xsl:with-param name="search">
- <xsl:text disable-output-escaping="yes"><item Name="Procedures" Type="procedures" Value="true"/></xsl:text>
- </xsl:with-param>
- <xsl:with-param name="replace">
- <xsl:text disable-output-escaping="yes"><item Name="Procedures" Type="procedures" Value="true"/><item Name="Functions" Type="functions" Value="true"/></xsl:text>
- </xsl:with-param>
- </xsl:call-template>
- </xsl:variable>
- <value>
- <!--xsl:copy-of select="$myValue"/-->
- <xsl:value-of select="$newValue" disable-output-escaping="yes"/>
- </value>
- </param>
- <param seq="3" type="integer">
- <value>0</value>
- </param>
- <param seq="4" type="integer">
- <value>1</value>
- </param>
- <xsl:for-each select="param[@seq !='1' and @seq!= '2']">
- <param seq="{number(@seq)+2}" type="{@type}">
- <xsl:apply-templates/>
- </param>
- </xsl:for-each>
- <param seq="9" type="integer">
- <value>0</value>
- </param>
- </xsl:when>
- <xsl:when test="$action_type='FindOrCreateDataSource' ">
- <param seq="1" type="{param[@seq='5']/@type}">
- <xsl:apply-templates select="param[@seq='5']/value"/>
- </param>
- <xsl:for-each select="param[number(@seq) < 4]">
- <param seq="{number(@seq)+1} " type="{@type}">
- <xsl:apply-templates/>
- </param>
- </xsl:for-each>
- </xsl:when>
- <xsl:when test="$action_type='ImportTranslations' ">
- <xsl:for-each select="*">
- <xsl:choose>
- <xsl:when test="self::param and @seq='3' ">
- <param seq="3" type="stringCollection">
- <value>
- <xsl:value-of select="value"/>
- </value>
- </param>
- </xsl:when>
- <xsl:otherwise>
- <xsl:copy-of select="."/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:for-each>
- </xsl:when>
- <xsl:when test="$action_type='ExportTranslations' ">
- <xsl:for-each select="*">
- <xsl:choose>
- <xsl:when test="self::param and @seq='2' ">
- <param seq="2" type="stringCollection">
- <value>
- <xsl:value-of select="value"/>
- </value>
- </param>
- </xsl:when>
- <xsl:otherwise>
- <xsl:apply-templates select="."/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:for-each>
- </xsl:when>
- <xsl:when test="$action_type='SegmentModel' ">
- <xsl:apply-templates select="*"/>
- <param seq="{count(param)+1}" type="i18nstring">
- <value/>
- </param>
- </xsl:when>
- <xsl:when test="$action_type='TransformRelationship' ">
- <xsl:for-each select="param">
- <xsl:choose>
- <xsl:when test="position() = last() -3">
- <param seq="{position()}" type="integer">
- <value>0</value>
- </param>
- <param seq="{position()+1}" type="integer">
- <value>1</value>
- </param>
- <param seq="{position()+2}" type="{@type}">
- <xsl:apply-templates/>
- </param>
- </xsl:when>
- <xsl:when test="position() > last() -3">
- <param seq="{number(@seq)+2}" type="{@type}">
- <xsl:apply-templates/>
- </param>
- </xsl:when>
- <xsl:otherwise>
- <xsl:apply-templates select="."/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:for-each>
- </xsl:when>
- <xsl:when test="$action_type='ModifyComplex'">
- <xsl:apply-templates select="param[@seq='1']"/>
- <param seq="2" type="{param[@seq='2']/@type}"/>
- <xsl:variable name="newValue">
- <xsl:call-template name="substring-replace">
- <xsl:with-param name="string">
- <xsl:apply-templates select="param[@seq='2']/value"/>
- </xsl:with-param>
- <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:value-of select="$newValue"/>
- <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>
- <value>
- <xsl:value-of select="$newValue2" disable-output-escaping="no"/>
- </value>
- </xsl:when>
- <xsl:otherwise>
- <xsl:apply-templates/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:copy>
- </xsl:when>
- <xsl:otherwise>
- <xsl:apply-templates select="."/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:for-each>
- </xsl:copy>
- </xsl:if>
- </xsl:template>
- <xsl:template match="value">
- <xsl:variable name="paramStr">
- <xsl:choose>
- <xsl:when test="contains(., '[].[parameterMaps].[governor]') or contains(., '[].[parameterMaps].[env]')">
- <xsl:call-template name="substring-replace">
- <xsl:with-param name="string">
- <xsl:call-template name="substring-replace">
- <xsl:with-param name="string" select="."/>
- <xsl:with-param name="search" select="'[].[parameterMaps].[governor]' "/>
- <xsl:with-param name="replace" select="'[].[parameterMaps].[_governor]' "/>
- </xsl:call-template>
- </xsl:with-param>
- <xsl:with-param name="search" select="'[].[parameterMaps].[env]' "/>
- <xsl:with-param name="replace" select="'[].[parameterMaps].[_env]' "/>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="."/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:copy>
- <xsl:choose>
- <xsl:when test="../@type='cclnode' or ../@type='node' or ../@type='stringCollection' or ../@type='void' ">
- <xsl:text disable-output-escaping="yes"><![CDATA[</xsl:text>
- <xsl:value-of select="$paramStr" disable-output-escaping="yes"/>
- <xsl:text disable-output-escaping="yes">]]></xsl:text>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$paramStr"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:copy>
- </xsl:template>
- <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>
- </xsl:stylesheet>
|