Element ref = ur.getElement(uri, e);
if (ref == null) {
throw new BridgeException(e, ERR_URI_BAD_TARGET,
new Object[] {uri});
} else {
SVGOMDocument refDoc = (SVGOMDocument)ref.getOwnerDocument();
// This is new rather than attaching this BridgeContext
// with the new document we now create a whole new
// BridgeContext to go with the new document.
// This means that the new document has it's own
// world of stuff and it should avoid memory leaks
// since the new document isn't 'tied into' this
// bridge context.
if (refDoc != document) {
CSSEngine eng = refDoc.getCSSEngine();
if (eng == null) {
BridgeContext subCtx;
subCtx = new BridgeContext(getUserAgent(),
getDocumentLoader());
subCtx.setGVTBuilder(getGVTBuilder());