Fork me on GitHub

XML Maven Plugin FAQ

General

  1. What goals does the XML Maven Plugin offer?
  2. How do I tell the plugin to use my proxy server?
  3. I have a stylesheet (a schema, another resource), which should be loaded through the class loader.
  4. The plugin doesn't work in offline mode. It always tries to resolve external resources and fails, if the network is not available.

Transformation

  1. How do I use an XSLT stylesheet for transforming files?
  2. How do I transform the names of the generated files?
  3. How do I perform other kinds of name transformations?
  4. How can I use XSLT 2.0 in my stylesheets?
  5. How do I use another XSLT processor, for example Saxon?
  6. How do I set a transformers output properties?
  7. How do I set stylesheet parameters?

Validation

  1. How do I check files for well formedness?
  2. How do I make sure, that files are matching an XML schema?

General

What goals does the XML Maven Plugin offer?

The plugin offers the xml:validate goal for validating XML files and the xml:transform goal for transforming XML files.

[top]


How do I tell the plugin to use my proxy server?

Use the standard Maven proxy settings. See the Mini guide on proxy configuration for details.

[top]


I have a stylesheet (a schema, another resource), which should be loaded through the class loader.

The plugin attempts to resolve resources through the class loader automatically. Alternatively, you can enforce using the class loader, if you specify your resource with an URI like "resource:org/foo/stylesheet.xsl".

[top]


The plugin doesn't work in offline mode. It always tries to resolve external resources and fails, if the network is not available.

You've got to download the resources in question once and store them as part of the project. A catalog file will replace the external resource with your local copy. See this example for details.

[top]

Transformation

How do I use an XSLT stylesheet for transforming files?

See this example.

[top]


How do I transform the names of the generated files?

Use a File Mapper. See this example.

[top]


How do I perform other kinds of name transformations?

Check the list of available file mappers at File Mapper. Perhaps, there is one which suits your needs.

If not, you need to implement your own. If you feel that it is sufficiently generic, then you might consider to submit it as a contribution to the Plexus IO component.

See this example for how to configure the transformer to map names.

[top]


How can I use XSLT 2.0 in my stylesheets?

You need to use an XSLT 2.0 complicant stylesheet processor like Saxon. See this example.

[top]


How do I use another XSLT processor, for example Saxon?

You need to specify your favorite XSLT processor as a dependency. See this example.

[top]


How do I set a transformers output properties?

Use the element outputProperties in the transformation set. See this example for details.

[top]


How do I set stylesheet parameters?

Use the element parameters in the transformation set. See this example for details.

[top]

Validation

How do I check files for well formedness?

See this example.

[top]


How do I make sure, that files are matching an XML schema?

See this example.

[top]