RE: [xsl] detecting if a given node contains other nodes from a different namespace or plain text only?

Subject: RE: [xsl] detecting if a given node contains other nodes from a different namespace or plain text only?
From: "Michael Kay" <mhk@xxxxxxxxx>
Date: Wed, 8 Sep 2004 21:53:31 +0100
I'm not sure where the "only" belongs in your sentence. If the element has
no descendants, does it pass or fail?

Let's suppose you mean "test whether every descendant of the current element
is either a text node or an element in a different namespace".

Invert the condition: it's false if the element contains another element in
the same namespace, or a comment, or a processing instruction.

test="not(.//*[namespace-uri()=namespace-uri(current())] 
          or .//comment()
          or .//processing-instruction())"

Michael Kay

> -----Original Message-----
> From: SANWAL, ABHISHEK (HP-Houston) [mailto:abhishek.sanwal@xxxxxx] 
> Sent: 08 September 2004 20:40
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: [xsl] detecting if a given node contains other nodes 
> from a different namespace or plain text only?
> 
> Detecting if a given node contains other nodes from a different
> namespace or plain text only?
> 
> How can I do that?
> 
> I believe it could be done using the text() and node() functions...
> 
> Suggestions?
> 
> Thanks in advance.
> 
> Abhishek

Current Thread