Howto Validate AsciiDoc3 DocBook 5.1

Published: 2020-08-06

DocBook is the de-facto standard for technical documentation; AsciiDoc3 uses DocBook version 4.5 by default - and this is sufficient for many (or the most) use cases. But 4.5 is feature frozen, the current version is DocBook 5.1. If you want to use the flexibility and the more modern conception of DocBook51, AsciiDoc3 supports you - probably the only software that comes with this feature: AsciiDoc Markup → DocBook51!

To obtain a docbook51 xml document, just compute:

asciidoc3 -b docbook51 test.txt

The text.xml file should be (highly recommended) validated before further processing. That means, a tool checks if all rules of the DocBook5.1 definition written in RelaxNG and Schematron have been included. We have to go two steps with two different tools: first to ensure the Relax Schema, second, the Schematron Schema.

You find the RelaxNG Schema and the tools in your distribution
./tests/docbook_validation/rng-docbook51.rng and online:

https://gitlab.com/asciidoc3/asciidoc3/-/tree/master/tests/docbook_validation

- ...
- asciidoc3_docbook51_relaxng_validation.py
- asciidoc3_docbook51_schematron_validation.py
- ...

The tools name show its purpose. You can validate just one file or all files in a distinct directory:

python3 ./tests/docbook_validation/asciidoc3_docbook51_relaxng_validation.py path/to/docbook_file.xml

python3 ./tests/docbook_validation/asciidoc3_docbook51_relaxng_validation.py

The tools refer to the following third party tools (you don’t need all of them):

  • xmllint

  • jing

  • sun java msv

  • lxml

  • xmlstarlet

Probably the easiest to handle are xmllint and lxml - see the docstring of the tools for more inormation. You can disable a program that is not present.

Find more information about AsciiDoc3’s full support of DocBook 5.1 in your distribution ../doc/readme_docbook51.txt or read online: https://gitlab.com/asciidoc3/asciidoc3/-/blob/master/doc/readme_docbook51.txt

Keywords: AsciiDoc3 3.2.0 DocBook v5.1 Validator RelaxNG Schematron Standalone HowTo

links