On 17 Feb 2026, at 16:31, lord of edges  via lxml - The Python XML Toolkit 
wrote:

> Google seems to think it is a stupid question, and I don't have a reason to 
> need it now, but is there some way to exclude/delete elements/nodes outside 
> the selection from the output/document?

It's not really clear what you're trying to do but, when working with HTML, 
it's often best to use the BeautifulSoup library. This uses lxml internally but 
is more expressive than working XML directly, as in your use of xpath, 
especially with sequence indices.

Charlie

--
Charlie Clark
Managing Director
Clark Consulting & Research
German Office
Sengelsweg 34
Düsseldorf
D- 40489
Tel: +49-203-3925-0390
Mobile: +49-178-782-6226
_______________________________________________
lxml - The Python XML Toolkit mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/lxml.python.org
Member address: [email protected]

Reply via email to