123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209 |
- <?xml version="1.0" encoding="UTF-8"?>
- <xsl:stylesheet version="1.0" xmlns="http://www.w3.org/1999/XSL/Transform" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
- <xsl:output method="text" encoding="UTF-8"/>
- <xsl:template match="/stringTable">
- <xsl:text>/* </xsl:text>
- <xsl:text> *+------------------------------------------------------------------------+ </xsl:text>
- <xsl:text> *| IBM Confidential </xsl:text>
- <xsl:text> *| OCO Source Materials </xsl:text>
- <xsl:text> *| IBM Cognos Products: PS </xsl:text>
- <xsl:text> *| (C) Copyright IBM Corp. 2011 </xsl:text>
- <xsl:text> *| </xsl:text>
- <xsl:text> *| The source code for this program is not published or otherwise </xsl:text>
- <xsl:text> *| divested of its trade secrets, irrespective of what has been deposited </xsl:text>
- <xsl:text> *| with the U.S. Copyright Office. </xsl:text>
- <xsl:text> *+------------------------------------------------------------------------+ </xsl:text>
- <xsl:text> */ </xsl:text>
- <xsl:text>({</xsl:text>
- <xsl:for-each select="./component">
- <xsl:variable name="compname" select="@name"/>
- <xsl:for-each select="section">
- <xsl:if test="preceding-sibling::section">
- <xsl:text>,</xsl:text>
- </xsl:if>
- <xsl:text> "</xsl:text>
- <xsl:value-of select="@name"/>
- <xsl:text>": { // </xsl:text>
- <xsl:value-of select="@usage"/>
- <xsl:text> </xsl:text>
- <xsl:for-each select="string">
-
- <xsl:if test="preceding-sibling::string">
- <xsl:text>, </xsl:text>
- </xsl:if>
- <xsl:variable name="var">
- <xsl:choose>
- <xsl:when test="@id">
- <xsl:value-of select="@id"/>
- </xsl:when>
- <xsl:when test="@name">
- <xsl:value-of select="../../@name"/>
- <xsl:text disable-output-escaping="yes">_</xsl:text>
- <xsl:value-of select="../@name"/>
- <xsl:text disable-output-escaping="yes">_</xsl:text>
- <xsl:value-of select="@name"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:message terminate="yes">Key Generation Error: Missing name or id.</xsl:message>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:text> "</xsl:text>
- <xsl:value-of select="translate($var, 'abcdefghijklmnopqrstuvwxyz .-', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ___')"/>
- <xsl:text>"</xsl:text>
-
- <xsl:text>: "</xsl:text>
-
- <xsl:if test="@errorCode and (not(../@type) or ../@type='Messages')">
- <xsl:value-of select="../../@name"/>
- <xsl:text>-</xsl:text>
- <xsl:value-of select="../@name"/>
- <xsl:text>-</xsl:text>
- <xsl:value-of select="@errorCode"/>
- <xsl:text> </xsl:text>
- </xsl:if>
-
- <xsl:variable name="msgstring">
- <xsl:for-each select="child::node()">
- <xsl:choose>
- <xsl:when test="name() = 'param'">
- <xsl:choose>
- <xsl:when test="@name">
- <xsl:text disable-output-escaping="yes">${</xsl:text>
- <xsl:value-of select="@name"/>
- <xsl:text disable-output-escaping="yes">}</xsl:text>
- </xsl:when>
- <xsl:when test="@index">
- <xsl:text disable-output-escaping="yes">${</xsl:text>
- <xsl:value-of select="@index - 1"/>
- <xsl:text disable-output-escaping="yes">}</xsl:text>
- </xsl:when>
- <xsl:otherwise>
- <xsl:message terminate="yes">Parameter Substitution Error: Missing name or index.</xsl:message>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:when>
- <xsl:when test="name() = ''">
- <xsl:value-of select="."/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:apply-templates select="."/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:for-each>
- </xsl:variable>
-
- <xsl:variable name="msgstring_param">
- <xsl:choose>
- <xsl:when test="@whiteSpace and @whiteSpace='preserve'">
- <xsl:value-of select="$msgstring"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="normalize-space($msgstring)"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
-
- <call-template name="replaceChar">
- <with-param name="text">
- <call-template name="replaceChar">
- <with-param name="text" select="$msgstring_param" />
- <with-param name="toReplace">\</with-param>
- <with-param name="replaceWith">\\</with-param>
- </call-template>
- </with-param>
- <with-param name="toReplace">"</with-param>
- <with-param name="replaceWith">\"</with-param>
- </call-template>
-
- <xsl:text>"</xsl:text>
- </xsl:for-each>
- <xsl:text> }</xsl:text>
- </xsl:for-each>
- </xsl:for-each>
- <xsl:text> })</xsl:text>
- </xsl:template>
-
-
- <xsl:template name="replaceChar">
- <xsl:param name="text" />
- <xsl:param name="toReplace" />
- <xsl:param name="replaceWith" />
- <xsl:choose>
- <xsl:when test="contains($text, $toReplace)">
- <xsl:variable name="beforeChar" select="substring-before($text,$toReplace)" />
- <xsl:variable name="afterChar">
- <xsl:call-template name="replaceChar">
- <xsl:with-param name="text" select="substring-after($text,$toReplace)" />
- <xsl:with-param name="toReplace" select="$toReplace" />
- <xsl:with-param name="replaceWith" select="$replaceWith" />
- </xsl:call-template>
- </xsl:variable>
- <xsl:value-of select="concat($beforeChar, $replaceWith, $afterChar)" />
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$text" />
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
-
- <xsl:template match="*">
- <xsl:copy>
- <xsl:copy-of select="@*"/>
- <xsl:apply-templates/>
- </xsl:copy>
- </xsl:template>
- </xsl:stylesheet>
|