This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: XSL to generate XPaths
- To: Michael Strasser <M dot Strasser at myrealbox dot com>
- Subject: Re: [xsl] XSL to generate XPaths
- From: Jeni Tennison <mail at jenitennison dot com>
- Date: Thu, 17 May 2001 15:00:06 +0100
- CC: xsl-list at lists dot mulberrytech dot com
- Organization: Jeni Tennison Consulting Ltd
- References: <3B01BB2E.D0BCDBF0@myrealbox.com> <3B03D020.3882C1C0@myrealbox.com>
- Reply-To: xsl-list at lists dot mulberrytech dot com
Hi Michael,
> Here I needed to check if the current node is an element:
>
> count(.|../*)=count(../*) and count(../*[name()=name(current())]) > 1"
>
> If anyone wants the new version of the whole thing, please let me know.
The easiest way to test whether the current node is an element is
with:
self::*
This selects the current node if it is an element (with any name); if
a node is selected through this path, then the resultant node set
evaluates as boolean true.
(Similarly, you can check whether the current node is a comment with
self::comment(), a text node with self::text() and a processing
instruction with self::processing-instruction(). It's only with
attributes and namespace nodes that you can't use the self:: axis
because they're only accessible through the attribute:: and
namespace:: axes.)
Cheers,
Jeni
---
Jeni Tennison
http://www.jenitennison.com/
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list