XML technologies / DocBook / Customizing DocBook / Changing and adding attributes / Changing an existing attribute for all elements

(Excerpt from "DocBook-XML: Media-neutral and platform-independent publishing" by Thomas Schraitle)

Suppose you are writing documentation for different computer architectures, with some chapters, sections and so on applying only to particular platforms. For this purpose, the attribute arch accepts only specific values such as x86, x86_64, powerpc and so on.

DocBook 4

The parameter entity for the attribute arch is named %arch.attrib;. Add the following line to your customization file:

<!ENTITY % arch.attrib "arch (x86|x86_64|powerpc)">

Add further entries to the list if needed.

DocBook 5

The pattern is named db.arch.attribute. Add the following line to your customization file:

<include href="docbook.rng"> 
    <define name="db.arch.attribute"> 
        <attribute name="arch"> 
            <choice> 
                <value>x86</value> 
                <value>x86_64</value> 
                <value>powerpc</value> 
            </choice> 
        </attribute> 
    </define> 
</include>

include "docbook.rnc" { 
   db.arch.attribute = 
     attribute arch { "x86" | "x86_64" | "powerpc"} 
  } 

  

back to top