protected static void registerMissingNamespaces( ExecutionContext originalContext,
ExecutionContext newContext,
Name... names ) {
if (names == null) return;
NamespaceRegistry newRegistry = newContext.getNamespaceRegistry();
NamespaceRegistry originalRegistry = originalContext.getNamespaceRegistry();
for (Name name : names) {
if (name != null) {
String uri = name.getNamespaceUri();
if (!newRegistry.isRegisteredNamespaceUri(uri)) {
String prefix = originalRegistry.getPrefixForNamespaceUri(uri, false);
newRegistry.register(prefix, uri);
}
}
}
}