S
S
Shimpanze2017-02-28 11:04:24
XPath
Shimpanze, 2017-02-28 11:04:24

XPath: current context and recursive descent, what does it mean?

Hello!
What do these two parameters mean:
. - current context
.// - recursive descent (zero or more levels from the current context)
Please provide some simple examples.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
D
DevMan, 2017-02-28
@Shimpanze

the current context is the node to which the request is being applied.
Let's say we have a document:

<root>
    <el1>1</el1>
    <el2>
        <el1>2</el1>
    </el2>
</root>

and we apply some query to it, then the current context will be root
, then we can walk through the tree:
root / el1 will return us <el1>1</el1>because it only searches one level.
root//el1 will return us <el1>1</el1>and <el1>2</el1>because it searches at all levels of nesting.

P
Puma Thailand, 2017-11-14
@kally

well, do seo and you will be on the second page

V
Vadim Timoshenko, 2017-11-16
@PbI6A_KuT

It was 2017...
Where did you find such a site design at all?)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question