You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

命令行Saxon中XInclude失效但oXygen中正常的技术求助

问题:Saxon-HE 9命令行处理带XInclude的XML集合时路径错误

背景

我有一批转录手稿的XML文件,通过XInclude语句引用书籍的共享描述,语句如下:

<xi:include href="../Witness_Descriptions/Trinity_R_3_20.xml" xpointer="publication" xmlns:xi="http://www.w3.org/2001/XInclude"/>
<xi:include href="../Witness_Descriptions/Trinity_R_3_20.xml" xpointer="Trinity_R_3_20" xmlns:xi="http://www.w3.org/2001/XInclude"/>
<xi:include href="../Witness_Descriptions/Minor_Poems_Vol_II.xml" xpointer="MacCracken" xmlns:xi="http://www.w3.org/2001/XInclude"/>

在oXygen中使用内置的Saxon-PE 10.6转换器执行XSLT转HTML时一切正常,但用命令行的Saxon-HE 9执行XQuery批量处理文档集时出错。

命令行参数

java -Xms128m -Xmx1024m -XX:+UseCompressedOops -cp saxon9he.jar net.sf.saxon.Query -t -xi -q:test.xq -o:1698815174.72894737321461.xml line=l.1 zone=EETS.ME.I marginalia=text collection=/home/matrygg/minorworksoflydgate.net/XML/Mumming_Eltham

XQuery代码片段

XQuery通过外部变量$collection收集指定目录下的XML文件:

let $collection:=concat($collection, '?select=*.xml')
let $q:=collection($collection)

错误信息

当XML文件无XInclude时可正常运行,添加后出现错误:

Warning: org.xml.sax.SAXParseException; systemId: file:/home/matrygg/minorworksoflydgate.net/XML/Mumming_Eltham/Trinity_College_R_3_20_Mumming_Eltham.xml; lineNumber: 22; columnNumber: 142; Include operation failed, reverting to fallback. Resource error reading file as XML (href='../Witness_Descriptions/Trinity_R_3_20.xml'). Reason: XPointer resolution unsuccessful.
Error on line 22 column 142 of Trinity_College_R_3_20_Mumming_Eltham.xml:
SXXP0003: Error reported by XML parser: An include with href '../Witness_Descriptions/Trinity_R_3_20.xml'failed, and no fallback element was found.
Query failed with dynamic error: org.xml.sax.SAXParseException; systemId: file:/home/USERNAME/minorworksoflydgate.net/XML/Mumming_Eltham/Trinity_College_R_3_20_Mumming_Eltham.xml; lineNumber: 22; columnNumber: 142; An include with href '../Witness_Descriptions/Trinity_R_3_20.xml'failed, and no fallback element was found.

疑问

推测是相对路径处理问题,询问是否可通过命令行参数解决,还是必须使用绝对URI。


内容的提问来源于stack exchange,提问作者medievalmatt

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.07 05:47:21