[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: Re: [docbook-apps] language-specific text alignment
There are a couple of ways to accomplish this. All require creating and using a customization layer for the stylesheet, a process described here:
If you have just a few differences based on language, you can integrate the choices into a single customization layer and use xsl:choose to automatically set attribute values based on the lang or xml:lang attribute on the document's root element.
If you have lots of languages and many differences, then an alternative method is to create separate customization layers for each language, and manually select one based on the document's language.
With either method in FO output, you will most likely be modifying properties in the attribute-set named 'root.properties', as those attributes are applied to the whole document (inheritable properties only).
With the first method, you should first employ the utility template named 'l10n.language' to set a global variable to store the value of the root element's lang attribute, like this:
For example, if a document starts with <book xml:lang="ja">, then the $document.lang variable will be set to "ja". To make this a global variable, this definition must be outside of any xsl:template in your customization layer.
Then you can modify properties in the root.properties attribute set as follows:
<xsl:when test="$document.lang = 'ja'">justify</xsl:when>
[and other attributes in a similar manner]
If the lang value can be "ja", "ja_JP", "ja-jp", or such, then you should modify the test like this:
<xsl:when test="starts-with($document.lang, 'ja')">
String matches are case sensitive, so if some documents use lang="JA", you will first have to convert the value to lowercase. There are a couple of utility templates to do so, described in:
Hope this helps.
----- Original Message ----- From: "Susan F." <firstname.lastname@example.org>
Sent: Thursday, October 08, 2009 12:05 AM
Subject: [docbook-apps] language-specific text alignment
---------------------------------------------------------------------This is a request for information on how to configure or customize
DocBook to perform language-specific processing. This is not a
question about language-specific text generation, or writing modes.
Desired processing logic is: if lang=jp then alignment=justify,
We use XXE as our input tool, DocBook as formatting instructions, and
Apache ANT as our XML -> PDF processor. Our PDFs must be formatted
based on the requirements of their destination country (US, Korea,
This announcement, http://markmail.org/message/5wo3fy4fk5zwrkdx, says
DocBook 1.74.2 has "support for writing.mode to set text direction and
alignment based on document locale". This seems like what we need. But
further investigation reveals that (a.) I don't know how to identify
the version of DocBook stylesheets I'm using (which I inherited), and
(b.) this support seems to be related only to HTML PI ??
Any suggestions, comments, ideas, solutions will be appreciated.
To unsubscribe, e-mail: email@example.com
For additional commands, e-mail: firstname.lastname@example.org