I am failing with a seemingly simple task.
I have a configuration file which defines different scenarios. Each scenario has a test expression. The idea is, that instructions within the scenario shall be applied to input documents which match the test expression. For example:
<config>
<scenario test="/input/@id eq 'X'">
...
</scenario>
<scenario test="/input/@id eq 'Y'">
...
</scenario>
</config>
My Problem / Question is: With a given input File, how to identify the matching scenario?
Let $d be a variable with some document node. I can check if it matches the pattern P by writing $d[P]. So i tried with something like
let $p:=doc("config.xml")/config/scenario/@test,
$d:=doc("input.xml")
return $d[$p]
I expected an non-empty sequence if and only if the input Document $i matches the test Pattern $p. But the result of the expression is never empty, no matter what the @test Attribute is. Even if there is just one scenario with a test expression that definitive does not match.
Thanks in advance, Frank