123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!--
- Licensed Materials - Property of IBM
- IBM Cognos Products: cpscrn
- (C) Copyright IBM Corp. 2005, 2011
- 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:cclutils="java:com.cognos.portal.utils.CCLLocaleUtils">
- <xsl:output method="html" version="1.0" encoding="UTF-8" indent="no"/>
- <xsl:variable name="contentLocale" select="/root/preferences/param[@name='contentLocale']"/>
- <xsl:variable name="customs" select="/root/customs/param"/>
- <xsl:template match="/">
- <xsl:call-template name="render-text">
- <xsl:with-param name="text" select="$customs[@name='text1']"/>
- <xsl:with-param name="style" select="$customs[@name='style1']"/>
- </xsl:call-template>
- <xsl:call-template name="render-text">
- <xsl:with-param name="text" select="$customs[@name='text2']"/>
- <xsl:with-param name="style" select="$customs[@name='style2']"/>
- </xsl:call-template>
- </xsl:template>
- <xsl:template name="render-text">
- <xsl:param name="text"/>
- <xsl:param name="style"/>
- <xsl:if test="$text/value">
- <xsl:variable name="locale">
- <xsl:call-template name="select-locale">
- <xsl:with-param name="values" select="$text/value"/>
- </xsl:call-template>
- </xsl:variable>
- <div style="{$style}">
- <xsl:choose>
- <xsl:when test="$text/value[@xml:lang=$locale]">
- <xsl:value-of select="$text/value[@xml:lang=$locale]"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$text/value"/>
- </xsl:otherwise>
- </xsl:choose>
- </div>
- </xsl:if>
- </xsl:template>
- <xsl:template name="select-locale">
- <xsl:param name="values"/>
- <xsl:variable name="locales">
- <xsl:for-each select="$values">
- <xsl:value-of select="@xml:lang"/>
- <xsl:if test="position() != last()">
- <xsl:text>,</xsl:text>
- </xsl:if>
- </xsl:for-each>
- </xsl:variable>
- <xsl:value-of select="cclutils:getBestFitLocale($contentLocale, $locales)"/>
- </xsl:template>
- </xsl:stylesheet>
|