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

使用Saxon HE 10.9出现FODC0002错误,路径正确却无法解析

XSLT 2(Saxon HE 10.9)路径解析错误问题

环境与目录结构

我使用XSLT 2(Saxon HE 10.9)进行转换操作,项目目录结构如下:

Project
- index.xml
- Classes
  - MyClassA
    - MyClassA.xml

转换需求与XSLT代码

当前需将MyClassA.xml转换为新格式,使用的XSLT代码片段如下:

<xsl:for-each select="properties/property[type = document('../../index.xml',.)/classes/class/id]">
    <xsl:apply-templates select="display_name"/>
</xsl:for-each>

错误信息

运行转换时触发如下错误:

FODC0002 Exception thrown by URIResolver resolving ../../index.xml against
`file:///D:/Project/Classes/MyClassA'. Found while atomizing the second operand of '='

疑问

我认为路径是正确的,../../index.xml解析后应为file:///D:/Project/index.xml,且该文件确实存在,但仍报错。请问问题出在哪里?

补充:C#执行代码

执行转换的C#代码如下:

RawDestination destination = new RawDestination();
using (FileStream inputStream = File.OpenRead(inputFile))
{
    XsltTransformer transformer = executable.Load();
    using (MessageListener msg = new MessageListener(transformer))
    {
        msg.OnError = () => { success = false; };
        transformer.BaseOutputUri = new Uri(outputFile);
        transformer.SetInputStream(inputStream, new Uri(Path.GetDirectoryName(inputFile)));
        transformer.Run(destination); // this will set HasError if an xsl:message contains "error:"
    }
}

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.17 07:44:52