Re: How to test if the current node is an attribute or a namespace node?

Subject: Re: How to test if the current node is an attribute or a namespace node?
From: Miloslav Nic <nicmila@xxxxxxxxx>
Date: Mon, 27 Nov 2000 14:10:53 +0100
Kay Michael wrote:
> 
> > Which is the simplest XPath expression to test whether the
> > current node is an attribute?
> 
> Not easy! I'd suggest:
> 
> count(. | ../@*) = count(../@*)
> >
> > Or a namespace?
> >
> count(. | ../namespace::*) = count(../namespace::*)
> 
> Mike Kay
> 

Longer, but probably easier to understand:

generate-id() = generate-id(parent::*/@*[name()=name(current())])


-- 
******************************************
<firstName> Miloslav </firstName>    
<surname>   Nic      </surname>     

<mail>    nicmila@xxxxxxxxx    </mail>   
<support> http://www.zvon.org  </support>
<zvonMailingList> 
    http://www.zvon.org/index.php?nav_id=4 
</zvonMailingList>


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


Current Thread