123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!--
- Licensed Materials - Property of IBM
- IBM Cognos Products: cogadmin
- (C) Copyright IBM Corp. 2005, 2010
- 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).
- -->
- <!--
- This logic sheet contains common debug features useful for morphlets.
-
- The elements are
- dbg:dumpxml - Displays xml in an easily readable format.
- -->
- <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:dbg="http://developer.cognos.com/schemas/xts/logicsheets/xslt/debug/" xmlns:out="dummy-uri" xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt">
- <xsl:output method="xml" encoding="UTF-8" indent="no"/>
- <xsl:namespace-alias stylesheet-prefix="out" result-prefix="xsl"/>
- <!--
- ===============================================================================================
- dbg:dumpxml - displays xml in an easily readable format
- ===============================================================================================
- -->
- <xsl:template match="dbg:dumpxml">
- <out:if test="string(/root/debug/debugSwitch) != 'disable' ">
- <out:variable name="gateway" select="xtsext:substringAfterLast( string( /root/http/param[@name='SCRIPT_NAME'] ), '/' )"/>
- <!-- the script used by the debugger -->
- <out:if test="string(/root/debug/debugSwitch)='request' or string(/root/debug/traceOutput)='true'">
- <script type="text/javascript">
- var sDebugCookie = "XTS_DEBUG";
- function debugSwitch() {
- var s = getCookie(sDebugCookie );
- if ('<out:value-of select="xtsext:javascriptencode(string(/root/debug/traceOutput))"/>' == 'true')
- {
- setCookie(sDebugCookie , "false");
- location.reload();
- }
- else
- {
- setCookie(sDebugCookie , "true");
- location.reload();
- }
- }
- function launchDebugger(sURL) {
- windowDebug = window.open(sURL, "debugWindow", "toolbar=no,location=yes,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=750,height=600");
- windowDebug.focus();
- }
- </script>
- </out:if>
- <!-- this will output the debug switch if necessary and the link to launch the debugger -->
- <out:choose>
- <out:when test="string(/root/debug/traceOutput)='true'">
- <p align="right" class="text">
- <out:if test="string(/root/debug/debugSwitch)='request'">
- <a href="javascript:debugSwitch()">turn trace off</a>  |  <xsl:text/>
- </out:if>
- <a>
- <xsl:attribute name="href">javascript:launchDebugger('<xsl:value-of select="'{$gateway}'"/>?b_action=xts.run&m=debug/traceview.xts&d_request=<xsl:value-of select="'{/root/debug/traceRequestPath}'"/>')</xsl:attribute>
- <xsl:text/>launch trace viewer<xsl:text/>
- </a>
- </p>
- </out:when>
- <out:when test="string(/root/debug/debugSwitch) = 'request'">
- <p align="right" class="text">
- <a href="javascript:debugSwitch()">turn trace on</a>  |  <xsl:text/>
- <span class="inactiveText">launch trace viewer</span>
- </p>
- </out:when>
- </out:choose>
- <table cellpadding="0" cellspacing="3" width="100%">
- <tr bgcolor="#3333FF">
- <td>
- <xsl:choose>
- <xsl:when test="dbg:title">
- <span style="font: 14pt sans-serif; color: #FFFFFF">Dump of [ <xsl:value-of select="dbg:title"/> ]</span>
- </xsl:when>
- <xsl:otherwise>
- <span style="font: 14pt sans-serif; color: #FFFFFF">Dump of [ <xsl:value-of select="@select"/> ]</span>
- </xsl:otherwise>
- </xsl:choose>
- </td>
- </tr>
- <tr bgcolor="white">
- <td>
- <div>
- <out:apply-templates mode="render">
- <xsl:copy-of select="@*"/>
- </out:apply-templates>
- </div>
- </td>
- </tr>
- </table>
- </out:if>
- </xsl:template>
- <!--
- ===============================================================================================
- xsl:stylesheet - adds the templates that are called within this logic sheet
- ===============================================================================================
- -->
- <xsl:template match="xsl:stylesheet">
- <xsl:copy>
- <xsl:copy-of select="@*"/>
- <xsl:apply-templates/>
- <xsl:call-template name="addTemplates"/>
- </xsl:copy>
- </xsl:template>
- <xsl:template name="addTemplates">
- <!--
- +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- render an element
- +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- -->
- <out:template match="*" mode="render">
- <table cellspacing="0" cellpadding="0" border="0" style="font: 10pt Verdana">
- <tr>
- <td width="100%">
- <out:variable name="name">
- <span>
- <out:attribute name="style">
- <out:choose>
- <out:when test="starts-with(name(), 'xts:')">font-weight: bold; color: darkblue;</out:when>
- <out:when test="starts-with(name(), 'out:')">font-weight: bold; color: darkred;</out:when>
- <out:when test="starts-with(name(), 'utml:')">font-weight: bold; color: darkgreen;</out:when>
- <out:otherwise>color: darkred;</out:otherwise>
- </out:choose>
- </out:attribute>
- <out:value-of select="name()"/>
- </span>
- </out:variable>
- <div style="margin-left: 20px;">
- <span style="color: blue"><</span>
- <out:copy-of select="$name"/>
- <out:apply-templates select="@*" mode="render"/>
- <out:variable name="pns" select="../namespace::*"/>
- <out:if test="$pns[name()=''] and namespace-uri()='' and namespace-uri(..) != namespace-uri()">
- <span style="color: red">
- <out:text> xmlns</out:text>
- </span>
- <out:text>=""</out:text>
- </out:if>
- <out:for-each select="namespace::*">
- <out:if test="not($pns[name()=name(current()) and .=current()])">
- <out:call-template name="render-ns"/>
- </out:if>
- </out:for-each>
- <span style="color: blue">
- <out:if test="not(* | text() | comment())">/</out:if>></span>
- <out:apply-templates mode="render"/>
- <out:if test="* | text() | comment()">
- <span style="color: blue"></</span>
- <out:copy-of select="$name"/>
- <span style="color: blue">></span>
- </out:if>
- </div>
- </td>
- </tr>
- </table>
- </out:template>
- <out:template name="render-ns">
- <out:if test="name()!='xml'">
- <span style="color: red">
- <out:text> xmlns</out:text>
- <out:if test="name()!=''">
- <out:text>:</out:text>
- </out:if>
- <out:value-of select="name()"/>
- </span>
- <span style="color: blue">="</span>
- <span style="font-weight: bold; color: red;">
- <out:choose>
- <out:when test="name()!=''">
- <out:attribute name="title">
- <out:value-of select="."/>
- </out:attribute>
- <out:text>...</out:text>
- </out:when>
- <out:otherwise>
- <out:value-of select="."/>
- </out:otherwise>
- </out:choose>
- </span>
- <span style="color: blue">"</span>
- </out:if>
- </out:template>
- <!--
- +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- render an attribute
- +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- -->
- <out:template match="@*" mode="render">
- <span style="color: darkred"> <out:value-of select="name()"/>
- </span>
- <span style="color: blue">="</span>
- <span style="font-weight: bold; color: black;">
- <out:value-of select="."/>
- </span>
- <span style="color: blue">"</span>
- </out:template>
- <!--
- +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- text nodes
- +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- -->
- <out:template match="text()" mode="render">
- <span style="font-weight: bold; color: black;">
- <out:value-of select="."/>
- </span>
- </out:template>
- <!--
- +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- comment nodes
- +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- -->
- <out:template match="comment()" mode="render">
- <div style="border: none none 0px; border-right: none none 0px; margin-left: 20px;">
- <span style="font-weight: bold; color: darkgray;">
- <out:text/><!-- <out:value-of select="."/>--><out:text/>
- </span>
- </div>
- </out:template>
- <!-- this is the end to get any other debug templates, only temperary -->
- <dbg:templates/>
- </xsl:template>
- <!-- the main engine -->
- <xsl:template match="*">
- <xsl:copy>
- <xsl:copy-of select="@*"/>
- <xsl:apply-templates/>
- </xsl:copy>
- </xsl:template>
- <!--
- ===============================================================================================
- deprecated templates.
- ===============================================================================================
- -->
- <xsl:template match="dbg:templates"/>
- </xsl:stylesheet>
|