Class PatchDocbookMojo

java.lang.Object
network.ike.docs.plugin.PatchDocbookMojo
All Implemented Interfaces:
org.apache.maven.api.plugin.Mojo

@Mojo(name="patch-docbook", defaultPhase="generate-resources") public class PatchDocbookMojo extends Object implements org.apache.maven.api.plugin.Mojo
Patch stock DocBook XSL stylesheets to suppress Saxon warnings.

Applies two targeted fixes to the downloaded DocBook XSL 1.79.2 distribution:

  1. fo/docbook.xsl — removes the direct include of ../common/utility.xsl which creates a diamond import (Saxon SXWN9019: included or imported more than once).
  2. fo/math.xsl — removes the dead <xsl:variable name="output.delims"> block that is computed but never used (Saxon SXWN9001).

Replaces: patch-docbook-xsl.sh

Usage:

mvn ike:patch-docbook -DdocbookDir=target/docbook-xsl
  • Constructor Details

    • PatchDocbookMojo

      public PatchDocbookMojo()
      Creates this goal instance.
  • Method Details

    • getLog

      protected org.apache.maven.api.plugin.Log getLog()
      Access the Maven logger.
      Returns:
      the logger
    • execute

      public void execute() throws org.apache.maven.api.plugin.MojoException
      Specified by:
      execute in interface org.apache.maven.api.plugin.Mojo
      Throws:
      org.apache.maven.api.plugin.MojoException
    • removeUtilityInclude

      public static String removeUtilityInclude(String xsl)
      Remove the <xsl:include href="../common/utility.xsl"/> line from DocBook's fo/docbook.xsl.
      Parameters:
      xsl - the XSL content
      Returns:
      patched XSL with the utility include removed
    • removeDeadVariable

      public static String removeDeadVariable(String xsl)
      Remove the dead <xsl:variable name="output.delims"> block from DocBook's fo/math.xsl.

      The variable spans multiple lines and is matched with a non-greedy pattern from the opening tag to the closing tag.

      Parameters:
      xsl - the XSL content
      Returns:
      patched XSL with the dead variable removed