If you just started using XALAN probably the first issue that you encountered is the fact the relative paths, for the imported XSL files, are not working.
For the relatives path to work, in a XALAN transformation, you will need to set the system identifier (systemID).
The system identifier is nothing else but an URI to the source file, and is set using the StreamSource.setSystemId(String systemID) method.
Following is a simple example that shows how to to set the property for a XSL StreamSource.
import javax.xml.transform.*;
import javax.xml.transform.stream.*;
public class RelativePathExample {
public static void main(String[] args) throws Exception {
final String BASE_PATH = "C:\\Temp\\";
String xslPathURI = (new File(BASE_PATH + "article.xsl")).toURL()
.toString();
StreamSource xslSource = new StreamSource(xslPathURI);
// this line will be used to solve the URIs encountered in XSL file,
// respectively the relative paths of the imported XSL files
// xslPathURI = "file:/C:/Temp/article.xsl"
xslSource.setSystemId(xslPathURI);
String xmlPathURI = (new File(BASE_PATH + "article.xml")).toURL()
.toString();
StreamSource xmlSource = new StreamSource(xmlPathURI);
TransformerFactory tFactory = TransformerFactory.newInstance();
Transformer transformer = tFactory.newTransformer(xslSource);
StreamResult result = new StreamResult(new FileOutputStream(BASE_PATH
+ "article.html"));
transformer.transform(xmlSource, result);
}
}