[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: determining whether an XPATH points to an element

Subject: RE: determining whether an XPATH points to an element or attribute
From: Edward.Middleton@xxxxxxxxxxx
Date: Thu, 24 Jan 2002 10:22:38 +0900
determining xpath in ie
>you can tell if you have an element or an attribute by
><xsl:if test="self::*">which is true just on element nodes
Thanks, this is exactly what I want.  All I have is a document with arbitrary XPATH's

<path>//tagname1[fads and @fads]/tagname2</path>

I am using XSLT to process this file to create a second XSLT file.   The second XSLT
file has the template in it.

<xsl:template match="//tagname1[fads and @fads]/tagname2">
		<xsl:when test=" self::*"><!-- if it points to element -->
		<xsl:otherwise><!-- if it points to attribute-->

>but this is a rather strange thing to do as 999 times out of 1000 you
>always know in a template what kind of node is being matched.
Unless I can find out whether the XPATH points to an element or attribute before I create the
second XSLT I have to assume it could be either.

from Jeni post
>But if they're really fairly complicated, with predicates and things,
>then you need to write a XPath parser to work out whether they match
>elements or attributes. And that's very difficult.
I gather there is no simple way to do this with just an XPATH so I will need to test at runtime.

Thank a lot for your help


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

Current Thread


Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
First Name
Last Name
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.