Hi Thomas,
Indeed, the xml:lang on structure should be carried into the output
because there is no other way to set that attribute on the root
element. That is an oversight.
The <output> element is not appropriate because its intended to alter
the behavior of the assembly transformation, not insert additional
content. So the answer to question #1 is that xml:lang on output will
have no effect so there is no conflict.
Regarding injecting other attributes (question #2), that is not
currently a feature defined for assemblies. Most attributes should
reside in the resource xml, not specified in the assembly. Attributes
like role and os should reside in the resource XML file, it seems to
me. Defining those on the fly at assembly time is not a use case I can
imagine.
That said, the DocBook TC could not imagine all the ways that people
might use assemblies. The assembly stylesheet can be customized to
insert attributes if you need that.
Bob
On 4/19/2023 12:17 AM, Thomas Schraitle wrote:
Hi,
currently I'm trying to inject language information from a <structure>
element,
but it doesn't work as expected. Either I'm doing something completely
wrong or
this is a bug.
Let's assume I have an assembly structure like this:
----
<assembly version="5.2" xml:lang="en"
xmlns="http://docbook.org/ns/docbook"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:xi="http://www.w3.org/2001/XInclude"
xmlns:tr="http://docbook.org/ns/transclusion">
<resources>
<!-- ...pruned... -->
</resources>
<structure>
<!-- ... modules comes here ... -->
</structure>
</assembly>
----
The real content of <resources> and <structure> isn't that important
for this
post. Let's focus entirely on <structure>. As you can see, it doesn't
contain 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
expected,
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="en">
However, this isn't taken into account. My next try was to add it to
<output/>:
<structure>
<output xml:lang="en"/>
This also has no effect.
I've looked into the assemble.xsl stylesheet and it seems this was an
oversight
in the following line:
https://github.com/docbook/xslt10-stylesheets/blob/master/xsl/assembly/assemble.xsl#L137
If I change it to this line, it works:
<xsl:copy-of select="@xml:id|@xml:lang"/>
Can someone confirm this?
If this is true, it means an author cannot set a language (or other
attributes)
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 others?
Where it is supposed to be inserted? Also same as point 1, who wins
when we
have the same attributes?
Thanks for your idea and answers!
--
Gruß/Regards
Thomas Schraitle
---------------------------------------------------------------------
To unsubscribe, e-mail: docbook-unsubscr...@lists.oasis-open.org
For additional commands, e-mail: docbook-h...@lists.oasis-open.org