I two XPaths, f(x) and g(y), and some XML x.
x = <example>
<a>
<number>1</number>
</a>
<b>
<letter>A</letter>
</b>
<c>
<number>2</number>
</c>
</example>
f(x) = /example/*
g(y) = /number|/letter
How do I write h(x) in XQuery such that h(x) = g(f(x)) for any g(x)? I don’t know g(x) ahead of time so I cannot modify it. I can modify f(x) if necessary. All of this needs to happen in XQuery because it’s part of an Oracle query.
h(x) = g(f(x)) = $data/example/*...?
I may be confused about the question, but if I have understood it correctly then the answer is
where FFFF and GGGG are the expressions corresponding to f(x) and g(y)
But I’m assuming that you got your example wrong, and when you wrote
you meant
i.e. a relative selection rather than an absolute selection.