我尝试使用动态Xquery,并使用外部变量形成路径。
我的问题是:
xquery version "1.0-ml";
declare variable $idValue as xs:string external;
declare variable $element as xs:string external;
for $sectiondiv in doc()//$element
return $sectiondiv; 这里,我想从java发送$element查询并执行该查询。元素是xml元素的字符串路径。
示例xml
<rationales id="RATIONALE">
<rationalesbody>
<rationale>
<title>Rationales</title>
<sectiondiv id="RAT_1" population="pediatric">
<p>THis is sample SectionDiv content </p>
</sectiondiv>
</rationale>
</rationalesbody>
</rationales> 所以我发送的元素值是/rationales /rationalesbody/rationale idValue = RAT_1
它应该返回给我sectiondiv并且它是childs。
发布于 2012-06-27 04:16:45
我也在找同样的东西,结果发现了这个:
$doc//*[name() eq $element]https://stackoverflow.com/questions/11013701
复制相似问题