Paul wrote:
I'd like to write an XPath expression that gets all nodes with a given
local-name, say 'Customer', within a given namespace.
Well XPath has namespace support, in the XPath expression you use a
prefix bound to a namespace URI where that binding happens outside of
the XPath expression language. Thus
//pf:Customer
with the prefix pf bound to the proper namespace URI selects all
Customer elements in that namespace.
How you bind that prefix to the namespace URI depends on where/how you
use XPath, within an XSLT stylesheet you would simply declare that e.g.
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:pf="http://example.com/ns1" version="1.0">
If you use some API to evaluate XPath expressions you need to check the
documentation, for MSXML see this post
<http://groups.google.com/group/microsoft.public.xml/msg/78260972bdb86ccf>
For .NET you need to use an XmlNamespaceManager, bind the prefix you
want to use to the namespace URI and pass the namespace manager as the
second argument to SelectNodes/SelectSingleNode.
--
Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/