When using a TransformerHandler to run a transformation, location information for the source document (for example, the value of base-uri(), or the URI used in schema validation diagnostics) is taken from the value passed to TransformerHandler.setSystemId(), and ignores any URI available from the SAX Locator object passed in from the SAX parser using the setDocumentLocator() method.
The most obvious effect of this is that in the case where the source document contains multiple external entities, the system Id and base URI do not change to reflect the entity structure as they should.
This also applies to XInclude processing - however, there is a separate bug in the Xerces XInclude processor that means it doesn't supply proper location information to a SAX ContentHandler anyway.
A patch to module net.sf.saxon.TransformerHandlerImpl is being placed in Subversion. The effect of the patch is that the system ID will be taken from the SAX Locator if available, and the value passed to TransformerHandler.setSystemId() will be used only if no information is available from the SAX Locator object (which sometimes happens in the case where the input is from a user-written SAX filter).