xsl-list
[Top] [All Lists]

Re: [xsl] XPath matching elements with or without prefix by inherited namespace

2008-01-11 08:02:43
Stephen Colin (UK) wrote:

How do I reliably match the "elem" element in both of the below
documents:

<?xml version="1.0" encoding="UTF-8?>
<p:example xmlns:p="something">
  <elem>value</elem>

This 'elem' element is in no namespace.

</p:example>

<?xml version="1.0" encoding="UTF-8?>
<p:example xmlns:p="something">
  <p:elem>value</p:elem>

This 'p:elem' element is in the namespace 'something'.

With XPath 2.0 you can use
  *:elem
to select elements with local name 'elem' in any namespace.
With XPath 1.0 you can only use
  *[local-name() = 'elem']

--

        Martin Honnen
        http://JavaScript.FAQTs.com/

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--