This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: How to test if the current node is an attribute or a namespace node?
- To: xsl-list at mulberrytech dot com
- Subject: Re: How to test if the current node is an attribute or a namespace node?
- From: Miloslav Nic <nicmila at idoox dot com>
- Date: Mon, 27 Nov 2000 14:10:53 +0100
- References: <6B2A5AEA929FD411AE41009027CA88E31D4387@WWMESSD048>
- Reply-To: xsl-list at mulberrytech dot com
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@idoox.com </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