Browse Source

Fine tune startup (handle liaison being present but processor not in

classpath)


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@267692 13f79535-47bb-0310-9956-ffa450edef68
master
Sam Ruby 25 years ago
parent
commit
d507d57df1
3 changed files with 10 additions and 4 deletions
  1. +2
    -2
      src/main/org/apache/tools/ant/taskdefs/XSLTProcess.java
  2. +4
    -1
      src/main/org/apache/tools/ant/taskdefs/optional/XalanLiaison.java
  3. +4
    -1
      src/main/org/apache/tools/ant/taskdefs/optional/XslpLiaison.java

+ 2
- 2
src/main/org/apache/tools/ant/taskdefs/XSLTProcess.java View File

@@ -127,10 +127,10 @@ public class XSLTProcess extends MatchingTask {
if (liaison == null) { if (liaison == null) {
try { try {
setProcessor("xslp"); setProcessor("xslp");
} catch (Exception e1) {
} catch (Throwable e1) {
try { try {
setProcessor("xalan"); setProcessor("xalan");
} catch (Exception e2) {
} catch (Throwable e2) {
throw new BuildException(e2); throw new BuildException(e2);
} }
} }


+ 4
- 1
src/main/org/apache/tools/ant/taskdefs/optional/XalanLiaison.java View File

@@ -71,12 +71,15 @@ public class XalanLiaison implements XSLTLiaison {
XSLTProcessor processor; XSLTProcessor processor;
XSLTInputSource xslSheet; XSLTInputSource xslSheet;


public XalanLiaison() throws Exception {
processor = XSLTProcessorFactory.getProcessor();
}

public void setStylesheet(String fileName) throws Exception { public void setStylesheet(String fileName) throws Exception {
xslSheet = new XSLTInputSource (fileName); xslSheet = new XSLTInputSource (fileName);
}; };


public void transform(String infile, String outfile) throws Exception { public void transform(String infile, String outfile) throws Exception {
if (processor == null) processor = XSLTProcessorFactory.getProcessor();
processor.process(new XSLTInputSource(infile), xslSheet, processor.process(new XSLTInputSource(infile), xslSheet,
new XSLTResultTarget(outfile)); new XSLTResultTarget(outfile));
} }


+ 4
- 1
src/main/org/apache/tools/ant/taskdefs/optional/XslpLiaison.java View File

@@ -72,13 +72,16 @@ public class XslpLiaison implements XSLTLiaison {
XSLProcessor processor; XSLProcessor processor;
XSLStylesheet xslSheet; XSLStylesheet xslSheet;


public XslpLiaison() {
processor = new XSLProcessor();
}

public void setStylesheet(String fileName) throws Exception { public void setStylesheet(String fileName) throws Exception {
XSLReader xslReader = new XSLReader(); XSLReader xslReader = new XSLReader();
xslSheet = xslReader.read( fileName ); xslSheet = xslReader.read( fileName );
}; };


public void transform(String infile, String outfile) throws Exception { public void transform(String infile, String outfile) throws Exception {
if (processor == null) processor = new XSLProcessor();
processor.process(infile, xslSheet, new FileWriter(outfile)); processor.process(infile, xslSheet, new FileWriter(outfile));
} }




Loading…
Cancel
Save