Page 1 of 1

Pass language explicitly to "getVariable" template

Posted: Tue Aug 20, 2019 3:22 pm
by Frank Ralf
Hello,

I have created a customization of the Oxygen WebHelp. One of the XSLT templates matches <xsl:template match="toc:topic>. Inside this template I use <xsl:call-template name="getVariable"> for some localized text. The problem is that somehow no language values seems to be available inside this template so the default language is alway used for localization.

I'm thinking about passing the desired language code explicitly to "getVariable". I've already looked at the code for "getVariable" and "findString" in DITA-OT\xsl\common\dita-utilities.xsl as well as for <xsl:function name="dita-ot:get-variable"> in DITA-OT\xsl\common\functions.xsl but I have no idea how to achieve this.

Any pointers welcome.

Best regards,
Frank

Re: Pass language explicitly to "getVariable" template

Posted: Thu Sep 12, 2019 11:18 am
by Frank Ralf
Found this related issue in the DITA-OT tracker with some hints how to solve my problem:

Bug in "dita-utilities.xsl" getVariable when called from string context
https://github.com/dita-ot/dita-ot/issues/2512
From any context, I think this would provide a mechanism to override the language, by passing in something like <node xml:lang="fi"/> (though I'm not sure how useful this would be outside of a test scenario).
...
I also tried calling this while passing in a node to reset the context - this retrieved a Russian string, and would work from any context (string context or anything else):

<xsl:with-param name="ctx" as="node()"><dummy xml:lang="ru"/></xsl:with-param>
Best regards,
Frank