Sign In/My Account | View Cart  
advertisement

Article:
 Running Multiple XSLT Engines with Ant
Subject: xslt in ant
Date: 2004-01-31 13:03:53
From: shreya Ramaswamy

Hi,


How can I use xslt in a target build file, which is compiled and run by Ant? I am trying to parse an xml file (input.xml) using an xsl file(dbconv.xsl) to produce an output xml file (output.xml). I used <xslt> in the following way:


<property name="saxon6" value="com.icl.saxon.TransformerFactoryImpl" />
<property name="saxon6.classpath" value="C:\DOWNLOAD\Saxon\saxon.jar" />


<xslt out="${build.dir}/output.xml" in="${build.bin}/input.xml" style="dbconv.xsl" processor="${saxon6}" >


However, I am getting the following error:


BUILD FAILED
file:C:/Project/project/build.xml:121: java.lang.ClassNotFoundException: com.icl.saxon.TransformerFactoryImpl


I tried all possible combinations of processors and classpaths. Even <factory> does not work. Any help would be greatly appreciated.Thanks!


Shreya


Previous Message Previous Message   Next Message No Next Message


Titles Only Titles Only Newest First
  • xslt in ant
    2004-02-07 12:30:55 shreya Ramaswamy

    Hello,


    Thank you for the answer. I tried using 'mtxslt' and followed the instructions in the article. The error is still the same:


    BUILD FAILED


    file:C:/Project/project/build.xml:142: java.lang.ClassNotFoundException: org.xmLP.ant.taskdefs.optional.Saxon6Liaison


    I have included the saxon.jar in my classpath. What could be wrong?


    Shreya


    • xslt in ant
      2004-02-08 10:08:10 Anthony Coates

      Now you need to add the 'mtxslt' JAR file to your Ant classpath. Cheers, Tony.

      • xslt in ant
        2004-02-16 12:07:56 shreya Ramaswamy

        Anthony Coates,


        Thanks.I did this and it works. However, I have a strange problem.When I remove mtxslt-1.5.jar from my classpath and specify the path explicitly in my code, it does not work for some reason. I am getting the same error:


        BUILD FAILED


        file:C:/Project/project/build.xml:142: java.lang.ClassNotFoundException: org.xmLP.ant.taskdefs.optional.Saxon6Liaison



        I have my jar files(saxon,mtxslt,xalan) in C:\test\files\ext directory; input.xml and the xsl file in C:\test\files directory.


        Here's my code:


        <property name="files.dir" value="files"/>
        <property name="files.ext" value="${files.dir}/ext"/>
        <taskdef name="mtxslt"
        classname="org.xmLP.ant.taskdefs.xslt.XSLTProcess">
        <classpath>


        <fileset dir="${files.dir}/ext">
        <include name="mtxslt-1.5.jar"/>
        </fileset>


        </classpath>
        </taskdef>


        <property name="saxon6"
        value="org.xmLP.ant.taskdefs.optional.Saxon6Liaison"/>
        <property name="saxon6.classpath" value="${files.ext}/saxon.jar"/>


        <target name="saxon6">
        <mtxslt processor="${saxon6}" in="${files.dir}/input.xml"
        style="${files.dir}/dbconv.xsl" out="output.xml"
        classpath="${saxon6.classpath}">
        <param name="target" expression="saxon"/>
        </mtxslt>

        </target>


        Any help would be appreciated.Thanks for your time.


        Shreya


  • xslt in ant
    2004-02-01 07:54:15 Anthony Coates

    Two things need to change. One, you need to use the 'mtxslt' task, not the standard Ant 'xslt' task. Also, your 'mtxslt' take would need to contain


    classpath="${saxon6.classpath}"


    Just follow the instructions in the article.
    Cheers, Tony.

    • xslt in ant
      2004-02-01 08:02:22 Anthony Coates

      Oops, I meant your mtxslt 'task', not 'take'.

      • xslt in ant
        2004-02-07 12:29:04 shreya Ramaswamy

        Hello Anthony Coates,


        Thank you for the answer. I tried using 'mtxslt' and followed the instructions in the article. The error is still the same:


        BUILD FAILED


        file:C:/Project/project/build.xml:142: java.lang.ClassNotFoundException: org.xmLP.ant.taskdefs.optional.Saxon6Liaison


        I have included the saxon.jar in my classpath. What could be wrong?


        Shreya



Sponsored By: