首页 > 解决方案 > 如果 xml 文件中的字符串匹配,则获取文件名

问题描述

我正在尝试获取包含特定字符串的 xml 文件的文件名(包括路径)。

for $file in doc("allfiles.xml")/allfiles/doc,
    $thefile in doc(concat("../data/", $file/@href)),
    $profile in $here/there/header/profile[contains(., "thespecificstring")]
return
    $getfilename

for 语句有效,但我需要在 return 中添加什么?我只是不了解文档。

标签: xmlxquery

解决方案


如果没有看到您的输入和所需的输出,很难说,但也许您想要document-uri($thefile).


推荐阅读