123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!--
- Licensed Materials - Property of IBM
- IBM Cognos Products: localizationkit
- (C) Copyright IBM Corp. 2005, 2016
- US Government Users Restricted Rights - Use, duplication or disclosure restricted
- by GSA ADP Schedule Contract with IBM Corp.
- -->
- <!--
- Module: CCLInputSource.xslt
-
- Purpose:
- Insert proper prefix into all strings in Messages section(s) such that the result message file can be
- directly consumed by other tools.
- Rules:
- 1) Only section of type "Messages", or section without the "type" attribute (which default to Messages)
- will be transformed, other sections will be dump out in their original format.
- 2) Only strings in Messages section with "errorCode" defined will be tranformed. The following format will be
- used as prefix:
- <component_name>-<section_name>-<errorCode>.
- 3) Strings in Messages section that do not have "errorCode" defined will be treated as non-error messages and
- will not be transfomed.
- 4) To conform with xml specification, non-meaningful whitespaces will be trimmed, and meaningful whitespace must
- be kept. The following are some examples:
- Example 1:
- <string>There are
- <param name="count"/> items.
- </string>
- will be transform to:
- <string>CPN-SEN-xxxx There are
- <param name="count"/> items.
- </string>
- Example 2:
- <string>
- <param name="count"/> items.
- </string>
- will be transform to:
- <string>CPN-SEN-xxxx <param name="count"/> items.
- </string>
- Example 3:
- <string>
- <param name="count"/> entries</string>
- will be transform to:
- <string>CPN-SEN-xxxx <param name="count"/> entries</string>
- Note: For readibility, linefeed and tab had been added.
- -->
- <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
- <xsl:output method="xml" omit-xml-declaration="no" encoding="UTF-8"/>
- <!-- Only transform message string with errorCode defined and is resides in the Messages section -->
- <xsl:template match="/">
- <xsl:comment>
- <xsl:text> Licensed Materials - Property of IBM 
</xsl:text>
- <xsl:text> IBM Cognos Products: localizationkit 
</xsl:text>
- <xsl:text>
 (C) Copyright IBM Corp. 2005, 2016
</xsl:text>
- <xsl:text> US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
</xsl:text>
- </xsl:comment>
- <xsl:text>
</xsl:text>
- <xsl:comment>
- <xsl:text>
 DO NOT EDIT! 
</xsl:text>
- <xsl:text>Generated using:
</xsl:text>
- <xsl:text>Id: //localizationkit/main/prod/msgsdk/CCLInputSource.xslt 
</xsl:text>
- </xsl:comment>
- <xsl:text>
</xsl:text>
- <xsl:apply-templates select="*|text()"/>
- </xsl:template>
- <!-- copy everything by default -->
- <xsl:template match="*">
- <xsl:copy>
- <xsl:copy-of select="@*"/>
- <xsl:apply-templates select="*|text()"/>
- </xsl:copy>
- </xsl:template>
-
- <xsl:template match="/stringTable/component/section[not(@type) or @type='Messages']/string[@errorCode]">
- <xsl:copy>
- <!-- prefix -->
- <xsl:copy-of select="@*"/>
- <xsl:value-of select="../../@name"/>
- <xsl:text>-</xsl:text>
- <xsl:value-of select="../@name"/>
- <xsl:text>-</xsl:text>
- <xsl:value-of select="@errorCode"/>
- <!-- make sure we put a space between prefix and the message text -->
- <xsl:text> </xsl:text>
- <!-- This is the rule to trim the non-meaningful whitespace -->
- <xsl:for-each select="child::node()">
- <xsl:if test="not(position()=1 and name()='' and string-length(normalize-space())=0)">
- <xsl:apply-templates select="."/>
- </xsl:if>
- </xsl:for-each>
- </xsl:copy>
- </xsl:template>
-
- </xsl:stylesheet>
|