Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

XPATH remove attribute

Tags:

xpath

Hi does anyone know hwo to remove an attrbute using xpath. In particular the rel attribute and its text from a link. i.e. <a href='http://google.com' rel='some text'>Link</a> and i want to remove rel='some text'.

There will be multiple links in the html i am parsing.

like image 539
David Avatar asked Mar 14 '10 22:03

David


1 Answers

You can select items using xpath, but that's all it can do - it is a query language.

You need to use XSLT or an XML parser in order to remove attributes/elements.

like image 166
Oded Avatar answered Oct 03 '22 09:10

Oded