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

Re: trying to create a node-set of attribute nodes

Subject: Re: trying to create a node-set of attribute nodes
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Mon, 10 Mar 2003 17:38:24 +0000
Re:  trying to create a node-set of attribute nodes
Hi Robert,

> ah, this seems to explain something else i was looking at. if i have
> the path
>
>   //element[@attr = "value"]
>
> this will obviously select all "element"s with attribute "attr"
> whose value is "value". if i were to write that out the long way, i
> would get
>
>   //element[string(@attr) = "value"]
>
> is that right? that is, using an attribute in a string context
> forces it to be converted into its "string-value" value. ok, things
> are starting to make more sense.

That's more-or-less right. It's a little complicated by the fact that
when you compare a node set with a value then you're actually testing
whether *any* of the nodes in the node set are equal to that value. So
for example:

  //element[@* = 'value']

would test whether *any* of the attributes on an <element> element in
the document had the value 'value'.

But in the context of testing each individual node, yes, when you
compare a node to a string, you're actually comparing the string value
of the node to the string. And since each element can only have one
attribute named 'attr', the path:

  //element[@attr = 'value']

is equivalent to:

  //element[string(@attr) = 'value']

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/


 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.