RE: [xsl] one element and two namespaces

Subject: RE: [xsl] one element and two namespaces
From: David_N_Bertoni@xxxxxxxxx
Date: Wed, 22 Aug 2001 13:51:42 -0400
> >          <first>
> >                      <record></record>
> >          </first>
> >          <first xmlns="http://www.imsproject.org/metadata";>
> >                      <record></record>
> >          </first>
> >
> >I am able to extract all the element with the name first except the one
> >with this namespace declaration. I need to treat all element with the
> >name "first" equally.
>
> In match condition terms, you want all the elements for whom the local
part
> of the name (the part after the ":" that delimits the namespace prefix)
> equals "first":
>
>   match="*[local-name()='first']"
>
> Simply writing match="first", which I imagine is what you did, is only
> asking for all the first elements from the default namespace.

Not quite.  The default namespace is _never_ used by XPath or in XSLT
patterns when evaluating node tests.  match="first" will only match 'first'
elements which are not in _any_ namespace.  In the example, the second
first _is_ in the default namespace, but it will not be matched.

The distinction is very important (and is a constant source of confusion)
when dealing with the default namespace.

Dave


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread