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

determining whether an XPATH points to an element or a

Subject: determining whether an XPATH points to an element or attribute
From: Edward.Middleton@xxxxxxxxxxx
Date: Wed, 23 Jan 2002 17:09:21 +0900
determine xpath
Hi All

I have an XPATH that can either point to a element or an attribute.

//tagname  or //attributename

I am using the XPATH to generate template match rules in an XSLT file.  If the XPATH points to an attribute
I want it to perform one action and if it points to an element I want it to perform another.
something like this.

<xsl:template match="tagname">
	<TagOperation>
</xsl:template>

<xsl:template match="attributename">
	<AttributeOperation>
</xsl:template>

Is there any way to determine whether the XPATH matches an attribute or element while creating the XSLT file?

An alternative idea I had was to include both in the match and check the type of the current
node.  But there doesn't seem to be any way to test if the current node is an attribute.

<xsl:template match="//tagname">
	<xsl:choose>
		<xsl:when test=" current() = some sort of test  "><!-- if it points to element -->
			<TagOperation>
		</xsl:when>
		<xsl:otherwise><!-- if it points to attribute-->
			<AttributeOperation>
		</xsl:otherwise>
	</xsl:choose>
</xsl:template>

Thanks in advance

Edward


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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

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.
Email
First Name
Last Name
Company
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.