123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348 |
- <?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:fo="http://www.w3.org/1999/XSL/Format" xmlns:rds="http://developer.cognos.com/schemas/rds/contentmodel/1">
- <xsl:output method="xml" doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"/>
- <xsl:param name="genFragment">false</xsl:param>
- <xsl:variable name="fragprefix">
- <xsl:choose>
- <xsl:when test="$genFragment = 'true'">_THIS_</xsl:when>
- <xsl:otherwise/>
- </xsl:choose>
- </xsl:variable>
- <xsl:variable name="quot">"</xsl:variable>
- <xsl:variable name="apos">'</xsl:variable>
- <xsl:variable name="versionbase">
- <xsl:value-of select="/*/rds:versionBase"/>
- </xsl:variable>
- <xsl:template match="/">
- <xsl:choose>
- <xsl:when test="$genFragment = 'true'">
- <fragment xmlns="http://developer.cognos.com/fragments/1/">
- <info>
- <title>CCS ReportLet</title>
- </info>
- <markup>
- <mimeType>text/html</mimeType>
- <markupXml>
- <style>
- <xsl:apply-templates select="//rds:styleGroup"/>
- </style>
- <xsl:apply-templates select="//rds:document/rds:page"/>
- <xsl:apply-templates select="//rds:reportElement/*"/>
- </markupXml>
- </markup>
- </fragment>
- </xsl:when>
- <xsl:otherwise>
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <style type="text/css">
- <xsl:apply-templates select="//rds:styleGroup"/>
- </style>
- </head>
- <body>
- <xsl:apply-templates select="//rds:document/rds:page"/>
- <xsl:apply-templates select="//rds:reportElement/*"/>
- </body>
- </html>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
- <xsl:template match="rds:styleGroup">
- .<xsl:value-of select="concat($fragprefix,rds:name)"/> {
- <xsl:if test="rds:bgColor">background-color: <xsl:apply-templates mode="printColor" select="rds:bgColor"/>;
- </xsl:if>
- <xsl:if test="rds:fgColor">color: <xsl:apply-templates mode="printColor" select="rds:fgColor"/>;
- </xsl:if>
- <xsl:if test="rds:font/rds:family">font-family: "<xsl:value-of select="rds:font/rds:family"/>" ;
- </xsl:if>
- <xsl:if test="rds:font/rds:size">font-size: <xsl:value-of select="concat(rds:font/rds:size/rds:val, rds:font/rds:size/rds:units)"/>;
- </xsl:if>
- <xsl:if test="rds:boxStyle/rds:padding">padding: <xsl:value-of select="concat(rds:boxStyle/rds:padding/rds:top/rds:val, rds:boxStyle/rds:padding/rds:top/rds:units, ' ',
- rds:boxStyle/rds:padding/rds:right/rds:val, rds:boxStyle/rds:padding/rds:right/rds:units, ' ',
- rds:boxStyle/rds:padding/rds:bottom/rds:val, rds:boxStyle/rds:padding/rds:bottom/rds:units, ' ',
- rds:boxStyle/rds:padding/rds:left/rds:val, rds:boxStyle/rds:padding/rds:left/rds:units )"/>;
- </xsl:if>
- <xsl:if test="rds:hAlign">text-align: <xsl:value-of select="rds:hAlign"/>;
- </xsl:if>
- <xsl:if test="rds:vAlign">vertical-align: <xsl:value-of select="rds:vAlign"/>;
- </xsl:if>
- <xsl:if test="rds:font/rds:fontStyle/rds:bold">font-weight: <xsl:choose>
- <xsl:when test="rds:font/rds:fontStyle/rds:bold = 'true'">bold</xsl:when>
- <xsl:otherwise>normal</xsl:otherwise>
- </xsl:choose>;
- </xsl:if>
- <xsl:if test="rds:font/rds:fontStyle/rds:underline">text-decoration: <xsl:choose>
- <xsl:when test="rds:font/rds:fontStyle/rds:underline = 'true'">underline</xsl:when>
- <xsl:otherwise>none</xsl:otherwise>
- </xsl:choose>;
- </xsl:if>
- <xsl:if test="rds:textStyle/rds:wrapping">white-space: <xsl:choose>
- <xsl:when test="rds:textStyle/rds:wrapping = 'false'">nowrap</xsl:when>
- <xsl:otherwise>normal</xsl:otherwise>
- </xsl:choose>;
- </xsl:if>}
-
- </xsl:template>
- <xsl:template match="rds:grp">
- <xsl:if test="rds:header">
- <xsl:for-each select="rds:header/rds:row">
- <tr>
- <xsl:for-each select="rds:cell">
- <xsl:apply-templates mode="printCell" select=".">
- <xsl:with-param name="borderkludge">lf</xsl:with-param>
- </xsl:apply-templates>
- </xsl:for-each>
- </tr>
- </xsl:for-each>
- </xsl:if>
- <xsl:for-each select="rds:grp">
- <xsl:apply-templates select="."/>
- </xsl:for-each>
- <xsl:for-each select="rds:row">
- <tr>
- <xsl:for-each select="rds:cell">
- <xsl:apply-templates mode="printCell" select=".">
- <xsl:with-param name="borderkludge">lc</xsl:with-param>
- </xsl:apply-templates>
- </xsl:for-each>
- </tr>
- </xsl:for-each>
- <xsl:if test="rds:footer">
- <xsl:for-each select="rds:footer/rds:row">
- <tr>
- <xsl:for-each select="rds:cell">
- <xsl:apply-templates mode="printCell" select=".">
- <xsl:with-param name="borderkludge">lf</xsl:with-param>
- </xsl:apply-templates>
- </xsl:for-each>
- </tr>
- </xsl:for-each>
- </xsl:if>
- </xsl:template>
- <xsl:template match="rds:lst">
- <table style="border-collapse: collapse; font-family:Tahoma" cellpadding="0">
- <xsl:attribute name="class"><xsl:value-of select="concat($fragprefix,rds:style)"/></xsl:attribute>
- <xsl:if test="rds:id">
- <xsl:attribute name="id"><xsl:value-of select="rds:id"/></xsl:attribute>
- </xsl:if>
- <tr>
- <xsl:for-each select="rds:colTitle">
- <xsl:apply-templates mode="printCell" select=".">
- <xsl:with-param name="borderkludge">lt</xsl:with-param>
- </xsl:apply-templates>
- </xsl:for-each>
- </tr>
- <xsl:if test="rds:group/rds:header">
- <xsl:for-each select="rds:group/rds:header/rds:row">
- <tr>
- <xsl:for-each select="rds:cell">
- <xsl:apply-templates mode="printCell" select=".">
- <xsl:with-param name="borderkludge">lf</xsl:with-param>
- </xsl:apply-templates>
- </xsl:for-each>
- </tr>
- </xsl:for-each>
- </xsl:if>
- <xsl:for-each select="rds:group/rds:grp">
- <xsl:apply-templates select="."/>
- </xsl:for-each>
- <xsl:for-each select="rds:group/rds:row">
- <tr>
- <xsl:for-each select="rds:cell">
- <xsl:apply-templates mode="printCell" select=".">
- <xsl:with-param name="borderkludge">lc</xsl:with-param>
- </xsl:apply-templates>
- </xsl:for-each>
- </tr>
- </xsl:for-each>
- <xsl:if test="rds:group/rds:footer">
- <xsl:for-each select="rds:group/rds:footer/rds:row">
- <tr>
- <xsl:for-each select="rds:cell">
- <xsl:apply-templates mode="printCell" select=".">
- <xsl:with-param name="borderkludge">lf</xsl:with-param>
- </xsl:apply-templates>
- </xsl:for-each>
- </tr>
- </xsl:for-each>
- </xsl:if>
- </table>
- </xsl:template>
- <xsl:template match="rds:ctab">
- <table style="border-collapse: collapse; font-family:Tahoma" cellpadding="0">
- <xsl:variable name="kludgeRowIndex">
- <xsl:value-of select="rds:row[1]/rds:start"/>
- </xsl:variable>
- <xsl:attribute name="class"><xsl:value-of select="concat($fragprefix,rds:style)"/></xsl:attribute>
- <xsl:if test="rds:id">
- <xsl:attribute name="id"><xsl:value-of select="rds:id"/></xsl:attribute>
- </xsl:if>
- <tr>
- <xsl:apply-templates mode="printCell" select="rds:corner">
- <xsl:with-param name="borderkludge">xm</xsl:with-param>
- </xsl:apply-templates>
- <xsl:for-each select="rds:column">
- <xsl:apply-templates mode="printCell" select="rds:name">
- <xsl:with-param name="borderkludge">ml</xsl:with-param>
- </xsl:apply-templates>
- </xsl:for-each>
- </tr>
- <xsl:if test="rds:column[1]/rds:nestedDimension">
- <tr>
- <xsl:for-each select="rds:column/rds:nestedDimension">
- <xsl:apply-templates mode="printCell" select="rds:name">
- <xsl:with-param name="borderkludge">ml</xsl:with-param>
- </xsl:apply-templates>
- </xsl:for-each>
- </tr>
- </xsl:if>
- <xsl:if test="rds:column[1]/rds:nestedDimension[1]/rds:nestedDimension">
- <tr>
- <xsl:for-each select="rds:column/rds:nestedDimension/rds:nestedDimension">
- <xsl:apply-templates mode="printCell" select="rds:name">
- <xsl:with-param name="borderkludge">ml</xsl:with-param>
- </xsl:apply-templates>
- </xsl:for-each>
- </tr>
- </xsl:if>
- <xsl:for-each select="rds:row">
- <xsl:if test="count( rds:nestedDimension) = 0">
- <tr>
- <xsl:apply-templates mode="printCell" select="rds:name">
- <xsl:with-param name="borderkludge">ml</xsl:with-param>
- </xsl:apply-templates>
- <xsl:variable name="rownum">
- <xsl:value-of select="rds:start - $kludgeRowIndex+ 1"/>
- </xsl:variable>
- <xsl:apply-templates select="../rds:table/rds:row[position() = $rownum]"/>
- </tr>
- </xsl:if>
- <xsl:for-each select="rds:nestedDimension">
- <tr>
- <xsl:if test="position() = 1">
- <xsl:apply-templates mode="printCell" select="../rds:name">
- <xsl:with-param name="borderkludge">ml</xsl:with-param>
- </xsl:apply-templates>
- </xsl:if>
- <xsl:apply-templates mode="printCell" select="rds:name">
- <xsl:with-param name="borderkludge">ml</xsl:with-param>
- </xsl:apply-templates>
- <xsl:variable name="rownum">
- <xsl:value-of select="rds:start - $kludgeRowIndex+ 1"/>
- </xsl:variable>
- <xsl:apply-templates select="../../rds:table/rds:row[position() = $rownum]"/>
- </tr>
- </xsl:for-each>
- </xsl:for-each>
- </table>
- </xsl:template>
- <xsl:template match="rds:row">
- <xsl:for-each select="rds:cell">
- <xsl:apply-templates mode="printCell" select=".">
- <xsl:with-param name="borderkludge">ml</xsl:with-param>
- </xsl:apply-templates>
- </xsl:for-each>
- </xsl:template>
- <xsl:template mode="printCell" match="*">
- <xsl:param name="borderkludge">none</xsl:param>
- <!-- border kludge until RSVP fix starts tellign us about the borders -->
- <td>
- <xsl:choose>
- <xsl:when test="$borderkludge = 'lt'">
- <xsl:attribute name="style">border: 1px solid #608BB4;</xsl:attribute>
- </xsl:when>
- <xsl:when test="$borderkludge = 'lf'">
- <xsl:attribute name="style">border: 1px solid #CCCCCC;</xsl:attribute>
- </xsl:when>
- <xsl:when test="$borderkludge = 'lc'">
- <xsl:attribute name="style">border: 1px solid #CCCCCC;</xsl:attribute>
- </xsl:when>
- <xsl:when test="$borderkludge = 'xm'">
- <xsl:attribute name="style">border: 1px solid #CFCFCF;</xsl:attribute>
- </xsl:when>
- <xsl:when test="$borderkludge = 'ml'">
- <xsl:attribute name="style">border: 1px solid #93B1CD;</xsl:attribute>
- </xsl:when>
- <xsl:when test="$borderkludge = 'mv'">
- <xsl:attribute name="style">border: 1px solid #CCCCCC;</xsl:attribute>
- </xsl:when>
- </xsl:choose>
- <xsl:if test="rds:rspan">
- <xsl:attribute name="rowspan"><xsl:value-of select="rds:rspan"/></xsl:attribute>
- </xsl:if>
- <xsl:if test="rds:cspan">
- <xsl:attribute name="colspan"><xsl:value-of select="rds:cspan"/></xsl:attribute>
- </xsl:if>
- <xsl:attribute name="class"><xsl:value-of select="concat($fragprefix,rds:style)"/></xsl:attribute>
- <xsl:apply-templates select="rds:item/*"/>
- </td>
- </xsl:template>
- <xsl:template match="rds:txt">
- <span>
- <xsl:if test="rds:id">
- <xsl:attribute name="id"><xsl:value-of select="rds:id"/></xsl:attribute>
- </xsl:if>
- <xsl:attribute name="class"><xsl:value-of select="concat($fragprefix,rds:style)"/></xsl:attribute>
- <xsl:choose>
- <xsl:when test="rds:fmtVal">
- <xsl:value-of select="rds:fmtVal"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="rds:val"/>
- </xsl:otherwise>
- </xsl:choose>
- </span>
- </xsl:template>
- <xsl:template match="rds:img">
- <img>
- <xsl:if test="rds:id">
- <xsl:attribute name="id"><xsl:value-of select="rds:id"/></xsl:attribute>
- </xsl:if>
- <xsl:attribute name="src"><xsl:value-of select="rds:url"/></xsl:attribute>
- </img>
- </xsl:template>
- <xsl:template match="rds:cht">
- <img>
- <xsl:if test="rds:id">
- <xsl:attribute name="id"><xsl:value-of select="rds:id"/></xsl:attribute>
- </xsl:if>
- <xsl:variable name="url">
- <xsl:value-of select="translate(rds:url,$quot, $apos)"/>
- </xsl:variable>
- <xsl:choose>
- <xsl:when test="string-length($versionbase) > 0">
- <xsl:attribute name="src"><xsl:value-of select="concat($versionbase,'/',$url)"/></xsl:attribute>
- </xsl:when>
- <xsl:otherwise>
- <xsl:attribute name="src"><xsl:value-of select="$url"/></xsl:attribute>
- </xsl:otherwise>
- </xsl:choose>
- </img>
- </xsl:template>
- <xsl:template match="rds:page">
- <table>
- <xsl:if test="rds:id">
- <xsl:attribute name="id"><xsl:value-of select="rds:id"/></xsl:attribute>
- </xsl:if>
- <tr>
- <xsl:apply-templates select="rds:header/rds:item/*"/>
- </tr>
- <tr>
- <xsl:apply-templates select="rds:body/rds:item/*"/>
- </tr>
- <tr>
- <xsl:apply-templates select="rds:footer/rds:item/*"/>
- </tr>
- </table>
- </xsl:template>
- <xsl:template mode="printColor" match="*">rgb(<xsl:value-of select="rds:Red"/>,<xsl:value-of select="rds:Green"/>,<xsl:value-of select="rds:Blue"/>)</xsl:template>
- </xsl:stylesheet>
|