Tidy and Merge Example using the docbkx plugin

The main purpose for which this plugin was written was to process the HTML output of the docbkx maven plugin to make it fit with the Doxia-generated reports without losing the DocBook formatting.

The following is a complete example of using the docbkx maven plugin to produce HTML output from DocBook source, then using the HTML Filter Site Maven plugin to tidy the results since docbkx 2.0.9 produces HTML instead of XHTML, and then merging all the files with a Velocity site template to produce documentation that looks like the Doxia reports produced by the site plugin.

<project>
  ...
  <build>
     <pluginManagement>
     <plugins>
      <plugin>
       <groupId>org.kathrynhuxtable.maven.plugins</groupId>
       <artifactId>htmlfilter-site-maven-plugin</artifactId>
       <version>0.3.4</version>
      </plugin>
     </plugins>
    </pluginManagement>
    ...
    <plugins>
      ...
     <plugin>
      <groupId>com.agilejava.docbkx</groupId>
      <artifactId>docbkx-maven-plugin</artifactId>
      <version>2.0.9</version>
      <executions>
       <execution>
        <goals>
         <goal>generate-html</goal>
        </goals>
        <phase>pre-site</phase>
       </execution>
      </executions>
      <dependencies>
       <dependency>
        <groupId>net.sf.docbook</groupId>
        <artifactId>docbook-xml</artifactId>
        <version>5.0-all</version>
        <classifier>resources</classifier>
        <type>zip</type>
        <scope>runtime</scope>
       </dependency>
      </dependencies>
      <configuration>
       <chunkedOutput>false</chunkedOutput>
       <sourceDirectory>${basedir}/src/site/docbook</sourceDirectory>
       <includes>**/*.xml,**/*.xml.vm</includes>
       <targetDirectory>${project.build.directory}/generated-site/html</targetDirectory>
       <generateMetaAbstract>0</generateMetaAbstract>
       <highlightSource>1</highlightSource>
       <highlightDefaultLanguage />
       <htmlCustomization>${basedir}/src/site/xsl/html.xsl</htmlCustomization>
       <imgSrcPath>./</imgSrcPath>
       <htmlCellSpacing>2</htmlCellSpacing>
       <htmlCellPadding>2</htmlCellPadding>
       <suppressHeaderNavigation>1</suppressHeaderNavigation>
       <suppressFooterNavigation>1</suppressFooterNavigation>
       <tableBordersWithCss>true</tableBordersWithCss>
       <tableFrameBorderThickness>0</tableFrameBorderThickness>
       <tableCellBorderThickness>0</tableCellBorderThickness>
       <targetFileExtension>html</targetFileExtension>
       <!-- use extensions -->
       <useExtensions>1</useExtensions>
       <!-- callouts -->
       <calloutsExtension>1</calloutsExtension>
      </configuration>
     </plugin>
      <plugin>
        <groupId>org.kathrynhuxtable.maven.plugins</groupId>
        <artifactId>htmlfilter-site-maven-plugin</artifactId>
        <version>0.3.4</version>
        <executions>
          <execution>
            <goals>
              <goal>tidy</goal>
               <goal>merge</goal>
           </goals>
            <phase>pre-site</phase>
          </execution>
        </executions>
        <configuration>
         <!--
             Note that docbkx removes the last four characters of the filename, presumably ".xml",
             and replaces them with ".html". If the file ends in ".xml.vm" instead, we get ".xm.html".
         -->
         <tidySourceDirectory>${project.build.directory}/generated-site/html</tidySourceDirectory>
         <tidyTargetDirectory>${project.build.directory}/generated-site/tidy</tidyTargetDirectory>
         <tidyFilePattern>**/*.html,**/*.xm.html</tidyFilePattern>

         <sourceDirectory>${project.build.directory}/generated-site/tidy</sourceDirectory>
         <filePattern>**/*.html,**/*.xm.html</filePattern>
         <filterExtension>.xm.html</filterExtension>
         <targetDirectory>${project.build.directory}/generated-site/resources</targetDirectory>
        </configuration>
      </plugin>
      ...
    </plugins>
    ...
  </build>
  ...
</project>