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

Re: Xpath predicates question

Subject: Re: Xpath predicates question
From: Mike Brown <mike@xxxxxxxx>
Date: Fri, 16 Aug 2002 19:18:39 -0600 (MDT)
xpath predicates
Amanda Birmingham wrote:
> Hi, List,
> 
> I've got a question about using predicates in xpath ... I know you can 
> select something like
> 
> /library/book[title = MobyDick]

You mean

  /library/book[title = 'MobyDick']

> but can you do something like
> 
> /library/book[title = <xsl:value-of select = "/personal_info/favorite_book" />]

Yes, like this... didn't you try it?

  /library/book[title = /personal_info/favorite_book]

Although this example would not actually work, since a well-formed document
cannot have both a /library and a /personal_info, but in general, if you get
the paths right, it will be fine. Show us your XML and what output you want,
if you can't figure it out.

Node-sets are tricky when making comparisons. For each book element, you're
comparing a set of title elements with a set of favorite_book elements. The
comparison will be true if the string-value of any title matches the
string-value of any of favorite_book. "string-value" is XPath terminology;
it generally means the text content of the node, or the string equivalent of 
whatever the object is.

   - Mike
____________________________________________________________________________
  mike j. brown                   |  xml/xslt: http://skew.org/xml/
  denver/boulder, colorado, usa   |  resume: http://skew.org/~mike/resume/

 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.