java.io.FileNotFoundException,
java.io.IOException,
javax.xml.transform.TransformerException
{
File file = new File(fileName);
TransformerImpl transformer = context.getTransformer();
if(!file.isAbsolute())
{
String base = urlToFileName(elem.getStylesheet().getSystemId());
if(null != base)
{
File baseFile = new File(base);
file = new File(baseFile.getParent(), fileName);
}
}
if(mkdirs)
{
String dirStr = file.getParent();
if((null != dirStr) && (dirStr.length() > 0))
{
File dir = new File(dirStr);
dir.mkdirs();
}
}
// This should be worked on so that the output format can be
// defined by a first child of the redirect element.
OutputProperties format = transformer.getOutputFormat();
FileOutputStream ostream = new FileOutputStream(file);
try
{
ContentHandler flistener
= transformer.createResultContentHandler(new StreamResult(ostream), format);
try
{
flistener.startDocument();
}
catch(org.xml.sax.SAXException se)