Subject:Xpath to return xmlns Author:Alberto Massari Date:09 Jan 2007 11:32 AM
what you want to do is not entirely doable in XPath, because the attributes starting with "xmlns" are not part of the 'attribute::' axis, but belong to the 'namespace::' axis.
So the query you are looking for is /*/namespace::*
But with this caveats:
1) the axis contains all the xmlns:xxx attributes defined on the element AND on all the parent elements, plus the predefined 'xml' namespace
2) the order is implementation defined, so you need to test where SQL2005 places the 'xml' namespace
3) not all XPath 1.0 processors implement this axis, and the ones who did had so many headaches that XPath 2.0 made it deprecated and optional (and XQuery removed it altogether)