12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!--
- Licensed Materials - Property of IBM
- IBM Cognos Products: ps
- (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:xts="http://developer.cognos.com/schemas/xts/" xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt" xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/" xmlns:bus="http://developer.cognos.com/schemas/bibus/3/" exclude-result-prefixes="bus cm">
- <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
- <xsl:template match="root">
- <!--
- Create currently available content_locale entries in the /root/multiLangs/lang structure used in properties_general.xts.
- -->
- <xts:sequence>
- <xts:append>
- <multiLangs>
- <xsl:variable name="mynodeset" select="/root/cm:queryResponse/*/cm:name/*|/root/cm:queryResponse/*/cm:screenTip/*|/root/cm:queryResponse/*/cm:description/*"/>
- <!-- get a list of the locales that have been defined in cm or is currently being added to the list-->
- <xsl:variable name="locales">
- <xsl:choose>
- <xsl:when test="not(/root/env/param[@name='pty_activeLang'])">
- <xsl:for-each select="$mynodeset">
- <xsl:variable name="locid" select="@xml:lang"/>
- <xsl:if test="not(preceding-sibling::*[@xml:lang = $locid])">
- <name locale="{@xml:lang}" displayName="{/root/config/param[@name='locale']/locale[@type='contentLocale' and id=$locid]/displayName}"><xsl:value-of select="@xml:lang"/></name>
- </xsl:if>
- </xsl:for-each>
- </xsl:when>
- <xsl:otherwise>
- <xsl:for-each select="/root/env/param[starts-with(@name, 'm_t_default_screenTip_')] | /root/env/param[starts-with(@name, 'm_t_default_description_')] | /root/env/param[starts-with(@name, 'm_t_default_name_')]">
- <xsl:variable name="locid">
- <xsl:choose>
- <xsl:when test="starts-with(@name, 'm_t_default_screenTip_')"><xsl:value-of select="substring-after(@name,'m_t_default_screenTip_')"/></xsl:when>
- <xsl:when test="starts-with(@name, 'm_t_default_description_')"><xsl:value-of select="substring-after(@name,'m_t_default_description_')"/></xsl:when>
- <xsl:when test="starts-with(@name, 'm_t_default_name_')"><xsl:value-of select="substring-after(@name,'m_t_default_name_')"/></xsl:when>
- </xsl:choose>
- </xsl:variable>
- <xsl:if test="not(preceding-sibling::*[@xml:lang = $locid])">
- <name locale="{$locid}" displayName="{/root/config/param[@name='locale']/locale[@type='contentLocale' and id=$locid]/displayName}"><xsl:value-of select="$locid"/></name>
- </xsl:if>
- </xsl:for-each>
- <xsl:if test="string(/root/env/param[@name='pty_activeLang']) != ''">
- <xsl:variable name="locid" select="/root/env/param[@name='pty_activeLang']"/>
- <name locale="{$locid}" displayName="{/root/config/param[@name='locale']/locale[@type='contentLocale' and id=$locid]/displayName}"><xsl:value-of select="$locid"/></name>
- </xsl:if>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
-
- <xsl:for-each select="$locales/name">
- <xsl:sort select="@displayName"/>
- <xsl:copy-of select="."/>
- </xsl:for-each>
- </multiLangs>
- </xts:append>
- <xts:append select="/root/multiLangs">
- <useLangAsDefault>
- <xts:function name="getLocalizedName">
- <xts:param name="locale"><xts:queryValue select="/root/user/param[@name='contentLocale']"/></xts:param>
- <xts:param name="namelist"><xts:queryNode select="/root/multiLangs/name"/></xts:param>
- <xts:param name="default">NOMATCH</xts:param>
- <xts:param name="normalize">true</xts:param>
- </xts:function>
- </useLangAsDefault>
- </xts:append>
- </xts:sequence>
- </xsl:template>
- </xsl:stylesheet>
|