[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: XSL to generate XPaths
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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|