DocBook RNG Schema vs DTD + L10N

View: New views
5 Messages — Rating Filter:   Alert me  

DocBook RNG Schema vs DTD + L10N

by Giuseppe Greco-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

... In my previous email I forgot to mention that entity &legalnotice; was
localized, meaning that the right "legalnotice.xml" file was included
depending on the language specified in attribute "lang" of element
"article";

<article id="CSharpCodingGuidelines" lang="&language;">
    ...
</article>

The language to select was also an entity...

Anyway, to handle the different languages, my customized DocBook DTD
included the following:

<!ENTITY % German "IGNORE">
<![%German; [
  <!ENTITY % l10n.user PUBLIC "-//AGAMURA//ENTITIES QuXo Locale V1.0//de-DE"
    "http://www.agamura.com/quxo/dtd/1.0/ent/de-DE/locale.ent">
  %l10n.user;
  <!ENTITY % l10n.default "IGNORE">
]]>

<!ENTITY % English "IGNORE">
<![%English; [
  <!ENTITY % l10n.user PUBLIC "-//AGAMURA//ENTITIES QuXo Locale V1.0//en-US"
    "http://www.agamura.com/quxo/dtd/1.0/ent/en-US/locale.ent">
  %l10n.user;
  <!ENTITY % l10n.default "IGNORE">
]]>

<!ENTITY % French "IGNORE">
<![%French; [
  <!ENTITY % l10n.user PUBLIC "-//AGAMURA//ENTITIES QuXo Locale V1.0//fr-FR"
    "http://www.agamura.com/quxo/dtd/1.0/ent/fr-FR/locale.ent">
  %l10n.user;
  <!ENTITY % l10n.default "IGNORE">
]]>

<!-- Default: English -->
<!ENTITY % l10n.default "INCLUDE">
<![%l10n.default; [
  <!ENTITY % l10n.user PUBLIC "-//AGAMURA//ENTITIES QuXo Locale V1.0//en-US"
    "http://www.agamura.com/quxo/dtd/1.0/ent/en-US/locale.ent">
  %l10n.user;
]]>

Is there a way to implement something similar with a customized DocBook
RNG schema?

Again, any help would be REALLY appreciated,
j3d.

----------------------------------------
Giuseppe Greco

Agamura Entertainments, Inc.
6928 Manno
Switzerland

call giuseppe.greco via Skype
phone:  +41 (0)91 604 67 65
mobile: +41 (0)79 590 33 06
email:  giuseppe.greco@...
----------------------------------------

---------------------------------------------------------------------
To unsubscribe, e-mail: docbook-unsubscribe@...
For additional commands, e-mail: docbook-help@...


Re: DocBook RNG Schema vs DTD + L10N

by Thomas Schraitle :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Giuseppe,

> ... In my previous email I forgot to mention that entity &legalnotice; was
> localized, meaning that the right "legalnotice.xml" file was included
> depending on the language specified in attribute "lang" of element
> "article";
>
> <article id="CSharpCodingGuidelines" lang="&language;">
>     ...
> </article>
>
> The language to select was also an entity...
>
> Anyway, to handle the different languages, my customized DocBook DTD
> included the following:
>
> <!ENTITY % German "IGNORE">
> <![%German; [
>   <!ENTITY % l10n.user PUBLIC "-//AGAMURA//ENTITIES QuXo Locale V1.0//de-DE"
>     "http://www.agamura.com/quxo/dtd/1.0/ent/de-DE/locale.ent">
>   %l10n.user;
>   <!ENTITY % l10n.default "IGNORE">
> ]]>
>
> <!ENTITY % English "IGNORE">
> <![%English; [
>   <!ENTITY % l10n.user PUBLIC "-//AGAMURA//ENTITIES QuXo Locale V1.0//en-US"
>     "http://www.agamura.com/quxo/dtd/1.0/ent/en-US/locale.ent">
>   %l10n.user;
>   <!ENTITY % l10n.default "IGNORE">
> ]]>
>
> <!ENTITY % French "IGNORE">
> <![%French; [
>   <!ENTITY % l10n.user PUBLIC "-//AGAMURA//ENTITIES QuXo Locale V1.0//fr-FR"
>     "http://www.agamura.com/quxo/dtd/1.0/ent/fr-FR/locale.ent">
>   %l10n.user;
>   <!ENTITY % l10n.default "IGNORE">
> ]]>
>
> <!-- Default: English -->
> <!ENTITY % l10n.default "INCLUDE">
> <![%l10n.default; [
>   <!ENTITY % l10n.user PUBLIC "-//AGAMURA//ENTITIES QuXo Locale V1.0//en-US"
>     "http://www.agamura.com/quxo/dtd/1.0/ent/en-US/locale.ent">
>   %l10n.user;
> ]]>
>
> Is there a way to implement something similar with a customized DocBook
> RNG schema?

I don't think there is any possibility in RELAX NG directly. However, you can
move your above definitions into a separate file (for example "mylocale.ent")
and refer to it into the internal subset of the DTD like this:

