123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!--
- Licensed Materials - Property of IBM
- IBM Cognos Products: CCS
- (c) Copyright IBM Corp. 2005, 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="http://www.ibm.com/xmlns/prod/cognos/layoutData/200904" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:rds="http://developer.cognos.com/schemas/rds/types/2">
- <xsl:param name="gateway"/>
- <xsl:param name="cogGateway" select="'http://localhost/cognos8/cgi-bin/cognos.cgi'"/>
- <xsl:param name="transformData" select="'true'"/>
- <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes" omit-xml-declaration="yes"/>
- <xsl:template match="/">
- <xsl:choose>
- <xsl:when test="data/tab/crosstab/datarow/col[@src]">
- <xsl:choose>
- <xsl:when test="$transformData = 'true'">
- <page>
- <id>c4</id>
- <body>
- <xsl:apply-templates select="data/tab/crosstab/datarow"/>
- </body>
- </page>
- </xsl:when>
- <xsl:otherwise>
- <rds:page>
- <id>c4</id>
- <rds:posId>P2</rds:posId>
- <rds:body>
- <rds:item>
- <rds:posId>P2B1TR1TC1IT1</rds:posId>
- <rds:conditional>false</rds:conditional>
- <rds:MChart>
- <id>
- <xsl:value-of select="concat('c',position())"/>
- </id>
- </rds:MChart>
- </rds:item>
- <xsl:if test="data/tab/crosstab/datarow/col/area[@icon or @color or @backicon]">
- <rds:item>
- <rds:posId>P2B1TR1TC2IT1</rds:posId>
- <rds:conditional>false</rds:conditional>
- <rds:MListFrame>
- <id>
- <xsl:value-of select="concat('cl',position())"/>
- </id>
- </rds:MListFrame>
- </rds:item>
- </xsl:if>
- </rds:body>
- </rds:page>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:when>
- <xsl:otherwise>
- <noData/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
- <xsl:template match="datarow">
- <xsl:if test="col/@src">
- <item>
- <cht>
- <id>
- <xsl:value-of select="concat('c',position())"/>
- </id>
- <url>
- <xsl:value-of select="concat($gateway,col/@src)"/>
- </url>
- </cht>
- </item>
- </xsl:if>
- <xsl:if test="col/area[@icon or @color or @gradicon or @backicon]">
- <!--This generates the legend (if applicable)-->
- <item>
- <lst>
- <id>
- <xsl:value-of select="concat('cl', position())"/>
- </id>
- <colTitle>
- <style>td</style>
- <!--This is a blank placeholder cell-->
- <item>
- <txt>
- <val/>
- <valTyp>text</valTyp>
- <exclPatrn>General</exclPatrn>
- </txt>
- </item>
- </colTitle>
- <colTitle>
- <style>td</style>
- <style>legendtitle</style>
- <item>
- <txt>
- <style>td</style>
- <style>legendtitle</style>
- <val>
- <!-- if its a col-based chart - i.e. pie - get title there, otherwise from datarow -->
- <xsl:choose>
- <xsl:when test="col/@description = 'Pie' ">
- <xsl:value-of select="col/@text"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="./@text"/>
- </xsl:otherwise>
- </xsl:choose>
- </val>
- <valTyp>text</valTyp>
- <exclPatrn>General</exclPatrn>
- </txt>
- </item>
- </colTitle>
- <xsl:if test="col/area[@value]">
- <colTitle>
- <style>td</style>
- <style>legendtitle</style>
- <item>
- <txt>
- <style>legendtitle</style>
- <val>
- <xsl:value-of select="../measure/@name"/>
- </val>
- <valTyp>text</valTyp>
- <exclPatrn>General</exclPatrn>
- </txt>
- </item>
- </colTitle>
- </xsl:if>
- <group>
- <xsl:apply-templates select="col/area"/>
- <depth>1</depth>
- </group>
- </lst>
- </item>
- </xsl:if>
- </xsl:template>
- <xsl:template match="area[@icon or @color or @gradicon or @backicon]">
- <row>
- <cell>
- <style>td</style>
- <item>
- <img>
- <xsl:choose>
- <xsl:when test="@icon">
- <xsl:choose>
- <xsl:when test="@color">
- <url>
- <xsl:value-of select="concat($gateway,'/../../ppwb/Icon/',@icon,'.gif&ccs_color=FF', @color)"/>
- </url>
- </xsl:when>
- <xsl:otherwise>
- <url>
- <xsl:value-of select="concat($gateway,'/../../ppwb/Icon/',@icon,'.gif')"/>
- </url>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:when>
- <xsl:when test="@gradicon">
- <url>
- <xsl:value-of select="concat($gateway,@gradicon)"/>
- </url>
- </xsl:when>
- <xsl:when test="@backicon">
- <url>
- <xsl:value-of select="concat($gateway,@backicon)"/>
- </url>
- </xsl:when>
- <xsl:otherwise>
- <url>
- <xsl:value-of select="concat('color://FF', @color)"/>
- <!--Return value as an ARGB hex value-->
- </url>
- </xsl:otherwise>
- </xsl:choose>
- </img>
- </item>
- </cell>
- <cell>
- <style>td</style>
- <style>legendcell</style>
- <item>
- <txt>
- <style>legendcell</style>
- <val>
- <xsl:value-of select="@name"/>
- </val>
- <valTyp>text</valTyp>
- <exclPatrn>General</exclPatrn>
- </txt>
- </item>
- </cell>
- <xsl:if test="@value">
- <cell>
- <style>td</style>
- <style>legendcell</style>
- <item>
- <txt>
- <style>legendcell</style>
- <val>
- <xsl:value-of select="@value"/>
- </val>
- <valTyp>text</valTyp>
- <exclPatrn>General</exclPatrn>
- </txt>
- </item>
- </cell>
- </xsl:if>
- </row>
- </xsl:template>
- </xsl:stylesheet>
|