ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Robin Meade <rme...@outreach.hawaii.edu>
Subject re: does the style task classpath attribute work?
Date Sat, 03 Nov 2001 09:33:07 GMT
Mathieu,

No, neither the classpath attribute nor the classpath
sub-element work, as far as I can tell. It may be
related to this bug:

   http://nagoya.apache.org/bugzilla/show_bug.cgi?id=3934


What I found to work is the following:

Put xalan.jar, saxon.jar, and any other TrAX compliant
XSLT processors that you might want to use into
ANT_HOME/lib.

The TrAX API looks at JVM system variable

   javax.xml.transform.TransformerFactory

(if defined) for what class to use for the XSLT
transformer. See http://java.sun.com/xml/jaxp/dist/1.1/docs/api/index.html

Ant's built-in 'Property' task does not have the
capability of setting system variables. But

     buildmagic-tasks.jar

(used in the JBoss project) has a drop-in replacement
'Property' task that does have this capability.

To use it, put buildmagic-tasks.jar in your
ANT_HOME/lib directory, and add the following to your
build.xml file:

   <taskdef
     name="property"
     classname="planet57.tools.buildmagic.task.Property"
   />

Then, use it with the style task like this:

   <target name="docs">
     <!-- Force the use of SAXON XSLT -->
     <property
          system="true"
          name="javax.xml.transform.TransformerFactory"
          value="com.icl.saxon.TransformerFactoryImpl"
     />
     <style
         basedir="src"
         destdir="docs"
     	style="src/tohtml.xsl"
     >
       <include name="*.xml" />
     </style>
   </target>


To use Xalan, instead of Saxon, use:

   <!-- Force the use of XALAN XSLT -->
   <property
        system="true"
        name="javax.xml.transform.TransformerFactory"
        value="org.apache.xalan.processor.TransformerFactoryImpl"
   />


Robin Meade


 > Hi,
 >
 > I use the style task to perform XSLT tranformation. I wonder if the 
classpath
 > attribute of this task works?
 >
 > When I write for example:
 >
 >     <style basedir="${xml.dir}"
 > 	   destdir="${dest.html}"
 > 	   processor="trax"
 > 	   classpath="${common.dir}/lib/xalan.jar"	
 > 	   extension="_print.html"
 > 	   style="${stylesheet.printable}"
 > 	   includes="**/*.xml">
 > </style>
 >
 > I have the following error:
 > javax.xml.transform.TransformerFactoryConfigurationError: Provider \
 > org.apache.xalan.processor.TransformerFactoryImpl not found  ......
 >
 > It works fine when I put xalan.jar in my CLASSPATH variable. The 
common.dir
 > variable is set to the right value (I have check it with ant -debug).
 >
 > Another question: is trax really the default processor? Because when 
I don't
 > precise the processor, I have the following output:
 >
 > html_print:
 >     [style] DEPRECATED - xslp processor is deprecated. Use trax or 
xalan instead.
 >     [style] java.lang.NoClassDefFoundError: \
 > org/apache/xalan/xslt/XSLTProcessorFactory  ....
 >     [style] java.lang.NoClassDefFoundError: com/kvisco/xsl/XSLProcessor
 >     ....
 >
 > Thank you for your help.
 >
 > --
 > Mathieu Peltier
 >




--
To unsubscribe, e-mail:   <mailto:ant-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-user-help@jakarta.apache.org>


Mime
View raw message