123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!--
- Licensed Materials - Property of IBM
- IBM Cognos Products: cpscrn
- (C) Copyright IBM Corp. 2005, 2011
- 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" xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt" exclude-result-prefixes="xtsext">
- <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
-
- <xsl:param name="mapfile"/>
-
- <xsl:param name="comments" select="true()"/>
-
- <xsl:preserve-space elements="set"/>
- <xsl:variable name="mapdoc" select="document( $mapfile )"/>
- <xsl:variable name="mapItems" select="$mapdoc/skinUpgrade/item"/>
-
- <xsl:template match="/">
- <xsl:call-template name="emitBrandingHeader"/>
- <xsl:apply-templates/>
- </xsl:template>
-
- <xsl:template match="css">
- <xsl:copy>
- <xsl:call-template name="emitBrandingHeaderForCss"/>
- <xsl:apply-templates select="import | class | comment"/>
- </xsl:copy>
- </xsl:template>
- <xsl:template match="class">
- <xsl:value-of select="@name"/>
- <xsl:if test="@comment and $comments='true'">
- <xsl:text> /* </xsl:text>
- <xsl:value-of select="@comment"/>
- <xsl:text> */</xsl:text>
- </xsl:if>
- <xsl:text> { </xsl:text>
- <xsl:call-template name="gen-attributes"/>
- <xsl:text>} </xsl:text>
- </xsl:template>
- <xsl:template name="gen-attributes">
- <xsl:variable name="uses" select="concat(' ', @uses, ' ')"/>
- <xsl:apply-templates select="set | /css/type[ contains($uses, concat(' ',@name,' ')) ]/set"/>
- </xsl:template>
- <xsl:template match="set">
- <xsl:text>	</xsl:text>
- <xsl:value-of select="@name"/>
- <xsl:text>: </xsl:text>
- <xsl:apply-templates mode="attribute"/>
- <xsl:text>;</xsl:text>
- <xsl:text> </xsl:text>
- </xsl:template>
-
- <xsl:template match="color" mode="attribute">
- <xsl:call-template name="emitReferenceToSkin">
- <xsl:with-param name="section" select="'colors/color'"/>
- </xsl:call-template>
- </xsl:template>
-
- <xsl:template match="value" mode="attribute">
- <xsl:call-template name="emitReferenceToSkin">
- <xsl:with-param name="section" select="'values/value'"/>
- </xsl:call-template>
- </xsl:template>
-
- <xsl:template match="image" mode="attribute">
- <xsl:call-template name="emitReferenceToSkin">
- <xsl:with-param name="section" select="'images/image'"/>
- </xsl:call-template>
- </xsl:template>
-
- <xsl:template name="emitReferenceToSkin">
- <xsl:param name="section"/>
- <xsl:variable name="oldXPath">/skin/<xsl:value-of select="$section"/>[@name='<xsl:value-of select="@name"/>']</xsl:variable>
- <xsl:variable name="mappingItem" select="$mapItems[@oldXpath=$oldXPath]"/>
- <xsl:choose>
- <xsl:when test="$mappingItem[ @newXpath ]">
- <xsl:element name="skinValue">
- <xsl:attribute name="path">
- <xsl:value-of select="$mappingItem/@newXpath"/>
- </xsl:attribute>
- </xsl:element>
- </xsl:when>
- <xsl:when test="$mappingItem[ @newValue ]">
- <xsl:value-of select="$mappingItem/@newValue"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:text>/* WARNING: A reference to an old skin could not have been upgraded. Failed to find mapping data for the following old XPath: </xsl:text>
- <xsl:value-of select="$oldXPath"/>
- <xsl:text> */</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
- <xsl:template match="comment">
- <xsl:if test="$comments='true'">
- <xsl:text> /* </xsl:text>
- <xsl:value-of select="."/>
- <xsl:text> */ </xsl:text>
- </xsl:if>
- </xsl:template>
-
- <xsl:template match="import">
- <xsl:text>@import url(</xsl:text>
- <xsl:value-of select="."/>
- <xsl:text>); </xsl:text>
- </xsl:template>
- <xsl:template match="remove"/>
-
- <xsl:template name="emitBrandingHeader">
- <xsl:comment>
- Licensed Materials - Property of IBM
-
- IBM Cognos Products: cpscrn
-
- (C) Copyright IBM Corp. 2005, 2012
-
- US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
- </xsl:comment>
- <xsl:text> </xsl:text>
- </xsl:template>
-
- <xsl:template name="emitBrandingHeaderForCss">
- <xsl:text>
- /********************************
- * Licensed Materials - Property of IBM
- *
- * IBM Cognos Products: cpscrn
- *
- * (C) Copyright IBM Corp. 2005, 2012
- *
- * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
- ********************************/
- </xsl:text>
- </xsl:template>
- </xsl:stylesheet>
|