This service will be undergoing maintenance at 00:00 UTC, 2016-08-01. It is expected to last about 1 hours

Bug 696397

Summary: use "xml:lang" instead of "lang" in DocBook 5
Product: [Community] Publican Reporter: Ruediger Landmann <r.landmann>
Component: publicanAssignee: Jeff Fearn <jfearn>
Status: CLOSED CURRENTRELEASE QA Contact: tools-bugs <tools-bugs>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 2.5CC: dayleparker, mhideo, mmcallis, publican-list
Target Milestone: 3.0   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: 3.0.0 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-10-30 23:11:13 EDT Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Bug Depends On:    
Bug Blocks: 820023    
Attachments:
Description Flags
Minimal DocBook 5 article none

Description Ruediger Landmann 2011-04-13 20:54:37 EDT
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-13 21:26:34 EDT
(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-13 22:51:01 EDT
> 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-13 23:26:32 EDT
(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 01:04:13 EDT
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-07 21:26:15 EDT
build attached article.
Comment 6 Ruediger Landmann 2012-06-15 23:26:32 EDT
Verified on 

publican-3.0-0.fc17.t180.noarch

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