<!DOCTYPE article
[
  <!ENTITY % Italian "INCLUDE">
  <!ENTITY % mylocale SYSTEM "mylocale.ent">
  %mylocale;
]>
<article ... xml:lang="&language;">
  ...
</article>

I couldn't test it so there might be other issues.

Best wishes,
Tom


---------------------------------------------------------------------
To unsubscribe, e-mail: docbook-unsubscribe@...
For additional commands, e-mail: docbook-help@...


Re: DocBook RNG Schema vs DTD + L10N

by Jirka Kosek :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Giuseppe Greco wrote:

> Is there a way to implement something similar with a customized DocBook
> RNG schema?

Please note that you can use your current approach also with RELAX NG
schema. Your confusion comes from fact that DTD has two functions -- it
can define schema and it can define entities. So you can use DTD only
for entity definitions and at the same time use RELAX NG for validation.

However I think that you will not make mistake if you replace your
complex entity management with XIncludes and profiling to achieve the
same effect.

                        Jirka


--
------------------------------------------------------------------
  Jirka Kosek      e-mail: jirka@...      http://xmlguru.cz
------------------------------------------------------------------
       Professional XML consulting and training services
  DocBook customization, custom XSLT/XSL-FO document processing
------------------------------------------------------------------
 OASIS DocBook TC member, W3C Invited Expert, ISO JTC1/SC34 member
------------------------------------------------------------------



signature.asc (258 bytes) Download Attachment

Re: DocBook RNG Schema vs DTD + L10N

by Giuseppe Greco-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Jirka,

> Please note that you can use your current approach also with RELAX NG
> schema. Your confusion comes from fact that DTD has two functions -- it
> can define schema and it can define entities. So you can use DTD only
> for entity definitions and at the same time use RELAX NG for validation.
>
> However I think that you will not make mistake if you replace your
> complex entity management with XIncludes and profiling to achieve the
> same effect.

I agree, but I need a mechanism to select the legal notice in the right
natural language depending on the value of attribute "lang" in start
element <article>;

<article id="CSharpCodingGuidelines" lang="en-US">
    <articleinfo>
        <title>C# Coding Guidelines</title>
        <legalnotice><xi:include href="legalnotice.xml"/></legalnotice>
        ...
    </articleinfo>
    ...
</article>

In the example above, legalnotice.xml should just select file
en-US/legalnotice.xml (because of lang="en-US"); if I specify lang="de-DE",
then legalnotice.xml should select de-DE/legalnotice.xml, and so on.

On the server I have a structure like this:

legalnotice.xml
      + en-US
      |   + legalnotice.xml
      + de-DE
      |   + legalnotice.xml
      ...

The top-level legalnotice.xml shouldn't contain any text at all; it
should just select the right localized file (again, depending on lang="...").

That's it,
j3d.

>
> --
> ------------------------------------------------------------------
>   Jirka Kosek      e-mail: jirka@...      http://xmlguru.cz
> ------------------------------------------------------------------
>        Professional XML consulting and training services
>   DocBook customization, custom XSLT/XSL-FO document processing
> ------------------------------------------------------------------
>  OASIS DocBook TC member, W3C Invited Expert, ISO JTC1/SC34 member
> ------------------------------------------------------------------
>
>


----------------------------------------
Giuseppe Greco

Agamura Entertainments, Inc.
6928 Manno
Switzerland

call giuseppe.greco via Skype
phone:  +41 (0)91 604 67 65
mobile: +41 (0)79 590 33 06
email:  giuseppe.greco@...
----------------------------------------

---------------------------------------------------------------------
To unsubscribe, e-mail: docbook-unsubscribe@...
For additional commands, e-mail: docbook-help@...


Re: DocBook RNG Schema vs DTD + L10N

by Jirka Kosek :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Giuseppe Greco wrote:

> I agree, but I need a mechanism to select the legal notice in the right
> natural language depending on the value of attribute "lang" in start
> element <article>;

You can do this with profiling. Just put the following into your
customization layer:

<xsl:param name="profile.lang" select="/*/@lang"/>

> <article id="CSharpCodingGuidelines" lang="en-US">
>     <articleinfo>
>         <title>C# Coding Guidelines</title>
>         <legalnotice><xi:include href="legalnotice.xml"/></legalnotice>
>         ...
>     </articleinfo>
>     ...
> </article>
>
> In the example above, legalnotice.xml should just select file
> en-US/legalnotice.xml (because of lang="en-US"); if I specify lang="de-DE",
> then legalnotice.xml should select de-DE/legalnotice.xml, and so on.
With profiling your legalnotice.xml should XInclude all language
variants of xx-XX/legalnotice.xml, filtering will be done by profiling. See

        http://sagehill.net/docbookxsl/Profiling.html


--
------------------------------------------------------------------
  Jirka Kosek      e-mail: jirka@...      http://xmlguru.cz
------------------------------------------------------------------
       Professional XML consulting and training services
  DocBook customization, custom XSLT/XSL-FO document processing
------------------------------------------------------------------
 OASIS DocBook TC member, W3C Invited Expert, ISO JTC1/SC34 member
------------------------------------------------------------------



signature.asc (258 bytes) Download Attachment