Hello. I have the following:
$ find src/ src src/main src/main/txt src/main/txt/file.txt src/main/xsl src/main/xsl/main.xsl src/main/xml src/main/xml/main.xml $ cat src/main/txt/file.txt HELLO $ cat src/main/xsl/main.xsl <?xml version="1.0" encoding="UTF-8"?> <xt:stylesheet version="2.0" xmlns="http://www.w3.org/1999/xhtml" xmlns:xt="http://www.w3.org/1999/XSL/Transform"> <xt:template match="test"> <div> <xt:apply-templates select="p"/> </div> </xt:template> <xt:template match="p"> <p><xt:value-of select="."/></p> </xt:template> </xt:stylesheet> $ cat src/main/xml/main.xml <?xml version="1.0" encoding="UTF-8"?> <test xmlns:xi="http://www.w3.org/2001/XInclude"> <p><xi:include href="src/main/txt/file.txt" parse="text"/></p> </test> I have the following POM: <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.io7m.test</groupId> <artifactId>io7m-test</artifactId> <version>1.0.0</version> <packaging>jar</packaging> <name>io7m-test</name> <description>Test package</description> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> </properties> <build> <plugins> <!-- Validate and transform XML documentation --> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>xml-maven-plugin</artifactId> <version>1.0</version> <executions> <execution> <goals> <goal>transform</goal> </goals> </execution> </executions> <configuration> <transformationSets> <transformationSet> <dir>src/main/xml</dir> <stylesheet>src/main/xsl/main.xsl</stylesheet> </transformationSet> </transformationSets> </configuration> <dependencies> <dependency> <groupId>net.sf.saxon</groupId> <artifactId>Saxon-HE</artifactId> <version>9.4</version> </dependency> </dependencies> </plugin> </plugins> </build> </project> $ mvn clean verify [INFO] Scanning for projects... [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Building io7m-test 1.0.0 [INFO] ------------------------------------------------------------------------ [INFO] [INFO] --- maven-clean-plugin:2.4.1:clean (default-clean) @ io7m-test --- [INFO] [INFO] --- xml-maven-plugin:1.0:transform (default) @ io7m-test --- [INFO] Transforming file: /home/m0/doc/dev/2012/07/xmltest/src/main/xml/main.xml [INFO] Transformed 1 file(s). [INFO] [INFO] --- maven-resources-plugin:2.5:resources (default-resources) @ io7m-test --- [debug] execute contextualize [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] skip non existing resourceDirectory /home/m0/doc/dev/2012/07/xmltest/src/main/resources [INFO] [INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ io7m-test --- [INFO] No sources to compile [INFO] [INFO] --- maven-resources-plugin:2.5:testResources (default-testResources) @ io7m-test --- [debug] execute contextualize [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] skip non existing resourceDirectory /home/m0/doc/dev/2012/07/xmltest/src/test/resources [INFO] [INFO] --- maven-compiler-plugin:2.3.2:testCompile (default-testCompile) @ io7m-test --- [INFO] No sources to compile [INFO] [INFO] --- maven-surefire-plugin:2.10:test (default-test) @ io7m-test --- [INFO] No tests to run. [INFO] Surefire report directory: /home/m0/doc/dev/2012/07/xmltest/target/surefire-reports ------------------------------------------------------- T E S T S ------------------------------------------------------- Results : Tests run: 0, Failures: 0, Errors: 0, Skipped: 0 [INFO] [INFO] --- maven-jar-plugin:2.3.2:jar (default-jar) @ io7m-test --- [WARNING] JAR will be empty - no content was marked for inclusion! [INFO] Building jar: /home/m0/doc/dev/2012/07/xmltest/target/io7m-test-1.0.0.jar [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 2.530s [INFO] Finished at: Sun Jul 15 14:29:51 GMT 2012 [INFO] Final Memory: 9M/149M [INFO] ------------------------------------------------------------------------ Then: $ cat target/generated-resources/xml/xslt/main.xml <?xml version="1.0" encoding="UTF-8"?><div xmlns="http://www.w3.org/1999/xhtml"><p/></div> At first, I wasn't sure if it was just that the transformation wasn't occuring in the directory I expected (and that the "could not open file.txt" error was being suppressed). However, having tried every possible alternate path for "file.txt" in the xi:include element, I'm convinced that XML includes are simply not happening at all. How do I tell Saxon (called from the xml plugin) to enable XIncludes? --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
