XML technologies / DocBook / Conditional elements (profiling) / Profiling and validation

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

Validation can take place at two stages:

Before profiling

Validate the original document. It is recommended to make it valid. With a customized DocBook schema, some constructs may not be allowed.

After profiling

Validate the variant, the filtered document. It must be valid because subsequent steps rely on it.

Keep these points in mind when profiling:

IDs (id or xml:id)

Identifiers must be unique throughout the document. Duplicate IDs cause validation errors. Create only one element with the desired ID and add profiling attributes inside the content.

Titles

Since duplicate titles are invalid in DocBook, use inside title the element phrase and add the corresponding profiling attributes there.

Nesting

Profiling attributes at different structural levels increase complexity. Test the combinations to ensure every variant is valid. Reduce nesting depth where possible.

Index ranges

An index range has a start and end (see Index ranges). If profiling removes either endpoint, the range is invalid. The simplest solution is to use ordinary index entries instead. Otherwise, test the different combinations.

To validate the profiling result, first perform profiling as described in Two-pass profiling. Validate the resulting DocBook document with your XML parser.

  

back to top