123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!--
- Licensed Materials - Property of IBM
- BI and PM: qs
- (C) Copyright IBM Corp. 2001, 2017
- 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:xsl="http://www.w3.org/1999/XSL/Transform"
- xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt"
- xmlns:af="http://developer.cognos.com/schemas/xts/logicsheets/xslt/async/framework/"
- xmlns:out="dummy-uri"
- exclude-result-prefixes="xtsext af">
- <xsl:output method="xml" encoding="UTF-8" indent="no"/>
- <xsl:namespace-alias stylesheet-prefix="out" result-prefix="xsl"/>
- <xsl:template match="af:setReportName">
- <out:variable name="contentLocale" select="/root/user/param[@name='contentLocale']"/>
- <out:variable name="MQLocale">
- <out:choose>
- <out:when test="/root/QSMiniQuery/CRQReport/@expressionLocale">
- <out:value-of select="/root/QSMiniQuery/CRQReport/@expressionLocale"/>
- </out:when>
- <!-- In Baltic, it was called 'contentLocale' -->
- <out:when test="/root/QSMiniQuery/CRQReport/@contentLocale">
- <out:value-of select="/root/QSMiniQuery/CRQReport/@contentLocale"/>
- </out:when>
- </out:choose>
- </out:variable>
-
- <out:variable name="CL">
- <out:choose>
- <out:when test="contains($contentLocale,'-')">
- <!-- Use short version of contentLocale (ie. 'en' for 'en-ca') -->
- <out:value-of select="substring-before($contentLocale, '-')"/>
- </out:when>
- <out:otherwise>
- <out:value-of select="$contentLocale"/>
- </out:otherwise>
- </out:choose>
- </out:variable>
- <out:variable name="MQL">
- <out:choose>
- <out:when test="contains($MQLocale,'-')">
- <!-- Use short version of query's authored locale (ie. 'en' for 'en-ca') -->
- <out:value-of select="substring-before($MQLocale, '-')"/>
- </out:when>
- <out:otherwise>
- <out:value-of select="$MQLocale"/>
- </out:otherwise>
- </out:choose>
- </out:variable>
- <out:variable name="cmQueryModelReportNameCL">
- <out:choose>
- <out:when test="/root/env/param[@name='cmQueryModelReportName' and substring-before(.,':::') = $CL]">true</out:when>
- <out:when test="/root/cmQueryModelReportName/@locale = $CL">true</out:when>
- </out:choose>
- </out:variable>
- <out:variable name="cmQueryModelReportNameMQ">
- <out:choose>
- <out:when test="/root/env/param[@name='cmQueryModelReportName' and substring-before(.,':::') = $MQL]">true</out:when>
- <out:when test="/root/cmQueryModelReportName/@locale = $MQL">true</out:when>
- </out:choose>
- </out:variable>
- <out:variable name="LocalizedReportName">
- <out:choose>
- <!-- Use contentLocale -->
- <out:when test="$contentLocale != '' and $cmQueryModelReportNameCL != ''">
- <out:choose>
- <out:when test="/root/env/param[@name='cmQueryModelReportName']">
- <out:choose>
- <out:when test="/root/env/param[@name='cmQueryModelReportName' and substring-before(., ':::') = $contentLocale]">
- <out:value-of select="substring-after(/root/env/param[@name='cmQueryModelReportName' and substring-before(., ':::') = $contentLocale], ':::')"/>
- </out:when>
- <out:when test="/root/env/param[@name='cmQueryModelReportName' and substring-before(., ':::') = $CL]">
- <out:value-of select="substring-after(/root/env/param[@name='cmQueryModelReportName' and substring-before(., ':::') = $CL], ':::')"/>
- </out:when>
- </out:choose>
- </out:when>
- <out:otherwise>
- <out:choose>
- <out:when test="/root/cmQueryModelReportName[@locale=$contentLocale]">
- <out:value-of select="/root/cmQueryModelReportName[@locale=$contentLocale]"/>
- </out:when>
- <out:when test="/root/cmQueryModelReportName[@locale=$CL]">
- <out:value-of select="/root/cmQueryModelReportName[@locale=$CL]"/>
- </out:when>
- </out:choose>
- </out:otherwise>
- </out:choose>
- </out:when>
- <!-- Use query's authored locale -->
- <out:when test="$MQLocale != '' and $cmQueryModelReportNameMQ != ''">
- <out:choose>
- <out:when test="/root/env/param[@name='cmQueryModelReportName']">
- <out:choose>
- <out:when test="/root/env/param[@name='cmQueryModelReportName' and substring-before(., ':::') = $MQLocale]">
- <out:value-of select="substring-after(/root/env/param[@name='cmQueryModelReportName' and substring-before(., ':::') = $MQLocale], ':::')"/>
- </out:when>
- <out:when test="/root/env/param[@name='cmQueryModelReportName' and substring-before(., ':::') = $MQL]">
- <out:value-of select="substring-after(/root/env/param[@name='cmQueryModelReportName' and substring-before(., ':::') = $MQL], ':::')"/>
- </out:when>
- </out:choose>
- </out:when>
- <out:otherwise>
- <out:choose>
- <out:when test="/root/cmQueryModelReportName[@locale=$MQLocale]">
- <out:value-of select="/root/cmQueryModelReportName[@locale=$MQLocale]"/>
- </out:when>
- <out:when test="/root/cmQueryModelReportName[@locale=$MQL]">
- <out:value-of select="/root/cmQueryModelReportName[@locale=$MQL]"/>
- </out:when>
- </out:choose>
- </out:otherwise>
- <out:otherwise>
- <out:value-of select="substring-after(/root/cmQueryModelReportName[./@locale=$MQL], ':::')"/>
- </out:otherwise>
- </out:choose>
- </out:when>
- <!-- If the default report name is set, use it -->
- <out:when test="/root/cmQueryModelDefaultReportName">
- <out:value-of select="/root/cmQueryModelDefaultReportName"/>
- </out:when>
- <!-- Can't find any that matches, take the first one -->
- <out:otherwise>
- <out:choose>
- <out:when test="/root/env/param[@name='cmQueryModelReportName']">
- <out:value-of select="substring-after(/root/env/param[@name='cmQueryModelReportName'], ':::')"/>
- </out:when>
- <out:otherwise>
- <out:value-of select="/root/cmQueryModelReportName"/>
- </out:otherwise>
- </out:choose>
- </out:otherwise>
- </out:choose>
- </out:variable>
- <xsl:text/>
- if (typeof oAppFrame != "object")
- {
- oAppFrame = goWindowManager.getApplicationFrame();
- }
- if (oAppFrame.cfgGet("ReportName") != "<out:value-of select="xtsext:javascriptencode( string( $LocalizedReportName ) )"/>")
- {
- oAppFrame.cfgSet("ReportName", "<out:value-of select="xtsext:javascriptencode( string( $LocalizedReportName ) )"/>");
- oAppFrame.cfgSet("NewReport", false);
- }
- <xsl:text/>
- </xsl:template>
- <xsl:template match="*">
- <xsl:copy>
- <xsl:copy-of select="@*"/>
- <xsl:apply-templates/>
- </xsl:copy>
- </xsl:template>
- </xsl:stylesheet>
|