Customization of the DocBook tree

If you want to manipulate the resulting DocBook, you can create groovy scripts for certain elements, e.g. to replace the info section of an article element write a script named article.groovy. When executing herold use the command line argument --docbook-script-path to point to the directory which contains your script. Here is an example:

herold --in=Article.html --out=Article.xml --docbook-script-path=./scripts/docbook

The groovy script article.groovy

import javax.xml.xpath.*
import org.dbdoclet.trafo.tag.docbook.DocBookTagFactory

println "Customizing element article..."

def xpath = XPathFactory.newInstance().newXPath()

def nodes = xpath.evaluate( './info', node, XPathConstants.NODESET )

nodes.each { 
  node.removeChild(it);
}

DocBookTagFactory dbf = new DocBookTagFactory()
node.insertChild(0, dbf.createInfo().appendChild(dbf.createTitle("Customized title")))