123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!--
- Licensed Materials - Property of IBM
- IBM Cognos Products: ans
- (C) Copyright IBM Corp. 2005, 2010
- US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
- -->
- <!--
- * Copyright (C) 2008 Cognos ULC, an IBM Company. All rights reserved.
- * Cognos (R) is a trademark of Cognos ULC, (formerly Cognos Incorporated).
- *
- *
- *
- * This stylesheet merges all Muns in HLS with new Muns in the xml response that has the following format
- * <upgradeResponse>
- * <members>
- * <member mun="xxx" replacement="yyy"/>
- * ...
- * </members>
- * </upgradeResponse>
- -->
- <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:date="http://exslt.org/dates-and-times" xmlns:exsl="http://exslt.org/common" xmlns:xalan="http://xml.apache.org/xalan" xmlns:java="http://xml.apache.org/xalan/java" extension-element-prefixes="xalan date exsl" exclude-result-prefixes="xalan java date exsl">
- <xsl:output method="xml" version="1.0" encoding="UTF-8" omit-xml-declaration="yes"/>
- <!-- keys -->
- <xsl:key name="upgrademun" match="upgradeResponse/members/member" use="@mun"/>
- <xsl:template match="member|ci[@type='member']">
- <xsl:element name="{name()}">
- <!-- copy any attributes -->
- <xsl:for-each select="@*">
- <xsl:copy-of select="."/>
- </xsl:for-each>
- <!-- use mun as the key id -->
- <xsl:variable name="mun">
- <xsl:value-of select="."/>
- </xsl:variable>
- <xsl:choose>
- <xsl:when test="key('upgrademun', $mun)">
- <xsl:value-of select="key('upgrademun', $mun)/@replacement"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="."/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:element>
- </xsl:template>
- <xsl:template match="upgradeResponse">
- <!-- remove upgradeResponse from the HLS -->
- </xsl:template>
- <!-- Copy anything that is unmatched over to output. -->
- <xsl:template match="@*|node()">
- <xsl:copy>
- <xsl:apply-templates select="@*|node()"/>
- </xsl:copy>
- </xsl:template>
- </xsl:stylesheet>
|