]> granicus.if.org Git - docbook-dsssl/commitdiff
add maven sample for xml validation
authormimil <mimil@users.sourceforge.net>
Tue, 28 Jul 2009 18:59:52 +0000 (18:59 +0000)
committermimil <mimil@users.sourceforge.net>
Tue, 28 Jul 2009 18:59:52 +0000 (18:59 +0000)
maven/docbook-sample/pom.xml

index 93793d0ffb9e1c2e5b09704d612c13ddab019b8c..2c1491cc1220bddc5515d123a20b349827999553 100644 (file)
       <type>zip</type>
       <classifier>ns-resources</classifier>
     </dependency>
+    <dependency>
+      <groupId>net.sf.docbook</groupId>
+      <artifactId>docbook-xml</artifactId>
+      <version>5.0-all</version>
+      <type>zip</type>
+      <classifier>resources</classifier>
+    </dependency>
   </dependencies>
 
-  <build>
-    <plugins>
-      <!--
-        First we need to extract the stylesheets 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>
+  <profiles>
+    <profile>
+      <id>transformation</id>
+      <build>
+        <plugins>
+          <!--
+            First we need to extract the stylesheets 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-xsl</includeArtifactIds>
+                  <includeClassifiers>ns-resources</includeClassifiers>
+                  <excludeTransitive>true</excludeTransitive>
+                </configuration>
+              </execution>
+            </executions>
+          </plugin>
+          <!--
+            Then use the xslt engine
+          -->
+          <plugin>
+            <groupId>org.codehaus.mojo</groupId>
+            <artifactId>xml-maven-plugin</artifactId>
+            <version>1.0-beta-2</version>
+            <executions>
+              <execution>
+                <goals>
+                  <goal>transform</goal>
+                </goals>
+                <!-- linked with generate-resources phase -->
+                <phase>generate-resources</phase>
+              </execution>
+            </executions>
+            <configuration>
+
+              <!-- transformationSets are used for the goal transform -->
+              <transformationSets>
+                <transformationSet>
+                  <!-- select the xml files to transform using dir and includes -->
+                  <dir>src/main/docbook/</dir>
+                  <includes>
+                    <include>sample.xml</include>
+                  </includes>
+                  <!-- the stylesheet is located in the previously extracted directory under the docbook/ directory -->
+                  <stylesheet>${project.build.directory}/generated-resources/docbook/html/docbook.xsl</stylesheet>
+                  <!-- rename the file with a proper extension -->
+                  <fileMappers>
+                    <fileMapper implementation="org.codehaus.plexus.components.io.filemappers.FileExtensionMapper">
+                      <targetExtension>.html</targetExtension>
+                    </fileMapper>
+                  </fileMappers>
+                  <!-- specify the transformed file directory -->
+                  <outputDir>${project.build.directory}/docbook</outputDir>
+                  <!-- set some stylesheet parameters -->
+                  <parameters>
+                    <parameter>
+                      <name>draft.mode</name>
+                      <value>yes</value>
+                    </parameter>
+                  </parameters>
+                </transformationSet>
+              </transformationSets>
+            </configuration>
+            <dependencies>
+              <dependency>
+                <groupId>net.sf.docbook</groupId>
+                <artifactId>docbook-xsl-saxon</artifactId>
+                <version>1.0.0</version>
+              </dependency>
+            </dependencies>
+          </plugin>
+        </plugins>
+      </build>
+    </profile>
+
+
+    <profile>
+      <id>validation</id>
+      <build>
+        <plugins>
+          <!--
+            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>
+          <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>
-              <outputDirectory>${project.build.directory}/generated-resources</outputDirectory>
-              <includeGroupIds>net.sf.docbook</includeGroupIds>
-              <includeArtifactIds>docbook-xsl</includeArtifactIds>
-              <includeClassifiers>ns-resources</includeClassifiers>
-              <excludeTransitive>true</excludeTransitive>
+              <!-- 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>
-          </execution>
-        </executions>
-      </plugin>
-      <!--
-        Then use the xslt engine
-      -->
-      <plugin>
-        <groupId>org.codehaus.mojo</groupId>
-        <artifactId>xml-maven-plugin</artifactId>
-        <version>1.0-beta-2</version>
-        <executions>
-          <execution>
-            <goals>
-              <goal>transform</goal>
-            </goals>
-            <!-- linked with generate-resources phase -->
-            <phase>generate-resources</phase>
-          </execution>
-        </executions>
-        <configuration>
-          <transformationSets>
-            <transformationSet>
-              <!-- select the xml files to transform using dir and includes -->
-              <dir>src/main/docbook/</dir>
-              <includes>
-                <include>sample.xml</include>
-              </includes>
-              <!-- the stylesheet is located in the previously extracted directory under the docbook/ directory -->
-              <stylesheet>${project.build.directory}/generated-resources/docbook/html/docbook.xsl</stylesheet>
-              <!-- rename the file with a proper extension -->
-              <fileMappers>
-                <fileMapper implementation="org.codehaus.plexus.components.io.filemappers.FileExtensionMapper">
-                  <targetExtension>.html</targetExtension>
-                </fileMapper>
-              </fileMappers>
-              <!-- specify the transformed file directory -->
-              <outputDir>${project.build.directory}/docbook</outputDir>
-              <!-- set some stylesheet parameters -->
-              <parameters>
-                <parameter>
-                  <name>draft.mode</name>
-                  <value>yes</value>
-                </parameter>
-              </parameters>
-            </transformationSet>
-          </transformationSets>
-        </configuration>
-        <dependencies>
-          <dependency>
-            <groupId>net.sf.docbook</groupId>
-            <artifactId>docbook-xsl-saxon</artifactId>
-            <version>1.0.0</version>
-          </dependency>
-        </dependencies>
-      </plugin>
-    </plugins>
-  </build>
+          </plugin>
+        </plugins>
+      </build>
+    </profile>
+  </profiles>
 </project>