xsl-list
[Top] [All Lists]

Re: [xsl] How to select a node based on its siblings?

2011-10-01 14:54:34
On Sat, Oct 1, 2011 at 12:39 PM, Martin Honnen 
<Martin(_dot_)Honnen(_at_)gmx(_dot_)de> wrote:
Peng Yu wrote:

Hi,

I want to select<input ...>  based on the fact the its sibling<label
...>  has the number 1. I looked at xpath manual, but I'm not sure how
to use xpath to select based on siblings. Could anybody let me know?

<td class="checkBoxMargin fontColorGrey alignTextCenter" valign="top"
scope="row">
<input id="eid_2-s2.0-78650811198" type="checkbox" onclick="return
selectDeselectResult(document.SearchResultsForm, this);"
value="2-s2.0-78650811198" name="selectedEIDs">
<br>
<label for="eid_2-s2.0-78650811198">
<span class="hidden-label">result</span>
1
</label>
</td>

 //input[following-sibling::label[normalize-space() = 1]]

to check only following siblings or

 //input[following-sibling::label[normalize-space() = 1] |
preceding-sibling::label[normalize-space() = 1]]

to check both following and preceding siblings.

I tried your xpath in Seleinum IDE. But I doesn't work as expected. I
want to reduced the problem to a simpler task. How to match the
following structure where the text is "1"?

<label for="eid_2-s2.0-78650811198">
<span class="hidden-label">result</span>
1
</label>

-- 
Regards,
Peng

--~------------------------------------------------------------------
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>
--~--

<Prev in Thread] Current Thread [Next in Thread>