Search code examples
docbookoxygenxml

Including several docbook articles into a book: error with identical IDs


Having a master DocBook "book.xml", I want to include several DocBook articles, say x.xml and y.xml. (I do this by using

  <xi:include href="generated_schemata/x/x.xml"/>

Those articles x and y are generated from OxygenXML and document XSD schema (x.xsd and y.xsd). Inside the different schema, I have the same element name (say "A").

docbkx complains (and I understand why) that, while it tries to include the article x and y into book.xml for rendering a PDF, that there are multiple instances of IDs, namely for A:

Failed to execute goal com.agilejava.docbkx:docbkx-maven-plugin:2.0.17:generate-pdf (default) on project docbook: 
Failed to transform to fo: org.apache.fop.fo.ValidationException: Property ID "A" (found on "fo:block") previously used; ID values must be unique within a document!

Any idea on automated separation of those instances? Maybe by automatically adding a prefix?

(I understand, I could manually change x.xml and y.xml so that there are no conflicts; however, due to frequent changes, this is a source of errors. Or, I could change a schema specification, which is not an option).


Solution

  • Here is one recipe from Bob Stayton how modify xsl to avoid duplicate IDs in output: http://www.sagehill.net/docbookxsl/DuplicateIDs.html#ModifyIdValues