XML technologies / DocBook / Customizing DocBook / Removing attributes / Removing specific attributes
(Excerpt from "DocBook-XML: Media-neutral and platform-independent publishing" by Thomas Schraitle)
To remove a specific attribute from an element, for example width from screen, proceed as follows for DocBook 4:
Procedure: Removing width from screen in DocBook 4
Identifying the element definition
In the DocBookDTD files, find the definition of the attributes ofscreen. The line looks like this:
<!ENTITY % screen.attlist "INCLUDE">
<![ %screen.attlist; [
<!ATTLIST screen
%width.attrib;
%linespecific.attrib;
%common.attrib;
%screen.role.attrib;
%local.screen.attrib;>
]]>Creating a customization file
Create a customization file and first disable the attribute definition for the elementscreen. You identified its name in the previous step, "Identifying the element definition":
<!ENTITY % screen.attlist "IGNORE"> Loading the DocBook DTD
Add the following lines to your customization file to load the DocBook DTD:
<!ENTITY % DocBookDTD PUBLIC
"-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.docbook.org/xml/4.5/docbookx.dtd">
%DocBookDTD;Redefining the attribute list
Insert the attribute definition from step 1, "Identifying the element definition", but remove the parameter entity%width.attrib;
<!ENTITY % local.screen.attrib "">
<!ATTLIST screen
%linespecific.attrib;
%common.attrib;
%screen.role.attrib;
%local.screen.attrib;>Using the customization file
Use the customization file instead of the original DocBook file (see Validating with a DocBook 4 customization file).
For DocBook 5, add the following code to your customization file:
<define name="db.screen.width.attribute">
<empty/>
</define>include "docbook.rnc" {
db.screen.width.attribute = empty
}
Copyright © 2009 Millin Verlag
You may print the online version for your private use.
Otherwise, this chapter from "DocBook-XML: Medienneutrales und plattformunabhängiges Publizieren" is subject to the same provisions as the printed edition: the work, including all its parts, is protected by copyright. All rights are reserved, including reproduction, translation, microfilming, and storage and processing in electronic systems.
Millin Verlag, Siebengebirgsring 36, 53797 Lohmar, info(at)millin.de
back to top