Commit 87ff2108 authored by Fabien Triolet's avatar Fabien Triolet
Browse files

Changed the way to read a stylesheet in TTransformation.

parent b33025c2
/** /**
* $Id: TMain.java,v 1.1 2002-11-06 14:08:21 serge Exp $ * $Id: TMain.java,v 1.2 2003-01-07 08:13:59 triolet Exp $
* *
* Transmorpher * Transmorpher
* *
...@@ -53,7 +53,6 @@ public class TMain extends TProcessComposite { ...@@ -53,7 +53,6 @@ public class TMain extends TProcessComposite {
public void bindPorts(TProcess process) throws TMException, SAXException { public void bindPorts(TProcess process) throws TMException, SAXException {
process.generatePort() ; process.generatePort() ;
//System.out.println("debut for " + process); //System.out.println("debut for " + process);
for(int i=0 ; i < process.getNameOut().length ; i++) { for(int i=0 ; i < process.getNameOut().length ; i++) {
if(process.getNameOut(i).equals("_null_")) { if(process.getNameOut(i).equals("_null_")) {
......
/* /*
* $Id: TReader.java,v 1.3 2002-11-14 15:46:45 triolet Exp $ * $Id: TReader.java,v 1.4 2003-01-07 08:13:59 triolet Exp $
* *
* Transmorpher * Transmorpher
* *
...@@ -169,9 +169,11 @@ public abstract class TReader extends TProcessBasic { ...@@ -169,9 +169,11 @@ public abstract class TReader extends TProcessBasic {
*/ */
public void execProcess() throws IOException, SAXException, TMRuntimeException { public void execProcess() throws IOException, SAXException, TMRuntimeException {
try { try {
super.bindParameters(getParameters()); //System.out.println("[test evalParameter] "+getParameters().evalParameter("file"));
iFilename = (String)getParameter("file"); //System.out.println(getParameter("file"));
getParameters().setParameters(param); //super.bindParameters(getParameters());
iFilename = (String)getParameters().evalParameter("file");
//getParameters().setParameters(param);
if (iFilename != null) { if (iFilename != null) {
if (iFilename.startsWith("http://")) { if (iFilename.startsWith("http://")) {
......
/** /**
* $Id: TTransformation.java,v 1.5 2002-12-09 16:36:14 triolet Exp $ * $Id: TTransformation.java,v 1.6 2003-01-07 08:13:59 triolet Exp $
* *
* Transmorpher * Transmorpher
* *
...@@ -62,6 +62,8 @@ import javax.xml.transform.stream.StreamSource; ...@@ -62,6 +62,8 @@ import javax.xml.transform.stream.StreamSource;
// Imported SAX classes // Imported SAX classes
import java.util.Properties; import java.util.Properties;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException; import org.xml.sax.SAXException;
/** /**
...@@ -166,9 +168,9 @@ public abstract class TTransformation extends TProcessBasic { ...@@ -166,9 +168,9 @@ public abstract class TTransformation extends TProcessBasic {
} }
} }
if (entry == null) { if (entry == null) {
StreamSource SS = new StreamSource(systemID); InputSource SS = new InputSource(systemID);
// Create a TransformerHandler for each stylesheet. // Create a TransformerHandler for each stylesheet.
templates = getTransformerFactory().newTemplates(SS); templates = getTransformerFactory().newTemplates(new SAXSource(SS));
entry = new MapEntry(xslLastModified, templates); entry = new MapEntry(xslLastModified, templates);
cache.put(fileName, entry); cache.put(fileName, entry);
} }
......
/** /**
* $Id: Parameters.java,v 1.1 2002-11-06 14:08:21 serge Exp $ * $Id: Parameters.java,v 1.2 2003-01-07 08:13:59 triolet Exp $
* *
* Transmorpher * Transmorpher
* *
...@@ -134,6 +134,10 @@ public class Parameters { ...@@ -134,6 +134,10 @@ public class Parameters {
return p; return p;
} }
public String evalParameter(String name){
return evalString((String)this.getParameter(name));
}
// Replace the parameters in a parameter list, if they are not defined, eval their default // Replace the parameters in a parameter list, if they are not defined, eval their default
public Parameters bindCallerParameters( Parameters p ){ public Parameters bindCallerParameters( Parameters p ){
for( Enumeration e = p.getNames() ; e.hasMoreElements(); ){ for( Enumeration e = p.getNames() ; e.hasMoreElements(); ){
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment