123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!--
- *****************************************************************
- ** Licensed Materials - Property of IBM
- **
- ** IBM Cognos Products: drill
- **
- ** (C) Copyright IBM Corp. 2001, 2019
- **
- ** US Government Users Restricted Rights - Use, duplication or
- ** disclosure restricted by GSA ADP Schedule Contract with
- ** IBM Corp.
- *****************************************************************
- -->
- <!--
- Copyright (C) 2008 Cognos ULC, an IBM Company. All rights reserved.
- Cognos (R) is a trademark of Cognos ULC, (formerly Cognos Incorporated).
- -->
- <xsl:stylesheet version="1.0"
- xmlns:s="http://developer.cognos.com/schemas/selection/1/"
- xmlns:out="dummy-uri"
- xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt"
- exclude-result-prefixes="xsl">
- <xsl:namespace-alias stylesheet-prefix="out" result-prefix="xsl"/>
- <xsl:output method="xml" indent="no" encoding="utf-8"/>
- <xsl:template match="s:selectionContextRenderer">
- <!-- This statement provides keyed access to elements in the selection context by xml:id -->
- <out:key
- name="key_elementByID"
- match="*"
- use="@xml:id"/>
- <!-- This is for all drill scenario except powerplay -->
- <out:template name="selectionContextRenderer">
- <out:apply-templates select="/root/selectionContextNodeTree/s:selection/s:cells"/>
- </out:template>
- <!-- This is for powerplay drill scenario -->
- <out:template name="selectionContextRenderer_powerplay">
- <out:apply-templates select="/root/selectionContextNodeTree/Response/ConverterOutput/olap/s:selection/s:cells"/>
- </out:template>
- <out:template match="s:cells">
- <out:apply-templates select="s:cell"/>
- </out:template>
-
- <out:template match="s:cell">
- <!-- need to double-indirect from cell to string table for references in a cell's metadata cell entry -->
- <!-- eg: to get the name of a cell: -->
- <!-- 1) find the cell's metadata entry: (s:cell rMetadataCell="M_#") -->
- <!-- 2) find the metadata cell's rName entry: (s:metadataCell rName="N_#"). -->
- <!-- (The value will be the final s:s cell's contents) -->
-
- <out:variable name="metadataCell"
- select="key( 'key_elementByID', @rMetadataCell )"/>
- <out:variable name="metadataCellName"
- select="key( 'key_elementByID', $metadataCell/@rName )"/>
- <out:variable name="cellValue"
- select="key( 'key_elementByID', @rValue )"/>
- <out:variable name="metadataCellType"
- select="key( 'key_elementByID', $metadataCell/@rType )"/>
- <out:variable name="metadataCellExpression"
- select="key( 'key_elementByID', $metadataCell/@rExpression )"/>
- <!-- WO2788: The display value (memberCaption) is now stored as a dependent cell of the main cell whose rType is '_memberCaption' (in the string table via the metadata cell). -->
- <out:variable name="memberCaptionDependentCellValue">
- <out:for-each select="./*[local-name() = 'dependentCells']/*[local-name()='cell']">
- <!-- get the metadata cell that corresponds to the current dependent cell -->
- <out:variable name="dependentCell_metadataCell" select="key( 'key_elementByID', @rMetadataCell )"/>
- <!-- if the type value for this associated metadataCell is "_memberCaption", set the value of the variable -->
- <out:if test="key( 'key_elementByID', $dependentCell_metadataCell/@rType) = '_memberCaption'">
- <out:value-of select="key( 'key_elementByID', @rValue )" />
- </out:if>
- </out:for-each>
- </out:variable>
- <out:variable name="displayValue"
- select="$memberCaptionDependentCellValue"/>
-
- <tr>
- <!-- render Name, displayValue, Use Value -->
- <out:call-template name="DoValue">
- <out:with-param name="title" select="'Name'"/>
- <out:with-param name="value" select="$metadataCellName"/>
- <out:with-param name="headerId">itemName</out:with-param>
- </out:call-template>
-
- <out:call-template name="DoValue">
- <out:with-param name="title" select="'displayValue'"/>
- <out:with-param name="value" select="$displayValue"/>
- <out:with-param name="headerId">itemDisplayValue</out:with-param>
- </out:call-template>
- <out:call-template name="DoValue">
- <out:with-param name="title" select="'Use Value'"/>
- <out:with-param name="value" select="$cellValue"/>
- <out:with-param name="headerId">itemUseValue</out:with-param>
- </out:call-template>
- <!-- TODO:
- Types and Expressions are easy extensions,
- After that, the next step would be defining/dependent cells to show more structure....
-
- <out:variable name="isDependentCell">
- <out:choose>
- <out:when test="parent::s:cells">independent</out:when>
- <out:otherwise>dependent</out:otherwise>
- </out:choose>
- </out:variable>
-
- <out:call-template name="DoValue">
- <out:with-param name="title" select="'Type'"/>
- <out:with-param name="value" select="$metadataCellType"/>
- </out:call-template>
- <out:call-template name="DoValue">
- <out:with-param name="title" select="'Expression'"/>
- <out:with-param name="value" select="$metadataCellExpression"/>
- </out:call-template>
-
- <out:apply-templates select="s:definingCells"/>
- <out:apply-templates select="s:dependentCells/s:cell"/
- -->
- </tr>
- </out:template>
- <!-- produce a single value as a formatted table column -->
- <out:template name="DoValue">
- <out:param name="value"/>
- <out:param name="headerId"/>
- <td valign="top" nowrap="" height="10" class="tabletext">
- <out:attribute name="headers"><out:value-of select="$headerId"/></out:attribute>
- <out:value-of select="xtsext:enforceBTD($value, $baseTextDirection, $productLocale, boolean($isBidiEnabled='true'))"/>
- </td>
- </out:template>
- </xsl:template>
- <!-- the main engine -->
- <xsl:template match="*">
- <xsl:copy>
- <xsl:copy-of select="@*"/>
- <xsl:apply-templates/>
- </xsl:copy>
- </xsl:template>
- </xsl:stylesheet>
|