123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580 |
- <?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:param name="dataFmt">formattedData</xsl:param>
- <xsl:template match="/">
- <ccs:reportData>
- <!-- The root object may or may not exist-->
- <xsl:for-each select="root/Document/DATA/PAGE">
- <xsl:apply-templates select="."/>
- </xsl:for-each>
- <xsl:for-each select="Document/DATA/PAGE">
- <xsl:apply-templates select="."/>
- </xsl:for-each>
- </ccs:reportData>
- </xsl:template>
- <xsl:template match="LIST">
- <xsl:param name="locid"/>
- <xsl:param name="reloc"/>
- <xsl:if test="@layoutClass = 'list' ">
- <xsl:element name="{$reloc}">
- <ccs:id>
- <xsl:choose>
- <xsl:when test="@name">
- <xsl:value-of select="@name"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$locid"/>
- </xsl:otherwise>
- </xsl:choose>
- </ccs:id>
- <ccs:locid>
- <xsl:value-of select="$locid"/>
- </ccs:locid>
- <ccs:style/>
- <ccs:name>
- <xsl:value-of select="@name"/>
- </ccs:name>
- <ccs:type>Table</ccs:type>
- <ccs:content>
- <ccs:table>
- <xsl:apply-templates select="DR"/>
- </ccs:table>
- </ccs:content>
- </xsl:element>
- </xsl:if>
- <xsl:if test="@layoutClass = 'crosstab' ">
- <xsl:element name="{$reloc}">
- <ccs:id>
- <xsl:choose>
- <xsl:when test="@name">
- <xsl:value-of select="@name"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$locid"/>
- </xsl:otherwise>
- </xsl:choose>
- </ccs:id>
- <ccs:locid>
- <xsl:value-of select="$locid"/>
- </ccs:locid>
- <ccs:style/>
- <ccs:name>
- <xsl:value-of select="@name"/>
- </ccs:name>
- <ccs:type>Table</ccs:type>
- <ccs:content>
- <ccs:table>
- <xsl:apply-templates select="DR"/>
- </ccs:table>
- </ccs:content>
- </xsl:element>
- </xsl:if>
- <xsl:if test="@layoutClass = 'table' ">
- <xsl:for-each select="DR/DRI/*[local-name() != 'OMAP']">
- <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:for-each select="OTR/DRI/*[local-name() != 'OMAP']">
- <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:if>
- <xsl:if test="@layoutClass = 'repeaterTable'">
- <xsl:for-each select="UNKNOWN/DRI">
- <xsl:call-template name="repeaterRow">
- <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:call-template>
- </xsl:for-each>
- <!--
- <xsl:for-each select="UNKNOWN/DRI/*[local-name() != 'OMAP']">
- <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:if>
- </xsl:template>
- <xsl:template name="repeaterRow">
- <xsl:param name="locid"/>
- <xsl:param name="reloc"/>
- <xsl:for-each select="./*[local-name() != 'OMAP']">
- <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>
- <!-- Just in case the UNKNOWN element reappears again.
- <xsl:template match="UNKNOWN[@layoutClass='table']">
- <xsl:param name="locid"/>
- <xsl:param name="reloc"/>
- <xsl:for-each select="OTR/DRI/*">
- <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="OFLDSET">
- <xsl:param name="locid"/>
- <xsl:param name="reloc"/>
- <xsl:for-each select="*[local-name() != 'OCAPTION']">
- <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="FORM|OTD">
- <xsl:param name="locid"/>
- <xsl:param name="reloc"/>
- <xsl:if test="@layoutClass = 'block' ">
- <xsl:for-each select="./*[local-name() != 'OMAP']">
- <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:if>
- <xsl:if test="@layoutClass = 'pageHeader' ">
- <xsl:for-each select="LIST[@layoutClass='table']/DR/DRI/*[local-name() != 'OMAP'] | LIST[@layoutClass='list'] | LIST[@layoutClass='repeaterTable'] | LIST[@layoutClass='crosstab'] | OTI | OIMG | FORM |LIST[@layoutClass='table']/OTR/DRI/*[local-name() != 'OMAP']|OCHART|OFLDSET">
- <xsl:apply-templates select=".">
- <xsl:with-param name="locid">
- <xsl:value-of select="concat($locid,':H',position())"/>
- </xsl:with-param>
- <xsl:with-param name="reloc">ccs:headerElements</xsl:with-param>
- </xsl:apply-templates>
- </xsl:for-each>
- </xsl:if>
- <xsl:if test="@layoutClass = 'pageBody'">
- <xsl:for-each select="LIST[@layoutClass='table']/DR/DRI/*[local-name() != 'OMAP'] | LIST[@layoutClass='list'] | LIST[@layoutClass='crosstab'] | LIST[@layoutClass='repeaterTable'] | OTI | OIMG | FORM |LIST[@layoutClass='table']/OTR/DRI/*[local-name() != 'OMAP']|OCHART|OFLDSET">
- <xsl:apply-templates select=".">
- <xsl:with-param name="locid">
- <xsl:value-of select="concat($locid,':B',position())"/>
- </xsl:with-param>
- <xsl:with-param name="reloc">ccs:bodyElements</xsl:with-param>
- </xsl:apply-templates>
- </xsl:for-each>
- </xsl:if>
- <xsl:if test="@layoutClass = 'pageFooter'">
- <xsl:for-each select="LIST[@layoutClass='table']/DR/DRI/*[local-name() != 'OMAP'] | LIST[@layoutClass='list'] | LIST[@layoutClass='repeaterTable'] | LIST[@layoutClass='crosstab'] | OTI | OIMG | FORM |LIST[@layoutClass='table']/OTR/DRI/*[local-name() != 'OMAP']|OCHART|OFLDSET">
- <xsl:apply-templates select=".">
- <xsl:with-param name="locid">
- <xsl:value-of select="concat($locid,':F',position())"/>
- </xsl:with-param>
- <xsl:with-param name="reloc">ccs:footerElements</xsl:with-param>
- </xsl:apply-templates>
- </xsl:for-each>
- </xsl:if>
- </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>
- <xsl:if test="../../styleOptions/cssUrl">
- <ccs:unprocessedStyle>
- <xsl:value-of select="../../styleOptions/cssUrl"/>
- </ccs:unprocessedStyle>
- </xsl:if>
- </ccs:pages>
- </xsl:template>
- <xsl:template match="DR">
- <ccs:row>
- <xsl:variable name="isCrosstabHeader">
- <xsl:choose>
- <xsl:when test="@layoutClass = 'crosstabColumns'">1</xsl:when>
- <xsl:otherwise>0</xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <ccs:type>
- <xsl:variable name="rowtype">
- <xsl:value-of select="@type"/>
- </xsl:variable>
- <xsl:choose>
- <xsl:when test="$isCrosstabHeader = '1'">Header</xsl:when>
- <xsl:when test="$rowtype = 'header'">Header</xsl:when>
- <xsl:when test="$rowtype = 'footer'">Footer</xsl:when>
- <xsl:otherwise>Detail</xsl:otherwise>
- </xsl:choose>
- </ccs:type>
- <xsl:for-each select="DRI">
- <ccs:cells>
- <!-- for an empty crosstab corner, create a textframe, with the spans and styles of the corner -->
- <xsl:if test="@layoutClass = 'crosstabCorner' and count(*) = 0">
- <ccs:parts>
- <ccs:id/>
- <xsl:if test="@rowspan">
- <ccs:rowspan>
- <xsl:value-of select="@rowspan"/>
- </ccs:rowspan>
- </xsl:if>
- <xsl:if test="@colspan">
- <ccs:colspan>
- <xsl:value-of select="@colspan"/>
- </ccs:colspan>
- </xsl:if>
- <ccs:type>TextFrame</ccs:type>
- <ccs:content>
- <ccs:textFrame>
- <ccs:value/>
- <ccs:dataFormat/>
- <ccs:valueType>text</ccs:valueType>
- </ccs:textFrame>
- </ccs:content>
- <xsl:call-template name="styles"/>
- </ccs:parts>
- </xsl:if>
- <xsl:for-each select="*">
- <xsl:apply-templates select=".">
- <xsl:with-param name="reloc">ccs:parts</xsl:with-param>
- </xsl:apply-templates>
- </xsl:for-each>
- </ccs:cells>
- </xsl:for-each>
- </ccs:row>
- </xsl:template>
- <xsl:template match="OIMG ">
- <xsl:param name="locid"/>
- <xsl:param name="reloc"/>
- <!-- temp fix for handling QS sort indicator images in COC -->
- <xsl:if test="$reloc != 'parts' or count(../*) < 2">
- <xsl:element name="{$reloc}">
- <ccs:id>
- <xsl:choose>
- <xsl:when test="@name">
- <xsl:value-of select="@name"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$locid"/>
- </xsl:otherwise>
- </xsl:choose>
- </ccs:id>
- <ccs:locid>
- <xsl:value-of select="$locid"/>
- </ccs:locid>
- <ccs:type>Image</ccs:type>
- <ccs:content>
- <ccs:image>
- <ccs:url>
- <xsl:choose>
- <xsl:when test="starts-with(@src,'http')">
- <xsl:value-of select="@src"/>
- </xsl:when>
- <xsl:otherwise>
- <ccs:unprocessedGateway>
- <xsl:choose>
- <xsl:when test="starts-with(@src,'?')">
- <xsl:value-of select="@src"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="concat('/../', @src)"/>
- </xsl:otherwise>
- </xsl:choose>
- </ccs:unprocessedGateway>
- </xsl:otherwise>
- </xsl:choose>
- </ccs:url>
- </ccs:image>
- <ccs:style/>
- </ccs:content>
- </xsl:element>
- </xsl:if>
- </xsl:template>
- <xsl:template match="OCHART">
- <xsl:param name="locid"/>
- <xsl:param name="reloc"/>
- <xsl:element name="{$reloc}">
- <ccs:id>
- <xsl:choose>
- <xsl:when test="@name">
- <xsl:value-of select="@name"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$locid"/>
- </xsl:otherwise>
- </xsl:choose>
- </ccs:id>
- <ccs:locid>
- <xsl:value-of select="$locid"/>
- </ccs:locid>
- <ccs:type>Chart</ccs:type>
- <ccs:content>
- <ccs:chart>
- <ccs:imageUrl>
- <xsl:choose>
- <xsl:when test="starts-with(@src,'http')">
- <xsl:value-of select="@src"/>
- </xsl:when>
- <xsl:otherwise>
- <ccs:unprocessedGateway>
- <xsl:choose>
- <xsl:when test="starts-with(@src,'?')">
- <xsl:value-of select="@src"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="concat('/../', @src)"/>
- </xsl:otherwise>
- </xsl:choose>
- </ccs:unprocessedGateway>
- </xsl:otherwise>
- </xsl:choose>
- </ccs:imageUrl>
- </ccs:chart>
- <ccs:style/>
- </ccs:content>
- </xsl:element>
- </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="drillTargets">
- <xsl:param name="locid"/>
- <xsl:param name="reloc"/>
- <xsl:for-each select="OTI">
- <xsl:apply-templates select=".">
- <xsl:with-param name="reloc">
- <xsl:value-of select="$reloc"/>
- </xsl:with-param>
- <xsl:with-param name="isDrillTarget">true</xsl:with-param>
- </xsl:apply-templates>
- </xsl:for-each>
- </xsl:template>
- <xsl:template match="OCAPTION">
- <!-- Do nothing with fieldset captions-->
- </xsl:template>
- <xsl:template match="OTI">
- <xsl:param name="locid"/>
- <xsl:param name="reloc"/>
- <xsl:param name="isDrillTarget">false</xsl:param>
- <xsl:if test="not(@style = 'visibility:hidden')">
- <xsl:element name="{$reloc}">
- <ccs:id>
- <xsl:choose>
- <xsl:when test="@name">
- <xsl:value-of select="@name"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$locid"/>
- </xsl:otherwise>
- </xsl:choose>
- </ccs:id>
- <ccs:locid>
- <xsl:value-of select="$locid"/>
- </ccs:locid>
- <xsl:choose>
- <xsl:when test="$isDrillTarget = 'true'">
- <xsl:if test="../../@rowspan">
- <ccs:rowspan>
- <xsl:value-of select="../../@rowspan"/>
- </ccs:rowspan>
- </xsl:if>
- </xsl:when>
- <xsl:when test="../../../../@rowspan and ../../../@layoutClass='table'">
- <ccs:rowspan>
- <xsl:value-of select="../../../../@rowspan"/>
- </ccs:rowspan>
- </xsl:when>
- <xsl:when test="../@rowspan">
- <ccs:rowspan>
- <xsl:value-of select="../@rowspan"/>
- </ccs:rowspan>
- </xsl:when>
- </xsl:choose>
- <xsl:choose>
- <xsl:when test="$isDrillTarget = 'true'">
- <xsl:choose>
- <xsl:when test="../../@colspan">
- <ccs:colspan>
- <xsl:value-of select="../../@colspan"/>
- </ccs:colspan>
- </xsl:when>
- <xsl:when test="../../@colSpan">
- <ccs:colspan>
- <xsl:value-of select="../../@colSpan"/>
- </ccs:colspan>
- </xsl:when>
- </xsl:choose>
- </xsl:when>
- <xsl:when test="../../../../@colspan and ../../../@layoutClass='table'">
- <ccs:colspan>
- <xsl:value-of select="../../../../@colspan"/>
- </ccs:colspan>
- </xsl:when>
- <xsl:when test="../@colspan">
- <ccs:colspan>
- <xsl:value-of select="../@colspan"/>
- </ccs:colspan>
- </xsl:when>
- <xsl:when test="../@colSpan">
- <colspan>
- <xsl:value-of select="../@colSpan"/>
- </colspan>
- </xsl:when>
- </xsl:choose>
- <ccs:type>TextFrame</ccs:type>
- <ccs:content>
- <ccs:textFrame>
- <ccs:value>
- <xsl:choose>
- <xsl:when test="($dataFmt='formattedData') or (string-length(@RawXML) = 0 )">
- <xsl:value-of select="."/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:choose>
- <xsl:when test="@valueType = 'number' ">
- <xsl:value-of select="translate(@RawXML, ',', '.')"/>
- </xsl:when>
- <xsl:when test="@valueType = 'currency' ">
- <xsl:value-of select="translate(@RawXML, ',', '.')"/>
- </xsl:when>
- <xsl:when test="@valueType = 'percent' ">
- <xsl:value-of select="translate(@RawXML, ',', '.')"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="@RawXML"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:otherwise>
- </xsl:choose>
- </ccs:value>
- <ccs:dataFormat>
- <xsl:value-of select="@formatPatternExcel"/>
- </ccs:dataFormat>
- <ccs:valueType>
- <xsl:value-of select="@valueType"/>
- </ccs:valueType>
- </ccs:textFrame>
- </ccs:content>
- <xsl:call-template name="styles"/>
- </xsl:element>
- </xsl:if>
- </xsl:template>
- <xsl:template name="styles">
- <xsl:if test="string-length(../../../@class) > 0">
- <ccs:preProcessedStyle>
- <xsl:value-of select="../../../@class"/>
- </ccs:preProcessedStyle>
- </xsl:if>
- <xsl:if test="string-length(../../../@style) > 0">
- <ccs:unprocessedStyle>
- <xsl:value-of select="../../../@style"/>
- </ccs:unprocessedStyle>
- </xsl:if>
- <xsl:if test="string-length(../../@class) > 0">
- <ccs:preProcessedStyle>
- <xsl:value-of select="../../@class"/>
- </ccs:preProcessedStyle>
- </xsl:if>
- <xsl:if test="string-length(../../@style) > 0">
- <ccs:unprocessedStyle>
- <xsl:value-of select="../../@style"/>
- </ccs:unprocessedStyle>
- </xsl:if>
- <xsl:if test="string-length(../@class) > 0">
- <ccs:preProcessedStyle>
- <xsl:value-of select="../@class"/>
- </ccs:preProcessedStyle>
- </xsl:if>
- <xsl:if test="string-length(../@style) > 0">
- <ccs:unprocessedStyle>
- <xsl:value-of select="../@style"/>
- </ccs:unprocessedStyle>
- </xsl:if>
- <xsl:if test="string-length(@class) > 0">
- <ccs:preProcessedStyle>
- <xsl:value-of select="@class"/>
- </ccs:preProcessedStyle>
- </xsl:if>
- <xsl:if test="string-length(@style) > 0">
- <ccs:unprocessedStyle>
- <xsl:value-of select="@style"/>
- </ccs:unprocessedStyle>
- </xsl:if>
- </xsl:template>
- </xsl:stylesheet>
|