123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326 |
- <?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:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ccs="http://developer.cognos.com/rds/1" xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance">
- <xsl:output method="xml" omit-xml-declaration="yes" encoding="UTF-8" version="1.0"/>
- <xsl:param name="gateway" select="'http://localhost/cognos/cgi-bin/ppdscgi.exe'"/>
- <xsl:param name="crnGateway" select="'http://localhost/crn/cgi-bin/cognos.cgi'"/>
- <xsl:param name="transformData" select="'false'"/>
- <xsl:template match="/">
- <ccs:chartsInfo>
- <xsl:apply-templates select="data" mode="meta"/>
- <xsl:if test="$transformData = 'true'">
- <xsl:apply-templates select="data"/>
- </xsl:if>
- </ccs:chartsInfo>
- </xsl:template>
- <!--***********************************************************************************
- MetaData Templates
- **************************************************************************************-->
- <xsl:template match="data" mode="meta">
- <!--
- For PP, the foll. hard coded ids hold :
- id 1 : Top Report
- id 2 : Crosstab
- id 3 : Status line
- id 4: Page
- -->
- <xsl:if test="tab/crosstab/datarow/col/@src">
- <ccs:chartsMeta>
- <ccs:pages>
- <ccs:id>c4</ccs:id>
- <ccs:name/>
- <ccs:type>Page</ccs:type>
- <ccs:content>
- <ccs:page>
- <ccs:headerElements/>
- <xsl:apply-templates select="tab/crosstab/datarow" mode="meta"/>
- <ccs:footerElements>
- </ccs:footerElements>
- </ccs:page>
- </ccs:content>
- </ccs:pages>
- </ccs:chartsMeta>
- </xsl:if>
- </xsl:template>
- <xsl:template match="tab/crosstab/datarow" mode="meta">
- <xsl:if test="col/@src">
- <ccs:bodyElements>
- <ccs:id>
- <xsl:value-of select="concat('c', position())"/>
- </ccs:id>
- <ccs:name>Chart</ccs:name>
- <ccs:type>Chart</ccs:type>
- <ccs:content>
- <ccs:chart>
- <ccs:hSize>0</ccs:hSize>
- <ccs:vSize>0</ccs:vSize>
- </ccs:chart>
- <ccs:style/>
- </ccs:content>
- </ccs:bodyElements>
- <xsl:if test="col/area[@icon or @color]">
- <ccs:bodyElements>
- <ccs:id>
- <xsl:value-of select="concat('cl', position())"/>
- </ccs:id>
- <ccs:name>Legend</ccs:name>
- <ccs:type>Table</ccs:type>
- <ccs:content>
- <ccs:table>
- <ccs:isCrossTab>false</ccs:isCrossTab>
- <ccs:moreRows>false</ccs:moreRows>
- <ccs:moreCols>false</ccs:moreCols>
- <ccs:measure/>
- <ccs:measureStyle/>
- <ccs:rows/>
- <ccs:columns>
- <ccs:isSummary>false</ccs:isSummary>
- <ccs:startPos>0</ccs:startPos>
- <ccs:name> </ccs:name>
- <ccs:size>1</ccs:size>
- <ccs:style/>
- <ccs:containedGroup/>
- </ccs:columns>
- <ccs:columns>
- <ccs:isSummary>false</ccs:isSummary>
- <ccs:startPos>1</ccs:startPos>
- <ccs:name> </ccs:name>
- <ccs:size>1</ccs:size>
- <ccs:style/>
- <ccs:containedGroup/>
- </ccs:columns>
- <xsl:if test="col/area[@value]">
- <ccs:columns>
- <ccs:isSummary>false</ccs:isSummary>
- <ccs:startPos>1</ccs:startPos>
- <ccs:name> </ccs:name>
- <ccs:size>1</ccs:size>
- <ccs:style/>
- <ccs:containedGroup/>
- </ccs:columns>
- </xsl:if>
- </ccs:table>
- </ccs:content>
- </ccs:bodyElements>
- </xsl:if>
- </xsl:if>
- </xsl:template>
- <!--************************************************************************************************************
- Data Templates
- ************************************************************************************************************-->
- <xsl:template match="data">
- <!--
- For PP, the foll. hard coded ids hold :
- id 1 : Top Report
- id 2 : Chart
- id 3 : Status line
- id 4: Page
- id 5: Legend for chart
- -->
- <xsl:if test="tab/crosstab/datarow/col/@src">
- <ccs:chartsData>
- <ccs:pages>
- <ccs:id>c4</ccs:id>
- <ccs:name/>
- <ccs:type>Page</ccs:type>
- <ccs:content>
- <ccs:page>
- <ccs:headerElement/>
- <!-- check for simplied - i.e. unnested - chart case -->
- <xsl:apply-templates select="tab/crosstab/datarow"/>
- <ccs:footerElements>
- <xsl:choose>
- <xsl:when test="normalize-space(tab/status_line/@status)">
- <ccs:id>c3</ccs:id>
- <ccs:name>statusLine</ccs:name>
- <ccs:type>TextFrame</ccs:type>
- <ccs:content>
- <ccs:textFrame>
- <ccs:value>
- <xsl:value-of select="tab/status_line/@status"/>
- </ccs:value>
- <ccs:valueType>text</ccs:valueType>
- </ccs:textFrame>
- </ccs:content>
- </xsl:when>
- </xsl:choose>
- </ccs:footerElements>
- </ccs:page>
- </ccs:content>
- </ccs:pages>
- </ccs:chartsData>
- </xsl:if>
- </xsl:template>
- <xsl:template match="tab/crosstab/datarow">
- <xsl:if test="col/@src">
- <ccs:bodyElements>
- <ccs:id>
- <xsl:value-of select="concat('c', position())"/>
- </ccs:id>
- <ccs:name>Chart</ccs:name>
- <ccs:type>Chart</ccs:type>
- <ccs:content>
- <ccs:chart>
- <ccs:imageUrl>
- <xsl:value-of select="concat($gateway,'/../../..',col/@src)"/>
- </ccs:imageUrl>
- </ccs:chart>
- </ccs:content>
- </ccs:bodyElements>
- <xsl:if test="col/area[@icon or @color or @gradicon]">
- <ccs:bodyElements>
- <ccs:id>
- <xsl:value-of select="concat('cl', position())"/>
- </ccs:id>
- <ccs:name>Legend</ccs:name>
- <ccs:type>Table</ccs:type>
- <ccs:content>
- <ccs:table>
- <!-- first generate the title bar -->
- <ccs:row>
- <ccs:type>Header</ccs:type>
- <ccs:cells>
- <ccs:parts>
- <ccs:id/>
- <ccs:type>TextFrame</ccs:type>
- <ccs:content>
- <ccs:textFrame>
- <ccs:value> </ccs:value>
- <ccs:valueType>text</ccs:valueType>
- <dataFormat>
- <xsl:value-of select="General"/>
- </dataFormat>
- </ccs:textFrame>
- </ccs:content>
- </ccs:parts>
- </ccs:cells>
- <ccs:cells>
- <ccs:parts>
- <ccs:id/>
- <ccs:type>TextFrame</ccs:type>
- <ccs:content>
- <ccs:textFrame>
- <ccs:value>
- <!-- 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>
- </ccs:value>
- <ccs:valueType>text</ccs:valueType>
- <ccs:dataFormat>
- <xsl:value-of select="General"/>
- </ccs:dataFormat>
- </ccs:textFrame>
- </ccs:content>
- <ccs:style>legendtitle</ccs:style>
- </ccs:parts>
- </ccs:cells>
- <xsl:if test="col/area[@value]">
- <ccs:cells>
- <ccs:parts>
- <ccs:id/>
- <ccs:type>TextFrame</ccs:type>
- <ccs:content>
- <ccs:textFrame>
- <ccs:value>
- <xsl:value-of select="../measure/@name"/>
- </ccs:value>
- <ccs:valueType>text</ccs:valueType>
- <ccs:dataFormat>
- <xsl:value-of select="General"/>
- </ccs:dataFormat>
- </ccs:textFrame>
- </ccs:content>
- <ccs:style>legendtitle</ccs:style>
- </ccs:parts>
- </ccs:cells>
- </xsl:if>
- </ccs:row>
- <xsl:apply-templates select="col/area"/>
- </ccs:table>
- </ccs:content>
- </ccs:bodyElements>
- </xsl:if>
- </xsl:if>
- </xsl:template>
- <!-- get the data rows -->
- <xsl:template match="area[@icon or @color or @gradicon]">
- <ccs:row>
- <ccs:type>Detail</ccs:type>
- <ccs:cells>
- <ccs:parts>
- <ccs:id/>
- <ccs:type>Image</ccs:type>
- <ccs:content>
- <ccs:image>
- <ccs:url>
- <xsl:choose>
- <xsl:when test="@icon">
- <xsl:value-of select="concat($gateway,'/../../ppwb/Icon/',@icon,'.gif')"/>
- </xsl:when>
- <xsl:when test="@gradicon">
- <xsl:value-of select="concat($gateway,@gradicon)"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="concat($crnGateway,'/../../ccs/images/bkg',@color,'.GIF')"/>
- </xsl:otherwise>
- </xsl:choose>
- </ccs:url>
- </ccs:image>
- </ccs:content>
- </ccs:parts>
- </ccs:cells>
- <ccs:cells>
- <ccs:parts>
- <ccs:id/>
- <ccs:type>TextFrame</ccs:type>
- <ccs:content>
- <ccs:textFrame>
- <ccs:value>
- <xsl:value-of select="@name"/>
- </ccs:value>
- <ccs:valueType>text</ccs:valueType>
- <ccs:dataFormat>
- <xsl:value-of select="General"/>
- </ccs:dataFormat>
- </ccs:textFrame>
- </ccs:content>
- <ccs:style>legendcell</ccs:style>
- </ccs:parts>
- </ccs:cells>
- <xsl:if test="@value">
- <ccs:cells>
- <ccs:parts>
- <ccs:id/>
- <ccs:type>TextFrame</ccs:type>
- <ccs:content>
- <ccs:textFrame>
- <ccs:value>
- <xsl:value-of select="@value"/>
- </ccs:value>
- <ccs:valueType>text</ccs:valueType>
- <ccs:dataFormat>
- <xsl:value-of select="General"/>
- </ccs:dataFormat>
- </ccs:textFrame>
- </ccs:content>
- <ccs:style>legendcell</ccs:style>
- </ccs:parts>
- </ccs:cells>
- </xsl:if>
- </ccs:row>
- </xsl:template>
- </xsl:stylesheet>
|