Maven artifacts containing the XSL Schemas (XSD, RNG ...).

Description

The namespaced stylesheets (used for docbook 5) can be used with:

<dependency>
  <groupId>net.sf.docbook</groupId>
  <artifactId>docbook-xml</artifactId>
  <version>5.0-all</version>
  <type>zip</type>
  <classifier>resources</classifier>
</dependency>

This artifact contains most of the content of the regular docbook release you can download except that the root directory is docbook/ for ease of version migration. Here is the content of docbook/ of this artifact:

<DIR>          dtd
<DIR>          rng
<DIR>          sch
<DIR>          tools
<DIR>          xsd
         3 287 catalog.xml
        46 419 ChangeLog
           430 docbook.nvdl
         1 182 README
             4 VERSION

Common usage

A common usage of these artifacts is extracting it in a temporary directory and using it for XML validation, this can be done as the following:

          <!--
            First we need to extract the xml schemas somewhere
          -->
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-dependency-plugin</artifactId>
            <executions>
              <execution>
                <id>unpack-shared-resources</id>
                <goals>
                  <goal>unpack-dependencies</goal>
                </goals>
                <!-- linked with generate-resources phase -->
                <phase>generate-resources</phase>
                <configuration>
                  <outputDirectory>${project.build.directory}/generated-resources</outputDirectory>
                  <includeGroupIds>net.sf.docbook</includeGroupIds>
                  <includeArtifactIds>docbook-xml</includeArtifactIds>
                  <includeClassifiers>resources</includeClassifiers>
                  <excludeTransitive>true</excludeTransitive>
                </configuration>
              </execution>
            </executions>
          </plugin>

Then use xml plugin to validate against the docbook schema, this can be done as the following:

          <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>xml-maven-plugin</artifactId>
            <version>1.0-beta-2</version>
            <executions>
              <execution>
                <goals>
                  <goal>validate</goal>
                </goals>
                <!-- linked with generate-resources phase -->
                <phase>generate-resources</phase>
              </execution>
            </executions>
            <configuration>
              <!-- validationSets are used for the goal validate -->
              <validationSets>
                <validationSet>
                  <dir>src/main/docbook/</dir>
                  <systemId>${project.build.directory}/generated-resources/docbook/xsd/docbook.xsd</systemId>
                </validationSet>
              </validationSets>
            </configuration>
          </plugin>

A complete example can be find in the svn at http://docbook.svn.sourceforge.net/viewvc/docbook/trunk/maven/docbook-sample/

MavenDocBook (last edited 2011-03-17 13:10:21 by NormanWalsh)