tags:

views:

417

answers:

1

I've created an xpath expression as follows:

/html/body/div[2]/div/ul[2]/li/a/node()

It returns something like this:

#01 <strong>value</strong> suffix

How do I extract the "#01" part and the "suffix" part in two different xpath expressions?

+1  A: 

i think you'd get the 'strong' node then use previous-sibling and following-sibling axes

/html/body/div[2]/div/ul[2]/li/a/strong/previous-sibling::node()
/html/body/div[2]/div/ul[2]/li/a/strong/following-sibling::node()

Might not be absolutely right - bit rusty on xpath!

adam
text()[following-sibling::strong] and text()[preceding-sibling::strong] worked, thanks
Per Stilling
hey, no worries!
adam