As near as I can tell, the template named 'gentext.template' was changed in version
1.76.1 so that it no longer uses the template variable 'local.context.node', only the
variable 'context.node' (the original l10n file). I'm not in a position to figure out
why or fix this right now, but that is the source of the problem.
Bob Stayton
Sagehill Enterprises
[email protected]
----- Original Message -----
From: "Thomas Schraitle" <[email protected]>
To: "DocBook Apps" <[email protected]>
Sent: Thursday, July 05, 2012 1:46 AM
Subject: [docbook-apps] Custom Localization Support Broken?
Hi,
recently, I've observed some strange behavior for my localization
customization. Maybe I didn't see my error as I've looked at it too
long. ;) Or it has something to do with the localization optimization
in revisions 8719, 8722, 8752, and 8760.
Ok, I've tried to strip it down to a small test case. Let's begin with
this small XML file (note the empty keycaps):
-------------------[ test.xml ]-------------------
<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.docbook.org/xml/4.5/docbookx.dtd">
<article lang="en">
<title>Keycap Testcase</title>
<para>This is a <keycap function="escape"/> key.</para>
<para>This is a <keycap function="alt"/> key.</para>
</article>
--------------------------------------------------
What I was trying is to use the @function attribute and create a
localized string. In the above case, it should return "ESC" and "Alt"
for the two keycaps.
For this reason, I've created a language mapping in the l:i18n/l:l10n
elements with the context "keycap". The idea was to extract the
respective entry from the table through the gentext.template function.
Here is my customization layer:
-------------------[ mydb.xsl ]-------------------
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0"
exclude-result-prefixes="l">
<xsl:import
href="http://docbook.sourceforge.net/release/xsl/current/xhtml/docbook.xsl"/>
<xsl:param name="local.l10n.xml" select="document('')"/>
<l:i18n xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0">
<l:l10n language="en" english-language-name="English">
<l:context name="keycap">
<l:template name="alt" text="Alt"/>
<l:template name="backspace" text="<—"/><!-- mdash -->
<!-- <l:template name="command" text="???"/> -->
<l:template name="control" text="Ctrl"/>
<l:template name="delete" text="Del"/>
<l:template name="down" text="↓"/><!-- darr -->
<l:template name="end" text="End"/>
<l:template name="enter" text="Enter"/>
<l:template name="escape" text="Esc"/>
<l:template name="home" text="Home"/>
<l:template name="insert" text="Ins"/>
<l:template name="left" text="←"/><!-- larr -->
<l:template name="meta" text="Meta"/>
<!-- <l:template name="option" text="???"/> -->
<l:template name="other" text="???"/>
<l:template name="pagedown" text="Page ↓"/>
<l:template name="pageup" text="Page ↑"/>
<l:template name="right" text="→"/><!-- rarr -->
<l:template name="shift" text="Shift"/>
<l:template name="space" text="Space"/>
<l:template name="tab" text="→|"/>
<l:template name="up" text="↑"/><!-- uarr -->
</l:context>
</l:l10n>
</l:i18n>
<xsl:template match="keycap">
<xsl:message>
<xsl:text>keycap: @function=</xsl:text>
<xsl:value-of select="@function"/>
<xsl:text> [</xsl:text>
<xsl:call-template name="gentext.template">
<xsl:with-param name="context" select="local-name()"/>
<xsl:with-param name="name" select="@function"/>
</xsl:call-template>
<xsl:text>]</xsl:text>
</xsl:message>
<!-- Rest omitted as we are only interested in the above output
ATM
-->
</xsl:template>
</xsl:stylesheet>
--------------------------------------------------
After I've transforming the above XML to XHTML, I'm getting this output:
$ xsltproc --output test.html mydb.xsl test.xml
keycap: @function=escape []
keycap: @function=alt []
Another point to mention:
The above keycap context is not available in the original en.xml file.
The interesting thing is, if I include the context in the original file,
my customization works too.
Thanks! :-)
--
Gruß/Regards,
Thomas Schraitle
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]