xsl-list
[Top] [All Lists]

[xsl] how to xpath the *value* of an attribute based on value of other attribute in same element

2009-07-01 13:42:48
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[(_at_)rank='1']/attribute::hitNum

/xtf:snippets/xtf:snippet[(_at_)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

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--