Re: [xsl] XSL to generate XPaths

Subject: Re: [xsl] XSL to generate XPaths
From: Jeni Tennison <mail@xxxxxxxxxxxxxxxx>
Date: Thu, 17 May 2001 15:00:06 +0100
Hi Michael,

> Here I needed to check if the current node is an element:
>
>   count(.|../*)=count(../*) and count(../*[name()=name(current())]) &gt; 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


Current Thread