[
http://jira.codehaus.org/browse/MOJO-777?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_94896
]
Aleksei Valikov commented on MOJO-777:
--------------------------------------
Yes, I did.
No, it does not.
Simply including Saxon into plugin dependencies DOES NOT guarantee that it will
be used as the transformer factory.
Given the stylesheet:
{code}<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output indent="yes"/>
<xsl:template match="/">
<root>
<vendor><xsl:value-of
select="system-property('xsl:vendor')"/></vendor>
<vendor-url><xsl:value-of
select="system-property('xsl:vendor-url')"/></vendor-url>
<version><xsl:value-of
select="system-property('xsl:version')"/></version>
</root>
</xsl:template>
</xsl:stylesheet>{code}
If I use it with the following plugin config
{code} <plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>xml-maven-plugin</artifactId>
<version>1.0-beta-2-SNAPSHOT</version>
<executions>
<execution>
<goals>
<goal>transform</goal>
</goals>
</execution>
</executions>
<configuration>
<!--transformerFactory>net.sf.saxon.TransformerFactoryImpl</transformerFactory-->
<transformationSets>
<transformationSet>
<dir>xml</dir>
<stylesheet>it7.xsl</stylesheet>
</transformationSet>
</transformationSets>
</configuration>
<dependencies>
<dependency>
<groupId>net.sf.saxon</groupId>
<artifactId>saxon</artifactId>
<version>8.9</version>
</dependency>
</dependencies>
</plugin>{code}
I get:
{code}<?xml version="1.0" encoding="UTF-8"?>
<root>
<vendor>Apache Software Foundation (Xalan XSLTC)</vendor>
<vendor-url>http://xml.apache.org/xalan-j</vendor-url>
<version>1.0</version>
</root>{code}
If I do
{code} <plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>xml-maven-plugin</artifactId>
<version>1.0-beta-2-SNAPSHOT</version>
<executions>
<execution>
<goals>
<goal>transform</goal>
</goals>
</execution>
</executions>
<configuration>
<transformerFactory>net.sf.saxon.TransformerFactoryImpl</transformerFactory>
<transformationSets>
<transformationSet>
<dir>xml</dir>
<stylesheet>it7.xsl</stylesheet>
</transformationSet>
</transformationSets>
</configuration>
<dependencies>
<dependency>
<groupId>net.sf.saxon</groupId>
<artifactId>saxon</artifactId>
<version>8.9</version>
</dependency>
</dependencies>
</plugin>{code}
(this is the patched plugin already)
I get
{code}<?xml version="1.0" encoding="UTF-8"?>
<root>
<vendor>SAXON 8.9 from Saxonica</vendor>
<vendor-url>http://www.saxonica.com/</vendor-url>
<version>2.0</version>
</root>{code}
So there is the difference.
See also my reasoning.
> Allow specifying concrete imlementation of the TransformerFactory
> -----------------------------------------------------------------
>
> Key: MOJO-777
> URL: http://jira.codehaus.org/browse/MOJO-777
> Project: Mojo
> Issue Type: New Feature
> Components: xml
> Reporter: Aleksei Valikov
> Assignee: Jochen Wiedmann
> Attachments: xml-maven-plugin.patch
>
>
> Currently, when retrieving the instance of TransformerFactory, the plugin
> relies on the standard JAXP mechanism.
> Unfortunately, this mechanism is unpredictable in many environments.
> Let's see the docs on TransformerFactory.newInstance():
> * Use the javax.xml.transform.TransformerFactory system property.
> * Use the properties file "lib/jaxp.properties" in the JRE directory. This
> configuration file is in standard java.util.Properties format and contains
> the fully qualified name of the implementation class with the key being the
> system property defined above. The jaxp.properties file is read only once by
> the JAXP implementation and it's values are then cached for future use. If
> the file does not exist when the first attempt is made to read from it, no
> further attempts are made to check for its existence. It is not possible to
> change the value of any property in jaxp.properties after it has been read
> for the first time.
> * Use the Services API (as detailed in the JAR specification), if available,
> to determine the classname. The Services API will look for a classname in the
> file META-INF/services/javax.xml.transform.TransformerFactory in jars
> available to the runtime.
> * Platform default TransformerFactory instance.
> Number 1 is allright.
> Number 2 is user environment dependent.
> Number 3 is unpredictable. There can be several JARs in the classpath
> defining the META-INF/services/javax.xml.transform.TransformerFactory
> resource file. In this case which factory will be instantiated is not
> predictable and depends on the order of the JARs in the classpath.
> Number 3 is allright.
> So numbers 2 and 3 introduce undeterministic behaviour. Some of my builds
> suffered from this unpredictability: I tried to use Saxon 8.x as the
> processor in my builds. Sometimes Xalan was used, sometimes Saxon - and there
> was no way for me to specify the exact processor to be used.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe from this list please visit:
http://xircles.codehaus.org/manage_email