Jump to content

need help with last() function in xpath


kc111

Recommended Posts

Hi everyone,

 

I am having trouble  with the last() function in xpath . I want to get the text3.

 

The HTML looks like this:

 

 

div id="body">

<br>
<br>
text1
<hr>
text2
<br>
<br>
text3 

 

 

So far I have:

 

$lastdata= $simplexml->xpath("//div[@id='body']/following-sibling::node [last()]");

 

 

This is not working. I would appreciate any help.

 

Thank you in advance,

 

Bill

Link to comment
https://forums.phpfreaks.com/topic/253488-need-help-with-last-function-in-xpath/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.