Customization layer problem. Bug?

fsteimke
Posts: 80
Joined: Tue Jan 01, 2013 3:19 pm

Customization layer problem. Bug?

Post by fsteimke »

Hy,

i would like to extend DocBook with elements from another namespace. I have created a RELAX NC grammar like this:

Code: Select all

 namespace cl = "http://osci.bremen.de/publish/codelist"
namespace db = "http://docbook.org/ns/docbook"

include "http://docbook.org/xml/5.0/rng/docbookxi.rnc" {
db.components |= cl.codeliste
}
cl.codeliste =
element cl:codeliste {
attribute title { text }
}
Then i have created a very simple book for demo purpose:

Code: Select all

 <book xmlns="http://docbook.org/ns/docbook" xmlns:xi="http://www.w3.org/2001/XInclude"    xmlns:cl="http://osci.bremen.de/publish/codelist"
xmlns:xlink="http://www.w3.org/1999/xlink" version="5.0">
<title>Test</title>
<chapter>
<title>Test</title>
<simpara>Chapter should be valid</simpara>
</chapter>
</book>
This is fine, unless i assign the schema from above via

Code: Select all

 <?xml-model href="standardcodelisten-v2.rnc" type="application/relax-ng-compact-syntax"?>
If i do, the <chapter> elemt becomes invalid. JING says:

Code: Select all

System-ID: E:\cygwin\home\osci\oscisoftware\docbook 5\framework\codelist\source\demo.xml
Haupt-Validierungsdatei: E:\cygwin\home\osci\oscisoftware\docbook 5\framework\codelist\source\demo.xml
Schema: E:\cygwin\home\osci\oscisoftware\docbook 5\framework\codelist\source\standardcodelisten-v2.rnc
Programmname: Jing
Fehlerlevel: error
Beschreibung: element "chapter" not allowed anywhere; expected the element end-tag or element "bibliography", "cl:codeliste", "glossary", "index", "info", "part", "reference", "subtitle", "titleabbrev", "toc" or "xi:include"
Anfang: 6:6
Ende: 6:13
Program version is Oxygen 14.2.

Is this a bug, or did i get something wrong?

Sincerely,
Frank
ohofrichter
Posts: 1
Joined: Tue Apr 09, 2013 12:31 pm

Re: Customization layer problem. Bug?

Post by ohofrichter »

Hi,

it's not an bug.

The problem is the redefinition of db.components instead of combination:

Code: Select all


include "http://docbook.org/xml/5.0/rng/docbookxi.rnc" {
db.components |= cl.codeliste
}
In the previous code the grammar docbookxi.rnc is is included and as part of this inclusion the element db.components is redefined.

You have to do it the following way to merge the definitions:

Code: Select all


include "http://docbook.org/xml/5.0/rng/docbookxi.rnc"

db.components |= cl.codeliste
Post Reply