summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorKelly Campbell <kellyc@apache.org>2001-01-16 08:00:50 +0000
committerKelly Campbell <kellyc@apache.org>2001-01-16 08:00:50 +0000
commit8aa012856f348eb5138de60634712b7460420ad6 (patch)
tree54cbde32ed2063e840aabe1e30adcdbaf41a5d41 /lib
parent20a349e18a7acd5d1f2affd0eded7bb20ed43bb0 (diff)
downloadxmlgraphics-fop-8aa012856f348eb5138de60634712b7460420ad6.tar.gz
xmlgraphics-fop-8aa012856f348eb5138de60634712b7460420ad6.zip
Packaged build tasks into lib/buildtools.jar
Added buildtools.xml for building the build tools jar file. Moved source for ant tasks into src/org/apache/fop/tools/anttasks Set up dual support for Xalan 1 native and Xalan 2 JAXP1.1 transform interfaces. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@193970 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'lib')
-rw-r--r--lib/buildtools.jarbin0 -> 32598 bytes
-rw-r--r--lib/org/apache/fop/tools/anttasks/TraxTransform.classbin2552 -> 0 bytes
-rw-r--r--lib/org/apache/fop/tools/anttasks/TraxTransform.java143
-rw-r--r--lib/org/apache/fop/tools/anttasks/Xalan1Transform.classbin2733 -> 0 bytes
-rw-r--r--lib/org/apache/fop/tools/anttasks/Xalan1Transform.java138
-rw-r--r--lib/org/apache/fop/tools/anttasks/Xslt.classbin4692 -> 0 bytes
-rw-r--r--lib/org/apache/fop/tools/anttasks/Xslt.java356
7 files changed, 0 insertions, 637 deletions
diff --git a/lib/buildtools.jar b/lib/buildtools.jar
new file mode 100644
index 000000000..5169b943a
--- /dev/null
+++ b/lib/buildtools.jar
Binary files differ
diff --git a/lib/org/apache/fop/tools/anttasks/TraxTransform.class b/lib/org/apache/fop/tools/anttasks/TraxTransform.class
deleted file mode 100644
index 0f5278c78..000000000
--- a/lib/org/apache/fop/tools/anttasks/TraxTransform.class
+++ /dev/null
Binary files differ
diff --git a/lib/org/apache/fop/tools/anttasks/TraxTransform.java b/lib/org/apache/fop/tools/anttasks/TraxTransform.java
deleted file mode 100644
index dc9710796..000000000
--- a/lib/org/apache/fop/tools/anttasks/TraxTransform.java
+++ /dev/null
@@ -1,143 +0,0 @@
-/*
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 1999 The Apache Software Foundation. All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. The end-user documentation included with the redistribution, if
- * any, must include the following acknowlegement:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowlegement may appear in the software itself,
- * if and wherever such third-party acknowlegements normally appear.
- *
- * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
- * Foundation" must not be used to endorse or promote products derived
- * from this software without prior written permission. For written
- * permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache"
- * nor may "Apache" appear in their names without prior written
- * permission of the Apache Group.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- */
-
-package org.apache.fop.tools.anttasks;
-
-import javax.xml.transform.*;
-
-import java.io.FileInputStream;
-import java.util.Hashtable;
-import org.w3c.dom.Document;
-
-/**
- * Handles xslt tranformations via Trax (xalan2)
- */
-
-public class TraxTransform
-{
- /** Cache of compiled stylesheets (filename, StylesheetRoot) */
- private static Hashtable _stylesheetCache = new Hashtable();
-
- public static Transformer getTransformer(String xsltFilename)
- {
- try {
- if (_stylesheetCache.containsKey(xsltFilename)) {
- Templates cachedStylesheet = (Templates)_stylesheetCache.get(xsltFilename);
- return cachedStylesheet.newTransformer();
- }
-
- Source xslSheet =
- new javax.xml.transform.stream.StreamSource (xsltFilename);
-
-
- System.out.println("****************************");
- System.out.println("trax compile \nin: " + xsltFilename);
- System.out.println("****************************");
-
- TransformerFactory factory = TransformerFactory.newInstance();
-
- Templates compiledSheet =
- factory.newTemplates(xslSheet);
-
- _stylesheetCache.put(xsltFilename, compiledSheet);
- return compiledSheet.newTransformer();
- }
- catch (TransformerConfigurationException ex) {
- ex.printStackTrace();
- }
- return null;
-
- }
-
- public static void transform(String xmlSource, String xslURL,
- String outputFile)
- {
- transform(new javax.xml.transform.stream.StreamSource(xmlSource),
- new javax.xml.transform.stream.StreamSource(xslURL),
- new javax.xml.transform.stream.StreamResult(outputFile));
- }
-
- public static void transform(Document xmlSource, String xslURL,
- String outputFile)
- {
-
- transform(new javax.xml.transform.dom.DOMSource(xmlSource),
- new javax.xml.transform.stream.StreamSource(xslURL),
- new javax.xml.transform.stream.StreamResult(outputFile));
-
- }
-
- public static void transform(Source xmlSource, Source xslSource, Result result)
- {
- try {
- Transformer transformer;
- if (xslSource.getSystemId() == null) {
- TransformerFactory factory = TransformerFactory.newInstance();
- transformer = factory.newTransformer(xslSource);
- }
- else {
- transformer = getTransformer(xslSource.getSystemId());
- }
- transformer.transform(xmlSource, result);
- }
- catch (TransformerConfigurationException ex) {
- ex.printStackTrace();
- }
- catch (TransformerException ex) {
- ex.printStackTrace();
- }
-
- }
-
-}
diff --git a/lib/org/apache/fop/tools/anttasks/Xalan1Transform.class b/lib/org/apache/fop/tools/anttasks/Xalan1Transform.class
deleted file mode 100644
index d7e693e8b..000000000
--- a/lib/org/apache/fop/tools/anttasks/Xalan1Transform.class
+++ /dev/null
Binary files differ
diff --git a/lib/org/apache/fop/tools/anttasks/Xalan1Transform.java b/lib/org/apache/fop/tools/anttasks/Xalan1Transform.java
deleted file mode 100644
index c2a6cef18..000000000
--- a/lib/org/apache/fop/tools/anttasks/Xalan1Transform.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 1999 The Apache Software Foundation. All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. The end-user documentation included with the redistribution, if
- * any, must include the following acknowlegement:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowlegement may appear in the software itself,
- * if and wherever such third-party acknowlegements normally appear.
- *
- * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
- * Foundation" must not be used to endorse or promote products derived
- * from this software without prior written permission. For written
- * permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache"
- * nor may "Apache" appear in their names without prior written
- * permission of the Apache Group.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- */
-
-package org.apache.fop.tools.anttasks;
-
-import org.apache.xalan.xslt.*;
-
-import java.io.FileInputStream;
-import java.util.Hashtable;
-import org.w3c.dom.Document;
-
-/**
- * Handles xslt tranformations via Xalan1 (non-trax)
- */
-
-public class Xalan1Transform
-{
- /** Cache of compiled stylesheets (filename, StylesheetRoot) */
- private static Hashtable _stylesheetCache = new Hashtable();
-
- public static StylesheetRoot getStylesheet(String xsltFilename)
- throws org.xml.sax.SAXException
- {
- if (_stylesheetCache.containsKey(xsltFilename)) {
- return (StylesheetRoot)_stylesheetCache.get(xsltFilename);
- }
-
- // Use XSLTProcessor to instantiate an XSLTProcessor.
- org.apache.xalan.xslt.XSLTProcessor processor =
- org.apache.xalan.xslt.XSLTProcessorFactory.getProcessor
- (new org.apache.xalan.xpath.xdom.XercesLiaison());
-
-
- org.apache.xalan.xslt.XSLTInputSource xslSheet =
- new org.apache.xalan.xslt.XSLTInputSource (xsltFilename);
-
- // Perform the transformation.
- System.out.println("****************************");
- System.out.println("new xslt compile \nin: " + xsltFilename);
- System.out.println("****************************");
-
- StylesheetRoot compiledSheet =
- processor.processStylesheet(xslSheet);
-
- _stylesheetCache.put(xsltFilename, compiledSheet);
- return compiledSheet;
- }
-
- public static void transform(String xmlSource, String xslURL,
- String outputFile)
- throws java.io.IOException,
- java.net.MalformedURLException,
- org.xml.sax.SAXException
- {
- try {
- javax.xml.parsers.DocumentBuilder docBuilder =
- javax.xml.parsers.DocumentBuilderFactory.newInstance().
- newDocumentBuilder();
- Document doc = docBuilder.parse(new FileInputStream(xmlSource));
- transform(doc,xslURL,outputFile);
- }
- catch (javax.xml.parsers.ParserConfigurationException ex){
- throw new org.xml.sax.SAXException(ex);
- }
-
- }
-
- public static void transform(Document xmlSource, String xslURL,
- String outputFile) throws java.io.IOException,
- java.net.MalformedURLException, org.xml.sax.SAXException
- {
- // Create the 3 objects the XSLTProcessor needs to perform the transformation.
- org.apache.xalan.xslt.XSLTInputSource source =
- new org.apache.xalan.xslt.XSLTInputSource (xmlSource);
- org.apache.xalan.xslt.XSLTResultTarget xmlResult =
- new org.apache.xalan.xslt.XSLTResultTarget (outputFile);
-
- StylesheetRoot stylesheet = getStylesheet(xslURL);
-
- // Perform the transformation.
- stylesheet.process(XSLTProcessorFactory.getProcessor
- (new org.apache.xalan.xpath.xdom.XercesLiaison()),
- xmlSource, xmlResult);
- }
-
-
-}
diff --git a/lib/org/apache/fop/tools/anttasks/Xslt.class b/lib/org/apache/fop/tools/anttasks/Xslt.class
deleted file mode 100644
index 2c223a664..000000000
--- a/lib/org/apache/fop/tools/anttasks/Xslt.class
+++ /dev/null
Binary files differ
diff --git a/lib/org/apache/fop/tools/anttasks/Xslt.java b/lib/org/apache/fop/tools/anttasks/Xslt.java
deleted file mode 100644
index d7444dd6e..000000000
--- a/lib/org/apache/fop/tools/anttasks/Xslt.java
+++ /dev/null
@@ -1,356 +0,0 @@
-/*
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 1999 The Apache Software Foundation. All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. The end-user documentation included with the redistribution, if
- * any, must include the following acknowlegement:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowlegement may appear in the software itself,
- * if and wherever such third-party acknowlegements normally appear.
- *
- * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
- * Foundation" must not be used to endorse or promote products derived
- * from this software without prior written permission. For written
- * permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache"
- * nor may "Apache" appear in their names without prior written
- * permission of the Apache Group.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- */
-
-package org.apache.fop.tools.anttasks;
-
-import org.apache.tools.ant.Task;
-import java.net.*;
-import java.io.*;
-import java.util.*;
-//import org.apache.xalan.xslt.*;
-import org.w3c.dom.*;
-import org.xml.sax.SAXException;
-
-
-
-/**
- * Task to call the XSLT processor Xalan (part of xml.apache.org), which converts xml files
- * from a source to an output using a stylesheet file
- *
- * <p>
- * This task can take the following arguments:
- * <ul>
- * <li>infile
- * <li>xsltfile
- * <li>outfile
- * <li>mergefile
- * <li>smart
- * <li>dependent
- * </ul>
- * <p>
- * Of these arguments, <b>infile, outfile</b> and <b>xsltfile</b> are required.
- * <p>smart defaults to 'no'. The other allowed value is 'yes'. If smart is set to 'yes'
- * <P>
- * xalan is only called if either the outfile is older than the infile or the stylesheet
- * or the outfile doesn't exist.
- * <P>
- * <p>dependent defaults to 'none'. Other possible values: a comma delimited list of file names
- * which date is checked against the output file. This way you can name files which, if
- * they have been modified, initiate a restart of the xslt process, like external entities etc.
- * <p>
- * The mergefile parameter causes this task to merge the contents of the specified file into the infile at the end. This is used for the font character mapping generation because the keys() xslt function doesn't work on an external document.
- *
- * @author Fotis Jannidis <a href="mailto:fotis@jannidis.de">fotis@jannidis.de</a>
- * @author Kelly A. Campbell <a href="mailto:camk@camk.net">camk@camk.net</a>
- */
-
-
-public class Xslt extends Task {
- private String infile, outfile, xsltfile, mergefile;
- private String smart = "no"; //defaults to do conversion everytime task is called
- private String dependent = "none"; //defaults to no dependencies
- private boolean startXslt = false;
-
- /** When true, we use the trax api's from xalan2, otherwise
- * just the xalan1 native interfaces
- */
- private boolean useTrax = false;
-
-
- /**
- * Sets the input file
- *
- */
- public void setInfile (String infile) {
- this.infile = infile;
- }
-
- public void setMergefile (String mergefile) {
- this.mergefile = mergefile;
- }
-
- /**
- * Sets the stylesheet file
- *
- */
- public void setXsltfile (String xsltfile) {
- this.xsltfile = xsltfile;
- }
-
- /**
- * Sets the output file
- *
- */
- public void setOutfile (String outfile) {
- this.outfile = outfile;
- }
-
- /**
- * Sets the value for smart
- *
- * @param option valid values:
- * <ul>
- * <li>yes: check whether output file is older than input or stylesheet
- * <li>no: (default) do conversion everytime task is called
- * </ul>
- */
- public void setSmart (String smart) {
- this.smart = smart;
- }
-
- /**
- * Sets the value for dependent
- *
- * @param option valid values:
- * <ul>
- * <li>none: (default)
- * <li>comma delimited list of files whose existence and date is checked
- * against the output file
- * </ul>
- */
- public void setDependent (String dependent) {
- this.dependent = dependent;
- }
-
-
- /**
- * Builds a document from the given file, merging the mergefile onto the end of the root node
- */
- private org.w3c.dom.Document buildDocument(String xmlFile)
- throws IOException, SAXException {
- try {
-
- javax.xml.parsers.DocumentBuilder docBuilder =
- javax.xml.parsers.DocumentBuilderFactory.newInstance().
- newDocumentBuilder();
- Document doc = docBuilder.parse(new FileInputStream(xmlFile));
-
- if (mergefile != null && !mergefile.equals("")) {
-
- File mergefileF = new File(mergefile);
-
- Document mergedoc =
- docBuilder.parse(new FileInputStream(mergefileF));
- Node mergenode =
- doc.importNode(mergedoc.getDocumentElement(), true);
- doc.getDocumentElement().appendChild(mergenode);
- }
-
- return doc;
- } catch (javax.xml.parsers.ParserConfigurationException e) {
- System.out.println("Task xslt - SAX ERROR:\n " +
- e.getMessage());
- }
- return null;
- }
-
-
- /**
- * Calls Xalan and does the transformation
- *
- */
- private void transform() {
- try {
- org.w3c.dom.Document source = buildDocument(infile);
- // Perform the transformation.
- System.out.println("============================");
- System.out.println("new xslt \nin: " + infile + "\nstyle: " +
- xsltfile + "\nout: " + outfile);
- System.out.println("============================");
-
- if (isTraxAvailable()) {
- TraxTransform.transform(source, xsltfile, outfile);
- }
- else {
- Xalan1Transform.transform(source, xsltfile, outfile);
- }
- } catch (org.xml.sax.SAXException saxerror) {
- System.out.println("Task xslt - SAX ERROR:\n " + saxerror);
- }
- catch (MalformedURLException urlerror) {
- System.out.println("Task xslt - URL ERROR:\n " + urlerror);
- }
- catch (IOException ioerror) {
- System.out.println("Task xslt - IO ERROR:\n " + ioerror);
- }
-
- } //end transform
-
- private boolean isTraxAvailable()
- {
- try {
- // check for trax
- Class transformer = Class.forName("javax.xml.transform.Transformer");
- if (transformer != null) {
- return true;
- }
- }
- catch (ClassNotFoundException ex){
- return false;
- }
- return false;
- }
-
- /**
- * Checks for existence of output file and compares
- * dates with input and stylesheet file
- */
- private boolean smartCheck (File outfileF,
- long outfileLastModified, File infileF, File xsltfileF) {
-
- if (outfileF.exists()) {
- //checks whether output file is older than input file or xslt stylesheet file
- if ((outfileLastModified < infileF.lastModified()) |
- (outfileLastModified < xsltfileF.lastModified())) {
- return true;
- }
- } else {
- //if output file does not exist, start xslt process
- return true;
- }
- return false;
- } //end smartCheck
-
- /**
- * Checks for existence and date of dependent files
- * This could be folded together with smartCheck by using
- * a general routine but it wouldn't be as fast as now
- */
- private boolean dependenciesCheck(File outfileF,
- long outfileLastModified) {
- String dependentFileName;
- File dependentFile;
- StringTokenizer tokens = new StringTokenizer(dependent, ",");
- while (tokens.hasMoreTokens()) {
- dependentFileName = (String) tokens.nextToken();
- dependentFile = new File (dependentFileName);
- //check: does dependent file exist
- if (dependentFile.exists()) {
- //check dates
- if ((outfileLastModified < dependentFile.lastModified())) {
- return true;
- }
- } else {
- System.err.println(
- "Task xslt - ERROR in attribute 'dependent':\n file " +
- dependentFileName + " does not exist.");
- }
- }
- return false;
- } //end dependenciesCheck
-
- /**
- * Main method, which is called by ant.
- * Checks for the value of smart and calls startTransform accordingly
- */
- public void execute () throws org.apache.tools.ant.BuildException {
-
- File outfileF = new File (outfile);
- File infileF = new File(infile);
- File xsltfileF = new File (xsltfile);
- long outfileLastModified = outfileF.lastModified();
- boolean startFileExist = true;
-
- //checks whether input and stylesheet exist.
- //this could be left to the parser, but this solution does make problems if smart is set to yes
- if (!infileF.exists()) {
- System.err.println(
- "Task xslt - ERROR:\n Input file " + infile +
- " does not exist!");
- startFileExist = false;
- } else if (!xsltfileF.exists()) {
- System.err.println(
- "Task xslt - ERROR:\n Stylesheet file " +
- xsltfile + " does not exist!");
- startFileExist = false;
- }
-
- //checks attribute 'smart'
- if (smart.equals("no")) {
- startXslt = true;
- //if attribute smart = 'yes'
- } else if (smart.equals("yes")) {
- startXslt = smartCheck (outfileF, outfileLastModified,
- infileF, xsltfileF);
- //checks dependent files against output file, makes only sense if smartCheck returns false
- if (!dependent.equals("none") & (startXslt == false)) {
- startXslt =
- dependenciesCheck(outfileF, outfileLastModified);
- }
- //returns error message, if smart has another value as 'yes' or 'no'
- } else {
- System.err.println("Task xslt - ERROR: Allowed values for the attribute smart are 'yes' or 'no'");
- }
- if (startFileExist & startXslt) {
- transform();
- }
- } //end execute
-
- //quick access for debugging
- //usage XSLT infile xsltfile outfile (smart is 'yes')
- /*
- public static void main (String args[]) {
- Xslt xslt = new Xslt();
- xslt.setInfile(args[0]);
- xslt.setXsltfile(args[1]);
- xslt.setOutfile(args[2]);
- xslt.setSmart("yes");
- xslt.setDependent("test1,test2");
- xslt.execute();
-} */
-
-
-
-
-}