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

XPath expression to return an attribute's value

  • From: "Rachel D. Basse" <honestrosewater@c...>
  • To: xml-dev@l...
  • Date: Sun, 4 Mar 2007 04:43:35 -0500

XPath expression to return an attribute's value
Greetings. :^)

This question came up while using XSLT 2.0 and XPath 2.0. I'd like to root out any related, more general misunderstandings if possible.

Given

 <Root Attribute="Value"/>

I want to make an XPath path expression evaluate to the string "Value". So I want the XDM typed-value of the Attribute attribute, yes? Does XPath have a way to refer to the typed-valued of an attribute?

My first instinct was to refer to the child text node of Attribute, using "Attribute/text()", but that won't work since attributes have no children.

As I understand things, adding any predicate to an "Attribute" path expression won't work since the expression would still return an attribute node or nothing, and I want a string, neither an attribute node nor nothing.

I can apparently get what I want by casting the attribute node as a string, but I am wondering if there is another, more direct way.

Thanks for reading,
Rachel Basse

P.S. I am aware that I can also use xsl:value-of, but I specifically want an XPath expression to evaluate to an attribute's value.


Care2 make the world greener!

Stop the Forest Service from killing more wolves, bears, cougars, and other animals in the wild:
http://go.care2.com/99055

http://www.Care2.com  Free e-mail. 100MB storage.  Helps nonprofits. 


[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


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
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

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.