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

how to xpath the *value* of an attribute based on valu

Subject: how to xpath the *value* of an attribute based on value of other attribute in same element
From: dan haig <haignlx@xxxxxxxxx>
Date: Wed, 1 Jul 2009 13:42:10 -0400
 how to xpath the *value* of an attribute based on valu
Hi, sorry if this has been answered a hundred times but I haven't had
much luck finding this in the archives.

For this xml:

<xtf:snippets>
   <xtf:snippet score="100" rank="1" hitNum="5">
       MS Clark Library, University of
       <xtf:hit>
           <xtf:term>California</xtf:term>
       </xtf:hit>. 40 Albion Street Broadstairs |
   </xtf:snippet>
</xtf:snippets>


... I want to write an xpath that will select  just the numeric value
of 5 for the attribute hitNum, based on its being a sibling attribute
of rank="1". However, I can't get any closer than selecting the whole
xtf:snippet element. This are a couple ways of accessing that
inadequate result:

/xtf:snippets/xtf:snippet[@rank='1']/attribute::hitNum

/xtf:snippets/xtf:snippet[@rank='1']/@hitNum

I can't seem to get it to cough up just the 5. It would seem trivial,
but neither reference books nor any website I have found addressed it.
Any clues please, thanks.

.d

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.