From: max toro q <maxtoroq@gm...> - 2009-10-24 04:28:14
Using the .NET API I'm calling
XdmNode.EnumerateAxis(XdmAxis.Namespace), which returns all the
in-scope namespaces for that element. Is there a way of getting only
the locally defined namespaces ? If no, is there a way using XPath ?
I need this info to transform the XdmNode to a different tree model,
and/or to serialize it. Right now I'm getting a lot of redundant
Thanks in advance,
From: Michael Kay <mike@sa...> - 2009-10-24 15:26:09
XdmNode doesn't expose this becauses there's no such concept as "locally
defined namespaces" in the XPath data model. The best you can do is to find
the namespaces that are in-scope on this element, and remove any prefix
bindings that are in-scope (and bound to the same URI) on the parent
At the Saxon NodeInfo level (which underpins XdmNode), there is a method
getDeclaredNamespaces() which essentially returns the information you need,
but not in a very palatable format: it returns a list of integer namespace
codes, which can be resolved to (prefix, uri) pairs by reference to the
NamePool. (If you don't want to do this, you could perhaps still optimize
your code by using this method to detect the common case where there are no
> -----Original Message-----
> From: max toro q [mailto:maxtoroq@...]
> Sent: 24 October 2009 05:28
> To: Mailing list for the SAXON XSLT and XQuery processor
> Subject: [saxon] local namespace nodes
> Hello Michael,
> Using the .NET API I'm calling
> XdmNode.EnumerateAxis(XdmAxis.Namespace), which returns all
> the in-scope namespaces for that element. Is there a way of
> getting only the locally defined namespaces ? If no, is there
> a way using XPath ?
> I need this info to transform the XdmNode to a different tree
> model, and/or to serialize it. Right now I'm getting a lot of
> redundant namespace declarations.
> Thanks in advance,
> Come build with us! The BlackBerry(R) Developer Conference in
> SF, CA is the only developer event you need to attend this
> year. Jumpstart your developing skills, take BlackBerry
> mobile applications to market and stay ahead of the curve.
> Join us from November 9 - 12, 2009. Register now!
> saxon-help mailing list archived at
> http://saxon.markmail.org/ saxon-help@...