Re: Namespaces and For-each

Subject: Re: Namespaces and For-each
From: David Carlisle <davidc@xxxxxxxxx>
Date: Thu, 24 Feb 2000 17:21:47 GMT
> Can anyone tell me if this is to be expected? 

no it's not. as it sounds like it should work.

However if I ignore

> In contrast, if I have a series of
> templates matching "/", "*" and "my-element" with each of the doing an
> apply-templates, I *do* select the "my-element".

I could answer the more usuaal usual quaestion as to why //my-element
might not select an element named my-element. In the hope that
perhaps you lied:-)

You said:

> I am trying to transform a document which uses several namespace
> prefixes.

but whether it uses many (or even no) prefixes is not the point, the
point is how many namespaces does it use, and in particular what
namespace is my-element in.

If your document has used xmlns="xxx" somewhere so that my-element is
in the namespace xxx then 

<xsl:for-each select="//my-element">

will not match it, you need so do xmlns:x="xxx" in the stylesheet
and use "//x:my-element"

David


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


Current Thread