S
S
Shimpanze2020-03-17 02:09:23
XPath
Shimpanze, 2020-03-17 02:09:23

Is it possible to write such an axis shorter?

Good morning!

Condition: find the link only if it is around the image.

I write the condition self::a[descendant::img]:

Question for educational purposes: is it possible to write this condition shorter?

Thank you!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Sundukov, 2020-09-08
@Shimpanze

If the goal is to extract from the document all the links inside which are pictures, then the expression:
//a[descendant::img]
is the shortest, because there is no shorthand syntax for the descendant axis.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question