// Result was supplied, the filename is relative to the source document.
// When transforming with a SAXResult or DOMResult, call
// TransformerImpl.setOutputTarget() to set the desired Result base.
// String base = urlToFileName(elem.getStylesheet().getSystemId());
Result outputTarget = transformer.getOutputTarget();
if ( (null != outputTarget) && ((base = outputTarget.getSystemId()) != null) ) {
base = urlToFileName(base);
}
else
{
base = urlToFileName(transformer.getBaseURLOfSource());