DocBook Assemblies: is xml:lang considered in <structure>?

Thomas Schraitle <[email protected]> Wed, 19 Apr 2023 09:17:36 +0200
Newsgroups gmane.text.docbook.misc
Message-ID <[email protected]>
Hi,

currently I'm trying to inject language information from a <structure> ele=
ment,
but it doesn't work as expected. Either I'm doing something completely wro=
ng or
this is a bug.

Let's assume I have an assembly structure like this:

=2D---
<assembly version=3D"5.2" xml:lang=3D"en"
     xmlns=3D"http://docbook.org/ns/docbook"
     xmlns:xlink=3D"http://www.w3.org/1999/xlink"
     xmlns:xi=3D"http://www.w3.org/2001/XInclude"
     xmlns:tr=3D"http://docbook.org/ns/transclusion">
   <resources>
      <!-- ...pruned... -->
   </resources>

   <structure>
      <!-- ... modules comes here ... -->
   </structure>
</assembly>
=2D---

The real content of <resources> and <structure> isn't that important for t=
his
post. Let's focus entirely on <structure>. As you can see, it doesn't cont=
ain a
resourceref attribute.

When I call the assemble.xsl stylesheet I get the result file. So far, so =
good.

However, the result file doesn't contain any language. That was to be expe=
cted,
because we didn't set one. So in my naive view I thought I just add the
language information to <structure> like this:

   <structure xml:lang=3D"en">

However, this isn't taken into account. My next try was to add it to <outp=
ut/>:

   <structure>
     <output xml:lang=3D"en"/>

This also has no effect.

I've looked into the assemble.xsl stylesheet and it seems this was an over=
sight
in the following line:

https://github.com/docbook/xslt10-stylesheets/blob/master/xsl/assembly/ass=
emble.xsl#L137

If I change it to this line, it works:

   <xsl:copy-of select=3D"@xml:id|@xml:lang"/>

Can someone confirm this?
If this is true, it means an author cannot set a language (or other attrib=
utes)
on the output.

I have two additional questions:

1. What if we have _two_ xml:lang attributes, both on <structure> and on
    <output>. Which wins? Which has the higher priority?
    Is that specified or defined anywhere?

2. What if an author wants to inject other attributes like role, os, or ot=
hers?
    Where it is supposed to be inserted? Also same as point 1, who wins wh=
en we
    have the same attributes?


Thanks for your idea and answers!


=2D-
Gru=C3=9F/Regards
   Thomas Schraitle