Re: Localization derived from Walsh styles

Vitaly Ostanin <[email protected]> Mon, 30 Jun 2003 10:57:03 +0400
Newsgroups gmane.text.docbook.db2latex.devel
Message-ID <[email protected]>
--=.p,YH7wveUQdm8H
Content-Type: multipart/mixed;
 boundary="Multipart_Mon__30_Jun_2003_10:57:03_+0400_0839e0a8"


--Multipart_Mon__30_Jun_2003_10:57:03_+0400_0839e0a8
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit

On Mon, 30 Jun 2003 07:56:01 +0800
James Devenish <[email protected]> wrote:

> In message <[email protected]>
> on Sun, Jun 29, 2003 at 08:44:29PM +0400, Vitaly Ostanin wrote:
> > Anyway, you can use XInclude for synchronization at build
> > time, not in normal using.
> 
> An interesting idea!
> 
> > At preparing time for release this file must be parsed for 
> > inclusion and final output will used by release styles.
> 
> I expect that we would actually keep a generated copy in the
> CVS repository, 

For what? This way keep information twice and not synced :(

> rather than only putting it into releases, but
> I understand your sentiment.
> 
> > For it I write xsl-style (attached) for parsing DocBook and 
> > DB2LaTeX localization files. See comments in style.
> 
> Thanks, we will definitely look into this!

I found bug, but it not affect current localization in DB2LaTeX.
Fixed style is attached.

> > Next, I copy DocBook l10n files to db2latex/xsl/common:
> > l10n.dtd
> > l10n.xsl
> > l10n.xml
> 
> Part of the reason I have not personally done any revamping of
> the DB2LaTeX localisation is that we have modified those files
> since our last sync with Norman's stylesheets. 

Please, give me an example.

> Therefore, his are no longer drop-in replacements. Obviously
> that is our problem, but it exists nevertheless.

I don't see any problem. Attached style find any DB2LaTeX addons
and keeps their in result output.

If you not just add keys but modified their values, it's strange.

<skipped/>

-- 
Regards, Vyt
mailto:  [email protected]
JID:     [email protected]

--Multipart_Mon__30_Jun_2003_10:57:03_+0400_0839e0a8
Content-Type: text/xml;
 name="leave-uniq-keys.xsl"
Content-Disposition: attachment;
 filename="leave-uniq-keys.xsl"
Content-Transfer-Encoding: 7bit

<?xml version='1.0'?>
<!--############################################################################# 
|	$Id$
|- #############################################################################
|	Author: Vitaly Ostanin <[email protected]>
|
|   PURPOSE:
|	This stylesheet parse localisation files from DB2LaTeX and Norman Walsh's 
|       DocBook stylesheet for leave uniq keys. Duplicated keys (in both stylesheets)
|       moved to include with XML Inclusions.
|
|       This style should be run in dir "common" by Norman Walsh 
|       DocBook XSL Stylesheets.
|
|       Main file for parsing is "common/l10n.xml" from Norman Walsh 
|       DocBook XSL Stylesheets.
|
|       DB2LaTeX current localization files must be in dir "common" by Norman Walsh 
|       DocBook XSL Stylesheets. Their names should have suffix ".db2latex".
|       For example, for Russian language: ru.xml.db2latex
+ ############################################################################## -->

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
                xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0"
                xmlns:exsl="http://exslt.org/common"
                extension-element-prefixes="exsl"
                version='1.0'>

  <!-- This template work on each of language.-->
  <xsl:template match="l:l10n">
    <!-- File with DocBook localization for current language -->
    <xsl:variable name="docbook-l10n-file" select="concat(@language,'.xml')"/>
    <!-- File with DB2LaTeX localization for current language -->
    <xsl:variable name="db2latex-l10n-file" select="concat($docbook-l10n-file,'.db2latex')"/>
    <!-- Output file, contain include for DocBook localization and DB2LaTeX addons for current language -->
    <xsl:variable name="xinclude-db2latex-l10n-file" select="concat('xinclude.',$db2latex-l10n-file)"/>

    <xsl:variable name="docbook-l10n" select="document($docbook-l10n-file)"/>
    <xsl:variable name="db2latex-l10n" select="document($db2latex-l10n-file)"/>

    <xsl:if test="not(element-available('exsl:document'))">
      <xsl:message terminate="yes">
        <xsl:text>Error: this style requires support for extension 'exsl:document'</xsl:text>
      </xsl:message>
    </xsl:if>
    <exsl:document href="{$xinclude-db2latex-l10n-file}"
                   method="xml"
                   encoding="US-ASCII"
                   indent="yes">
      <xsl:copy>
        <xsl:attribute name="language">
          <xsl:value-of select="@language"/>
        </xsl:attribute>
        <xsl:attribute name="english-language-name">
          <xsl:value-of select="@english-language-name"/>
        </xsl:attribute>
        <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
          href="{concat('http://docbook.sourceforge.net/release/xsl/current/common/',$docbook-l10n-file,'#xpointer(/*/node())')}"/>
        <xsl:for-each select="$db2latex-l10n/localization/gentext">
          <xsl:if test="not($docbook-l10n/l:l10n/l:gentext/@key=@key)">
            <l:gentext key="{@key}" text="{@text}"/>
          </xsl:if>
        </xsl:for-each>
        <xsl:for-each select="$db2latex-l10n/localization/dingbat">
          <xsl:if test="not($docbook-l10n/l:l10n/l:dingbat/@key=@key)">
            <l:dingbat key="{@key}" text="{@text}"/>
          </xsl:if>
        </xsl:for-each>
      </xsl:copy>
    </exsl:document>
    <xsl:apply-templates/>
  </xsl:template>

  <xsl:template match="text()"/>

</xsl:stylesheet>

--Multipart_Mon__30_Jun_2003_10:57:03_+0400_0839e0a8--

--=.p,YH7wveUQdm8H
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)

iD8DBQE+/99Dd6sY3eC5PjQRAlYOAKDRhWweYCKgBqWHo0DbgcNr9EJIGwCghsar
lORA0+Rh0mJ/vpLmF+taPi4=
=rnTj
-----END PGP SIGNATURE-----

--=.p,YH7wveUQdm8H--


-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100006ave/direct;at.asp_061203_01/01