This is the mail archive of the docbook-apps@lists.oasis-open.org mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: How to customize localized text within theXSL-Stylesheets?


> From: Ali Saffari <asaffari@pironet-ndh.com>
> 
> I was wondering if there is a nice way to change some of the
> entries in the localized text messages defined in the common
> directory.
> 
> For example I want to change the entry=20
> 
> <gentext key=3D"nav-next" text=3D"Vor"/>
> 
> to=20
> 
> <gentext key=3D"nav-next" text=3D"N&auml;chste Seite"/>
> 
> in the de.xml file. But on the head of each xml file
> you can see this message
> 
> <!-- This file is generated automatically. -->
> <!-- Do not edit this file by hand! -->
> <!-- See http://docbook.sourceforge.net/ -->
> 
> Actually I don't want to change every entry in the file
> only a few of them. The new entries should overwrite the
> old ones defined in the standard files. Is there any good way=20
> to this customization and beeing updateable through next=20
> releases of the stylesheets?

Yes, there is.  Norm has provided a customization
feature to that.  Put something like this in your
XSL customization file:

<xsl:param name="local.l10n.xml" select="document('')"/>
<l:i18n xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0";;>
  <l:l10n language="de">
    <l:gentext key="nav-next" text="N&auml;chste Seite"/>
    <!-- other customizations here -->
  </l:l10n>
</l:i18n>

Note that the language files now use the l: namespace. 

The trick here is the select="document('') attribute.
This special syntax reads the current document (the
stylesheet file) into the 'local.l10n.xml' variable.
When the stylesheet goes to generate text,
the stylesheet first scans that variable for a match
before going to the standard language files.
The use of the namespace prevents accidentally
picking up any literal result elements that might
be lurking in the stylesheet (unlikely, but possible).

bobs
Bob Stayton                                 400 Encinal Street
Publications Architect                      Santa Cruz, CA  95060
Technical Publications                      voice: (831) 427-7796
Caldera International, Inc.                 fax:   (831) 429-1887
                                            email: bobs@caldera.com

----------------------------------------------------------------
To subscribe or unsubscribe from this elist use the subscription
manager: <http://lists.oasis-open.org/ob/adm.pl>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]