Commit 21374435 authored by Fabien Triolet's avatar Fabien Triolet
Browse files

XSL file can be loaded with http protocol

parent 1ebaa613
/**
* $Id: TTransformation.java,v 1.4 2002-11-25 16:09:11 triolet Exp $
* $Id: TTransformation.java,v 1.5 2002-12-09 16:36:14 triolet Exp $
*
* Transmorpher
*
......@@ -41,6 +41,7 @@ import java.io.File;
// Imported java.io classes
import java.io.IOException;
import java.net.*;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Hashtable;
......@@ -145,9 +146,19 @@ public abstract class TTransformation extends TProcessBasic {
*/
public final Transformer initTransformer() throws TMRuntimeException {
try {
File xsltFile = new File(fileName);
long xslLastModified = xsltFile.lastModified();
long xslLastModified=0 ;
String systemID="";
if(fileName.startsWith("http://")){
URL url = new URL(fileName);
URLConnection urlConnect = url.openConnection();
xslLastModified=urlConnect.getLastModified();
systemID=url.toExternalForm();
}
else{
File xsltFile = new File(fileName);
xslLastModified = xsltFile.lastModified();
systemID=xsltFile.toURL().toExternalForm();
}
MapEntry entry = (MapEntry)cache.get(fileName);
if (entry != null) {
if (xslLastModified > entry.lastModified) {
......@@ -155,7 +166,6 @@ public abstract class TTransformation extends TProcessBasic {
}
}
if (entry == null) {
String systemID = xsltFile.toURL().toExternalForm();
StreamSource SS = new StreamSource(systemID);
// Create a TransformerHandler for each stylesheet.
templates = getTransformerFactory().newTemplates(SS);
......
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