Removing Attributes

Just as there may be more elements than you need, there may be more attributes.

Suppose your processing system doesn’t support continued lists. You want to remove the continuation attribute from the orderedlist element. There are two ways you could accomplish this. One way would be to redefine the db.orderedlist.continuation.attribute pattern as not allowed; the other would be to redefine the db.orderedlist.attlist pattern so that it does not include the continuation attribute. Either will accomplish the goal. Example 5-10 uses the first method.

Example 5-10. Removing continuation from orderedlist

namespace db = "http://docbook.org/ns/docbook"

include "docbook.rnc" {
   db.orderedlist.continuation.attribute = empty
}

Subsetting the Common Attributes

DocBook defines a set of common attributes, which appear on every element. Depending on how you process your documents, removing some of them can both simplify the authoring task and improve processing speed.

Some obvious candidates are:

Effectivity attributes (arch, os, condition...)

If you’re not using all of the effectivity attributes in your documents, you can get rid of up to seven attributes in one fell swoop.

xml:lang

If you’re not producing multilingual documents, you can remove xml:lang.

remap

The remap attribute is designed to hold the name of a semantically equivalent construct from a previous markup scheme (e.g., a Microsoft Word–style template name, if you’re converting from Word). If you’re authoring from scratch, or not preserving previous constructs with remap, you can get rid of it.

xreflabel

If your processing system isn’t using xreflabel, it’s a candidate as well.

The customization layer in Example 5-11 reduces the common attributes to just xml:id, version, and xml:lang.

Example 5-11. Removing common attributes

namespace db = "http://docbook.org/ns/docbook"

include "docbook.rnc" {
   db.common.base.attributes =
      db.version.attribute?
    & db.xml.lang.attribute?
}
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.14.144.108