123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346 |
- <?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 xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:ccs="http://developer.cognos.com/rds/1">
- <xsl:output method="xml" omit-xml-declaration="yes" encoding="UTF-8" version="1.0"/>
- <xsl:template match="/">
- <ccs:topReport>
- <ccs:title/>
- <xsl:apply-templates select="report/layouts/layout/reportPages"/>
- </ccs:topReport>
- </xsl:template>
- <!-- first the metadata templates -->
- <xsl:template match="list">
- <xsl:param name="locid"/>
- <xsl:param name="reloc"/>
- <xsl:element name="{$reloc}">
- <ccs:id>
- <xsl:value-of select="$locid"/>
- </ccs:id>
- <ccs:style/>
- <ccs:name>
- <xsl:value-of select="@name"/>
- </ccs:name>
- <ccs:type>Table</ccs:type>
- <ccs:content>
- <ccs:table>
- <ccs:isCrossTab>false</ccs:isCrossTab>
- <ccs:moreRows>0</ccs:moreRows>
- <ccs:moreCols>0</ccs:moreCols>
- <ccs:rows/>
- <xsl:for-each select="listColumns/listColumn">
- <ccs:columns>
- <ccs:isSummary>false</ccs:isSummary>
- <ccs:startPos>
- <xsl:value-of select="position() - 1"/>
- </ccs:startPos>
- <ccs:name>
- <xsl:value-of select="listColumnTitle/contents/textItem/dataSource/dataItemLabel/@refDataItem"/>
- </ccs:name>
- <xsl:apply-templates select="listColumnBody/contents">
- <xsl:with-param name="locid">
- <xsl:value-of select="concat($locid,':C')"/>
- </xsl:with-param>
- <xsl:with-param name="reloc">ccs:columnType</xsl:with-param>
- </xsl:apply-templates>
- <ccs:size>1</ccs:size>
- <ccs:style/>
- <ccs:containedGroup/>
- </ccs:columns>
- </xsl:for-each>
- </ccs:table>
- </ccs:content>
- </xsl:element>
- </xsl:template>
- <xsl:template match="table">
- <xsl:param name="locid"/>
- <xsl:param name="reloc"/>
- <xsl:for-each select="tableRows/tableRow/tableCells/tableCell/contents/*">
- <xsl:apply-templates select=".">
- <xsl:with-param name="locid">
- <xsl:value-of select="concat($locid,'T',position())"/>
- </xsl:with-param>
- <xsl:with-param name="reloc">
- <xsl:value-of select="$reloc"/>
- </xsl:with-param>
- </xsl:apply-templates>
- </xsl:for-each>
- </xsl:template>
- <xsl:template match="conditionalBlocks">
- <xsl:param name="locid"/>
- <xsl:param name="reloc"/>
- <!-- We don't actually process anything in conditonal blocks just yet, but we must count the block or else IDs will be messed up-->
- </xsl:template>
- <xsl:template match="hyperlink">
- <xsl:param name="locid"/>
- <xsl:param name="reloc"/>
- <!-- Explicitly ignore hyperlinks in this version. -->
- </xsl:template>
- <xsl:template match="repeaterTable">
- <xsl:param name="locid"/>
- <xsl:param name="reloc"/>
- <xsl:for-each select="repeaterTableCell/contents/*">
- <xsl:apply-templates select=".">
- <xsl:with-param name="locid">
- <xsl:value-of select="concat($locid,'RT',position())"/>
- </xsl:with-param>
- <xsl:with-param name="reloc">
- <xsl:value-of select="$reloc"/>
- </xsl:with-param>
- </xsl:apply-templates>
- </xsl:for-each>
- </xsl:template>
- <xsl:template match="crosstab">
- <xsl:param name="locid"/>
- <xsl:param name="reloc"/>
- <xsl:element name="{$reloc}">
- <ccs:id>
- <xsl:value-of select="$locid"/>
- </ccs:id>
- <ccs:style/>
- <ccs:name>
- <xsl:value-of select="@name"/>
- </ccs:name>
- <ccs:type>Table</ccs:type>
- <ccs:content>
- <ccs:table>
- <ccs:isCrossTab>false</ccs:isCrossTab>
- <ccs:moreRows>0</ccs:moreRows>
- <ccs:moreCols>0</ccs:moreCols>
- <ccs:rows/>
- <ccs:columns/>
- </ccs:table>
- </ccs:content>
- </xsl:element>
- </xsl:template>
- <xsl:template match="block">
- <xsl:param name="locid"/>
- <xsl:param name="reloc"/>
- <xsl:for-each select="contents/*">
- <xsl:apply-templates select=".">
- <xsl:with-param name="locid">
- <xsl:value-of select="concat($locid,'P',position())"/>
- </xsl:with-param>
- <xsl:with-param name="reloc">
- <xsl:value-of select="$reloc"/>
- </xsl:with-param>
- </xsl:apply-templates>
- </xsl:for-each>
- </xsl:template>
- <xsl:template match="fieldSet">
- <xsl:param name="locid"/>
- <xsl:param name="reloc"/>
- <xsl:for-each select="contents/*">
- <xsl:apply-templates select=".">
- <xsl:with-param name="locid">
- <xsl:value-of select="concat($locid,'P',position())"/>
- </xsl:with-param>
- <xsl:with-param name="reloc">
- <xsl:value-of select="$reloc"/>
- </xsl:with-param>
- </xsl:apply-templates>
- </xsl:for-each>
- </xsl:template>
- <xsl:template match="page">
- <xsl:variable name="locid">
- <xsl:choose>
- <xsl:when test="@name">
- <xsl:value-of select="@name"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="concat('page_',position())"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <ccs:pages>
- <ccs:id>
- <xsl:value-of select="$locid"/>
- </ccs:id>
- <ccs:name>
- <xsl:if test="@name">
- <xsl:value-of select="$locid"/>
- </xsl:if>
- </ccs:name>
- <ccs:type>Page</ccs:type>
- <ccs:content>
- <ccs:page>
- <xsl:apply-templates>
- <xsl:with-param name="locid">
- <xsl:value-of select="$locid"/>
- </xsl:with-param>
- </xsl:apply-templates>
- </ccs:page>
- </ccs:content>
- </ccs:pages>
- </xsl:template>
- <xsl:template match="pageBody">
- <xsl:param name="locid"/>
- <xsl:apply-templates select="contents">
- <xsl:with-param name="locid">
- <xsl:value-of select="concat($locid,':B')"/>
- </xsl:with-param>
- <xsl:with-param name="reloc">ccs:bodyElements</xsl:with-param>
- </xsl:apply-templates>
- </xsl:template>
- <xsl:template match="pageHeader">
- <xsl:param name="locid"/>
- <xsl:apply-templates select="contents">
- <xsl:with-param name="locid">
- <xsl:value-of select="concat($locid,':H')"/>
- </xsl:with-param>
- <xsl:with-param name="reloc">ccs:headerElements</xsl:with-param>
- </xsl:apply-templates>
- </xsl:template>
- <xsl:template match="pageFooter">
- <xsl:param name="locid"/>
- <xsl:apply-templates select="contents">
- <xsl:with-param name="locid">
- <xsl:value-of select="concat($locid,':F')"/>
- </xsl:with-param>
- <xsl:with-param name="reloc">ccs:footerElements</xsl:with-param>
- </xsl:apply-templates>
- </xsl:template>
- <xsl:template match="contents">
- <xsl:param name="locid"/>
- <xsl:param name="reloc"/>
- <xsl:for-each select="table/tableRows/tableRow/tableCells/tableCell/contents/* | list | block | crosstab | textItem | image | CMMMap | pieChart | radarChart | progressiveChart | combinationChart | paretoChart | scatterChart | bubbleChart | polarChart | threeDCombinationChart | threeDScatterChart | gaugeChart|mapChart | metricsChart | fieldSet | repeaterTable | conditionalBlocks | hyperlink">
- <xsl:apply-templates select=".">
- <xsl:with-param name="locid">
- <xsl:value-of select="concat($locid,position())"/>
- </xsl:with-param>
- <xsl:with-param name="reloc">
- <xsl:value-of select="$reloc"/>
- </xsl:with-param>
- </xsl:apply-templates>
- </xsl:for-each>
- </xsl:template>
- <xsl:template match="OTR">
- <xsl:param name="locid"/>
- <xsl:param name="reloc"/>
- <xsl:for-each select="*">
- <xsl:apply-templates select=".">
- <xsl:with-param name="locid">
- <xsl:value-of select="$locid"/>
- </xsl:with-param>
- <xsl:with-param name="reloc">
- <xsl:value-of select="$reloc"/>
- </xsl:with-param>
- </xsl:apply-templates>
- </xsl:for-each>
- </xsl:template>
- <xsl:template match="textItem">
- <xsl:param name="locid"/>
- <xsl:param name="reloc">noname</xsl:param>
- <xsl:element name="{$reloc}">
- <ccs:id>
- <xsl:value-of select="$locid"/>
- </ccs:id>
- <ccs:style>
- </ccs:style>
- <ccs:name>
- <xsl:value-of select="@name"/>
- </ccs:name>
- <ccs:type>TextFrame</ccs:type>
- <ccs:content>
- <ccs:textFrame>
- <ccs:hSize>0</ccs:hSize>
- <ccs:vSize>0</ccs:vSize>
- </ccs:textFrame>
- </ccs:content>
- </xsl:element>
- </xsl:template>
- <xsl:template match="image | CMMMap">
- <xsl:param name="locid"/>
- <xsl:param name="reloc"/>
- <xsl:element name="{$reloc}">
- <ccs:id>
- <xsl:value-of select="$locid"/>
- </ccs:id>
- <xsl:if test="@name">
- <ccs:name>
- <xsl:value-of select="@name"/>
- </ccs:name>
- </xsl:if>
- <ccs:type>Image</ccs:type>
- <ccs:content>
- <ccs:image>
- <ccs:hSize>
- <!-- style="width:400px;height:40px" -->
- <xsl:variable name="width">
- <xsl:value-of select="substring-before(substring-after(style/CSS/@value,'width:'),'px')"/>
- </xsl:variable>
- <xsl:choose>
- <xsl:when test="string-length($width) > 0">
- <xsl:value-of select="$width"/>
- </xsl:when>
- <xsl:otherwise>0</xsl:otherwise>
- </xsl:choose>
- </ccs:hSize>
- <ccs:vSize>
- <xsl:variable name="height">
- <xsl:value-of select="substring-before(substring-after(style/CSS/@value,'height:'),'px')"/>
- </xsl:variable>
- <xsl:choose>
- <xsl:when test="string-length($height) > 0">
- <xsl:value-of select="$height"/>
- </xsl:when>
- <xsl:otherwise>0</xsl:otherwise>
- </xsl:choose>
- </ccs:vSize>
- <ccs:imageType>gif</ccs:imageType>
- </ccs:image>
- <ccs:style/>
- </ccs:content>
- </xsl:element>
- </xsl:template>
- <xsl:template match="pieChart | radarChart | progressiveChart | combinationChart | paretoChart | scatterChart | bubbleChart | polarChart | threeDCombinationChart | threeDScatterChart | gaugeChart|mapChart | metricsChart">
- <xsl:param name="locid"/>
- <xsl:param name="reloc"/>
- <xsl:element name="{$reloc}">
- <ccs:id>
- <xsl:value-of select="$locid"/>
- </ccs:id>
- <ccs:type>Chart</ccs:type>
- <xsl:if test="@name">
- <ccs:name>
- <xsl:value-of select="@name"/>
- </ccs:name>
- </xsl:if>
- <ccs:content>
- <ccs:chart>
- <ccs:hSize>
- <!-- style="width:400px;height:40px" -->
- <xsl:variable name="width">
- <xsl:value-of select="substring-before(substring-after(style/CSS/@value,'width:'),'px')"/>
- </xsl:variable>
- <xsl:choose>
- <xsl:when test="string-length($width) > 0">
- <xsl:value-of select="$width"/>
- </xsl:when>
- <xsl:otherwise>0</xsl:otherwise>
- </xsl:choose>
- </ccs:hSize>
- <ccs:vSize>
- <xsl:variable name="height">
- <xsl:value-of select="substring-before(substring-after(style/CSS/@value,'height:'),'px')"/>
- </xsl:variable>
- <xsl:choose>
- <xsl:when test="string-length($height) > 0">
- <xsl:value-of select="$height"/>
- </xsl:when>
- <xsl:otherwise>0</xsl:otherwise>
- </xsl:choose>
- </ccs:vSize>
- </ccs:chart>
- <ccs:style/>
- </ccs:content>
- </xsl:element>
- </xsl:template>
- </xsl:stylesheet>
|