cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

XPATH help

Highlighted
Regular Member

XPATH help

<
<listitem><para>text
<randomlist>
<I am here<para>text</para></listitem>
<listitem><para>text</para></listitem>
<listitem><para>text</para></listitem>
</randomlist>
</para></listitem>
</randomlist>

I'm trying to test if the top randomList has listItemPrefix="pf01" and ignore it if it doesn't have the attribute set


This doesn't work, I thought it would take me to the first randomList ancestor of listitem parent
../ancestor::randomList[1][@listitemPrefix='pf01']


Thanks for any help!

Tags (2)
7 REPLIES 7
Highlighted

XPATH help

Try: ../randomList/@listItemPrefix="pf01"


Trevor Hendricks<">mailto:->
Project Analyst -- Publication Systems
Technical Communications, MS: 078
Highlighted

RE: XPATH help

Thank you, Trevor, that didn't work.

Highlighted

XPATH help

Hi Caroline,

Maybe ancestor::randomList[last()][@listitemPrefix='pf01']
The ancestors are listed in reverse order, so you want the
last one to get the outer one.

Regards,
Richard

Highlighted

RE: XPATH help

this works:


../ancestor::randomList[1][@listItemPrefix='pf01']


Wait, what? That's what I had originally, but now it's working for some reason.

Highlighted

RE: XPATH help

Thanks, Richard, unfortunately didn't work. (There were two randomLists, easy to miss)

Highlighted

XPATH help

How about:

./ancestor::randomlist[@listItemPrefix="pf01" and not(ancestor::randomlist)]

So that would be looking for an ancestor that has the prefix, but also is
not a child of other randomlists?


On Wed, Mar 26, 2014 at 11:43 AM, Hendricks Trevor <
-> wrote:

> Try: ../randomList/@listItemPrefix="pf01"
>
>
>
>
>
> *Trevor Hendricks* <->
> Project Analyst -- Publication Systems
> Technical Communications, MS: 078
>
> *m*: 920-226-2116
> *p*: 920-457-4441; ext. 73571
> *f*: 920-803-3939
> *e*: -
> *Experience gracious living with **Kohler
>
>
>
> Math problems?? Call 1-800-10x(24+13)-(64-8y)/2+36x-17.
>
>
>
>
>
>
>
> *From:* Caroline Leccese [
> <listitem><para>text
> <randomlist>
> <listitem>I am here<para>text</para></listitem>
> <listitem><pa...














Highlighted

RE: XPATH help. Solved.

Hi Keith,


Thanks for the reply, unfortunately it didn't work.


This did: ../ancestor::randomList[1][@listItemPrefix='pf01']

Announcements