是否可以使用 xquery (BaseX) 评估存储在变量中的 "complex" xpath 表达式?
Is it possible to evaluate a "complex" xpath expression stored in a variable using xquery (BaseX)?
我正在尝试在 xquery 中做类似的事情(使用 basex)
let $node := doc('doc.xml')//*:root
let $xpath := "descendant::*:path/*:to/*:node"
let $val := $node//$xpath
let $val := functx:dynamic-path($node, $xpath)
但是这个不允许太多
The function only supports element names and attribute names preceded by @, separated by single slashes. The names can optionally be prefixed, but they must use the same prefix that is used in the input document. It does not support predicates, other axes or other node kinds. Note that most processors have an extension function that evaluates path expressions dynamically in a much more complete way.
您是否知道任何其他可以提供帮助的功能?
看看http://docs.basex.org/wiki/XQuery_Module#xquery:eval:
let $node := doc('doc.xml')//*:root
let $xpath := "descendant::*:path/*:to/*:node"
let $val := xquery:eval($path, map { '' : $node })
我正在尝试在 xquery 中做类似的事情(使用 basex)
let $node := doc('doc.xml')//*:root
let $xpath := "descendant::*:path/*:to/*:node"
let $val := $node//$xpath
let $val := functx:dynamic-path($node, $xpath)
但是这个不允许太多
The function only supports element names and attribute names preceded by @, separated by single slashes. The names can optionally be prefixed, but they must use the same prefix that is used in the input document. It does not support predicates, other axes or other node kinds. Note that most processors have an extension function that evaluates path expressions dynamically in a much more complete way.
您是否知道任何其他可以提供帮助的功能?
看看http://docs.basex.org/wiki/XQuery_Module#xquery:eval:
let $node := doc('doc.xml')//*:root
let $xpath := "descendant::*:path/*:to/*:node"
let $val := xquery:eval($path, map { '' : $node })