SOLUTION 1: Run the i18nTransformer on the XSLT before using the XSLT
in map:transform.
<map:transform src="cocoon:/myTransformedXSLT"/>
<map:match pattern="myTransformedXSLT">
<map:generate src="myXSLT.xsl"/>
<map:transform type="i18n"/><!-- Need locale parameter -->
<map:serialize type="xml"/>
</map:match>
SOLUTION 2: Pass i18n elements as text to remain in results for later
transforms.
<xsl:variable name="param0">
<xsl:text disable-output-escaping="yes"><i18n:text
key="[EMAIL PROTECTED]"/></xsl:text>
</xsl:variable>
HTH,
solprovider
On 3/20/08, Rainer Koschnick <[EMAIL PROTECTED]> wrote:
> I have a problem with the i18n block (cocoon 2.1.11 release).
> It seems that the results of a <i18n:text/> translation cannot be stored
> in a <xsl:variable/>.
> What I'm trying to do is to show an error message with localizable
> parameters.
>
> Passed XML:
> <paramText param0="DATE">ERROR_FILTER</paramText>
> messages.xml:
> <message key="ERROR_FILTER">Error while evaluating filter, please check
> the syntax of {0}.</message>
> <message key="DATE">Date Scheduled</message>
>
> So my XSL looks something like this:
> <xsl:template match="paramText">
> <xsl:variable name="param0">
> <i18n:text key="[EMAIL PROTECTED]"/>
> </xsl:variable>
> <span>
> <i18n:translate>
> <i18n:text key="{text()}" />
> <i18n:param>
> <xsl:value-of select="$param0" />
> </i18n:param>
> </i18n:text>
> </i18n:translate>
> </span>
> </xsl:template>
>
> But in the output $param0 is not shown (since it's empty). If I change
> the variable to:
> <xsl:variable name="param0">
> <i18n:text>
> <xsl:value-of select="@param0"/>
> </i18n:text>
> </xsl:variable>
>
> it contains the untranslated text (value of @param0 -> DATE).
> If I change the <i18n:translate/> block to:
> <i18n:translate>
> <i18n:text key="{text()}" />
> <i18n:param>
> <i18n:text key="[EMAIL PROTECTED]"/>
> </i18n:param>
> </i18n:translate>
> </i18n:translate>
>
> the output will _only_ consist of @param0 ("Date Scheduled") and not the
> message text.
>
> So how would I go about implementing the error display?
> I wouldn't know of any way of getting access to the i18n message
> resources from within Java either, otherwise I would do the translation
> in my code.
>
> Thanks,
> Rainer
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]