Hi Bob and Dave,
One thing that has held me back from using DocBook is that the XSLT
XHTML transformation results I have seen, has not been up to my
expectations. So, thanks for your great feedback. See more below.
On 15 Feb 2017, at 8:37, Dave Pawson wrote:
On 15 February 2017 at 01:48, Bob Stayton <[email protected]> wrote:
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"/>
</xsl:template>
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.
Thanks. This works very well. It even works for the lang attribute:
<xsl:template name="root.attributes">
<xsl:call-template name="language.attribute"/></xsl:template>
I'd like to hear from members of the mailing list about whether you
think
this should be default behavior or not.
(1) According to the i18n community of the W3.org:
«Always use a language attribute on the html tag to declare the
default language of the text in the page. When the page contains content
in another language, add a language attribute to an element surrounding
that content.»
See
https://www.w3.org/International/questions/qa-html-language-declarations
(2) I try to follow the same attitude when I create a DocBook document:
I declare the (main) document language on the root element.
(3) If this community agree that the XSLT sheet should declare the
language on the <html> element, then, in addition, the XSLT sheet should
stop declaring the language on the stand-in element for the DocBook root
element (in this case, this means that the language should not be
declared on the HTML <section class="article"> element). It is no error
to repeat the declaration, but it is not necessary.
Can this be can be avoided?
Fair request IMHO.
Thanks.
Every element? Suggest that is too much.
Of course. On every HTML root element, only: <html>. That is: The one
and only <html> element. Anything else is too much - unless you need to
override the language declaration on the root element (because the text
switches to/from another language).
A parameter on the root element, then customisation thereafter
perhaps?
Pareto: suggest most documents will major in one language with
(small?)
parts in another?
Indeed.
Btw, I think the main reason for the issuees we here discuss is the fact
that the DocBook vocabulary does not match the HTML vocabulary. Which
reminds me of another, perhaps minor, issue:
If the DocBook title element happens to be in German, while the document
otherwise is in English (Example: <article xml:lang="en"><info><title
xml:lang="de">Nein!</title></info>...</article>), then the XSLT sheet
should declare the language on the <title> element: <html xml:lang="en"
xmlns='http://www.w3.org/1999/xhtml'><title xml:lang='de'>Nein</title>
....</html>. Currently, the language is declared on the stand-in element
of the DocBook <title> element - namely the HTML <h1> element - but not
on the HTML <title> element:
* Current result (when Bob’s customization layer is added):
<html xml:lang="en" xmlns='http://www.w3.org/1999/xhtml'>
<head><title>Nein</title></head>
<body><section class='article'><h1 xml:lang='de'>Nein …
* Wanted result:
<html xml:lang="en" xmlns='http://www.w3.org/1999/xhtml'>
<head><title xml:lang='de'>Nein</title></head>
<body><section class='article'><h1 xml:lang='de'>Nein …
--
leif halvard silli
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]