if (userAgent == null) {
userAgent = new FOUserAgent();
userAgent.enableLogging(getLogger());
- userAgent.setBaseURL("");
}
return userAgent;
}
public synchronized void render(InputHandler inputHandler)
throws FOPException {
XMLReader parser = inputHandler.getParser();
+ userAgent.setBaseURL(inputHandler.getBaseURL());
render(parser, inputHandler.getInputSource());
}
*/
public FOFileHandler(File fofile) {
this.fofile = fofile;
+ try {
+ baseURL =
+ new File(fofile.getAbsolutePath()).getParentFile().toURL().toExternalForm();
+ } catch (Exception e) {
+ baseURL = "";
+ }
}
/**
this.foURL = url;
}
-
/**
* @see org.apache.fop.apps.InputHandler#getInputSource()
*/
*/
public abstract InputSource getInputSource();
+ protected String baseURL = null;
+
+ /**
+ * Get the base URL associated with this input source
+ * @return the input source
+ */
+ public String getBaseURL() {
+ return baseURL;
+ }
+
/**
* Get the SAX parser associated with this input handler.
* @return the SAX parser
public XSLTInputHandler(File xmlfile, File xsltfile, Vector params) throws FOPException {
this.xmlSource = new StreamSource(xmlfile);
this.xsltSource = new StreamSource(xsltfile);
+ try {
+ baseURL =
+ new File(xmlfile.getAbsolutePath()).getParentFile().toURL().toExternalForm();
+ } catch (Exception e) {
+ baseURL = "";
+ }
xsltParams = params;
}
public XSLTInputHandler(File xmlfile, File xsltfile) throws FOPException {
this.xmlSource = new StreamSource(xmlfile);
this.xsltSource = new StreamSource(xsltfile);
+ try {
+ baseURL =
+ new File(xmlfile.getAbsolutePath()).getParentFile().toURL().toExternalForm();
+ } catch (Exception e) {
+ baseURL = "";
+ }
}
/**
saxTFactory.newXMLFilter(xsltSource);
/* if (inParams != null) {
- Transformer transformer = ??? how to obtain from an XMLFilter?
- int nParams = inParams.size();
-
+ // parameters currently not settable with an XMLFilter
for (int i = 0; i < nParams; i += 2) {
- transformer.setParameter((String) inParams.elementAt(i),
+ // setParameter() method doesn't exist
+ xmlfilter.setParameter((String) inParams.elementAt(i),
(String) inParams.elementAt(i + 1));
}
}