*
* @return the old namespace context
*/
protected NamespaceContext addNamespace(Element elt)
{
NamespaceContext oldNamespace = _namespace;
Node attr = ((QElement) elt).getFirstAttribute();
for (; attr != null; attr = attr.getNextSibling()) {
String name = attr.getNodeName();
if (name.startsWith("xmlns:"))
name = name.substring(6);
else if (name.equals("xmlns"))
name = "";
else
continue;
// Note: according to the spec, the default namespace is not used
String url = attr.getNodeValue();
if (url.equals(XSLNS) || url.equals(XTPNS))
continue;
if (url.startsWith("quote:"))
url = url.substring(6);
_namespace = new NamespaceContext(_namespace, name, url);
}
return oldNamespace;
}