Fork me on GitHub

Change the extension of the generated files

The following configuration snippet would transform all files in the directory src/main/xml by applying the stylesheet src/main/stylesheet.xsl. The created files would have the extension .fo, rather than .xml.

<build>
  <plugins>
    ...
    <plugin>
      <groupId>org.codehaus.mojo</groupId>
      <artifactId>xml-maven-plugin</artifactId>
      <executions>
        <execution>
          <goals>
            <goal>transform</goal>
          </goals>
        </execution>
      </executions>
      <configuration>
        <transformationSets>
          <transformationSet>
            <dir>src/main/xml</dir>
            <stylesheet>src/main/stylesheet.xsl</stylesheet>
            <fileMappers>
              <fileMapper implementation="org.codehaus.plexus.components.io.filemappers.FileExtensionMapper">
                <targetExtension>.fo</targetExtension>
              </fileMapper>
            </fileMappers>
          </transformationSet>
        </transformationSets>
      </configuration>
    </plugin>
    ...
  </plugins>
</build>

Btw, the same could be achieved the much more powerful and generic RegExpFileMapper, which you find explained in more detail in another example.