Difficulty: ★★☆ (medium)
Keywords: converting, migrating, DocBook 4, DocBook 5

Problem

You have a DocBook document in version 4.x, but you need 5.x.

Solution

Generally, the difference between version 4 and version 5 is minimal. Refer to the The Definitive Guide for detailed information what has been added, removed, or renamed.

One major change is that all DocBook 5.x elements are in the namespace http://docbook.org/ns/docbook. All these changes are taken into account by the db4-upgrade.xsl, see the URL https://github.com/docbook/docbook/blob/master/relaxng/tools/db4-upgrade.xsl. You just need to apply this stylesheet to your source DocBook document, for example:

$ xsltproc --output doc5.xml db4-upgrade.xsl doc.xml

After the migration, the file doc5.xml contains your DocBook5 source.

Discussion

One disadvantage is that entities are not preserved. This is not a stylesheet issue but an XML issue. The entities are already resolved when the XSLT processor gets its hand on the source tree. The stylesheet never sees the entities.

In cases you need to leave your entities untouched, refer to Section 3.18, “Preserving Entities”.

See Also


Project@GitHubIssue#8