OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.


Help: OASIS Mailing Lists Help | MarkMail Help

docbook-apps message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]

Subject: Re: [docbook-apps] Conversion: xml:lang not added to root element of Epub/XHTML1/XHTML5 files

Hi Leif,
This can be easily done by adding the following to your customization layer:

<xsl:template name="root.attributes">
  <xsl:call-template name="xml.language.attribute"/>

This makes use of two utility templates. The 'root.attributes' template is called right after the opening tag of <html>, and it should output xsl:attribute elements.

The 'xml.language.attribute' will generate an xml:lang attribute name and value.

I'd like to hear from members of the mailing list about whether you think this should be default behavior or not.

Bob Stayton
Sagehill Enterprises

On 2/14/2017 3:33 PM, Leif Halvard Silli wrote:

Can the official XSLT converstion files for Epub/XHTML5/XHTML1 be
updated to add the xml:lang attribute to the root element of all HTML

And/Or how can I at least make it happen in my local version of the XSLT

If XSLT has technical limiations that prevents this behavior, then at
the very least - as a workaround, xml:lang should in addition to be
added to the (in this case) HTML <section> elemewnt, also be added to
the <title> element. (Or else, the title element would be 'hanging in
the air', as an element without language tag assigned.)


The (x)HTML XSLT conversion sheets for DocBook fails to add a
(xml:)lang) attribute to the <html> element. This happens for Epub,
XHTML1 and XHTMl5 conversion. (I have not tested HTML conversion.)

For instance, if I (1) create an DocBook article document, adding
xml:lang="en" to the DocBook <article> element and then (2) apply
converstion to XHTML5 using the docbook.xsl file found at
cdn.docbook.org [1], then, (3) the end result is a XHTML5 file where
xml:lang is /not/ applied to <html> (and not to <body>, for that matter
and not, as a workaround, to <head> or <title> either). The first
occurrence of xml:lang is found only on the <section> element.

By the way: I consider this behavior a bug. And I belive that the reason
for this bug is mechanistic conversion of the DocBook root element (in
this case: <article>) to the HTML element that “we” have decided to
correspond to the root element (for Docbook <article> documents, then
”we” have decided that the corresponding HTML element is the HTML
<section> element). The /correct/ behavior ought to have been to
/always/ add the xml:lang attribute of the Docbook root element (in this
case: <article>), to the HTML root element of (<html>).

[1] http://cdn.docbook.org/release/xsl/current/xhtml5/docbook.xsl
leif halvard silli

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]