Bug 696397 - use "xml:lang" instead of "lang" in DocBook 5
Summary: use "xml:lang" instead of "lang" in DocBook 5
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Publican
Classification: Community
Component: publican
Version: 2.5
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: 3.0
Assignee: Jeff Fearn 🐞
QA Contact: tools-bugs
URL:
Whiteboard:
Depends On:
Blocks: 820023
TreeView+ depends on / blocked
 
Reported: 2011-04-14 00:54 UTC by Ruediger Landmann
Modified: 2012-10-31 03:11 UTC (History)
4 users (show)

Fixed In Version: 3.0.0
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2012-10-31 03:11:13 UTC
Embargoed:


Attachments (Terms of Use)
Minimal DocBook 5 article (301 bytes, text/xml)
2011-04-14 00:54 UTC, Ruediger Landmann
no flags Details

Description Ruediger Landmann 2011-04-14 00:54:37 UTC
Created attachment 491924 [details]
Minimal DocBook 5 article

Description of problem:
Publican adds a "lang" attribute to nodes, but this attribute has been renamed to "xml:lang" in DocBook 5. DocBook 5 documents therefore do not validate.

Version-Release number of selected component (if applicable):
2.5-1

How reproducible:
100%

Steps to Reproduce:
1. set dtdver: 5.0 in the publican.cfg file
2. try to build a really minimal DocBook 5 document, like the sample attached.

Actual results:
Validation failed: 
docbook5test.xml:12: validity error : No declaration for attribute lang of element article

Looking in tmp/en-US/xml, the root node is now:
<article lang="en-US" version="5.0" xmlns="http://docbook.org/ns/docbook">

Expected results:
Publican uses xml:lang instead of lang, so the root node is:
<article xml:lang="en-US" version="5.0" xmlns="http://docbook.org/ns/docbook">

so the document should validate and build

Additional info:
Document builds fine with --novalid option

Comment 1 Jeff Fearn 🐞 2011-04-14 01:26:34 UTC
(In reply to comment #0)
> Publican adds a "lang" attribute to nodes, but this attribute has been renamed
> to "xml:lang" in DocBook 5. DocBook 5 documents therefore do not validate.

The real problem doesn't come in the intermediate files, it comes in the source.

xml:lang is an XML attribute and has always existed, it's use case is to say 'this content is authored in this language'.

DocBook's lang attribute has a separate use case 'this content should only be displayed in the following languages'.

So, xml:lang is a single language, in which the content was authored, and DocBook lang is a list of languages used for profiling, or filtering, output.

If DocBook 5 has removed the lang attribute then we will lose the ability to selectively use content on a per language basis. Or at least we will need to try and use the condition tag for such use cases ... it will probably get ugly if books using lang this way also have other conditional logic.

Cheers, Jeff.

Comment 2 Ruediger Landmann 2011-04-14 02:51:01 UTC
> If DocBook 5 has removed the lang attribute then we will lose the ability to
> selectively use content on a per language basis. Or at least we will need to
> try and use the condition tag for such use cases ... it will probably get ugly
> if books using lang this way also have other conditional logic.

Yeah, "lang" is definitely gone, and the advice from docbook.org is to use xml:lang in its place:

"DocBook V5.0 is built on top of existing XML standards as much as possible, for example the lang attribute is superseded by the standard xml:lang attribute." -- http://www.docbook.org/docs/howto/

(Note also the two examples on that page, immediately before this in the text -- Example 1. DocBook V4.5 document vs Example 2. DocBook V5.0 document) 

DocBook 4 common attributes: http://www.docbook.org/tdg/en/html/ref-elements.html#common.attributes

DocBook 5 common attributes: http://www.docbook.org/tdg5/en/html/ref-elements.html#common.attributes

Probably not good news :/

Cheers
Rudi

Comment 3 Jeff Fearn 🐞 2011-04-14 03:26:32 UTC
(In reply to comment #2)
> > If DocBook 5 has removed the lang attribute then we will lose the ability to
> > selectively use content on a per language basis. Or at least we will need to
> > try and use the condition tag for such use cases ... it will probably get ugly
> > if books using lang this way also have other conditional logic.
> 
> Yeah, "lang" is definitely gone, and the advice from docbook.org is to use
> xml:lang in its place:
> 
> "DocBook V5.0 is built on top of existing XML standards as much as possible,
> for example the lang attribute is superseded by the standard xml:lang
> attribute." -- http://www.docbook.org/docs/howto/
> 
> (Note also the two examples on that page, immediately before this in the text
> -- Example 1. DocBook V4.5 document vs Example 2. DocBook V5.0 document) 

The two examples are not equivalent in profile mode, and we use profile mode. Although we do use our own profiling code, it does comply with the DocBook 4 profile use of lang.

> DocBook 4 common attributes:
> http://www.docbook.org/tdg/en/html/ref-elements.html#common.attributes
> 
> DocBook 5 common attributes:
> http://www.docbook.org/tdg5/en/html/ref-elements.html#common.attributes
> 
> Probably not good news :/

I don't think it will affect  many books, but it's probably going to be very painful on the two or three books this will affect.

Cheers, Jeff.

Comment 4 Jeff Fearn 🐞 2012-03-12 05:04:13 UTC
Ensured xml:lang is set in intermediate files when XmlClean is run.

Pushed To ssh://git.fedorahosted.org/git/publican.git
   3ca01da..d497197  master -> master

Comment 5 Michael Hideo 2012-06-08 01:26:15 UTC
build attached article.

Comment 6 Ruediger Landmann 2012-06-16 03:26:32 UTC
Verified on 

publican-3.0-0.fc17.t180.noarch

<article version="5.0" xml:lang="en-US" xmlns="http://docbook.org/ns/docbook">


Note You need to log in before you can comment on or make changes to this bug.