xslt doc-available 测试抛出致命的 java.io.FileNotFoundException 而不是优雅地去否则

问题描述

运行下面的代码时出现以下错误

FODC0002 I/O error reported by XML parser processing Caused by java.io.FileNotFoundException:

这是我正在运行的条件

           <xsl:choose>
              <xsl:when test="document(concat($repo-path,$wit-slug,'_',$itemid,'.xml'))">
                <transcriptions>
                  <transcription transcriptionDefault="true">
                    <type>diplomatic</type>
                    <version versionDefault="true">
                      <hash>transcription</hash>
                      <versionNo n="dev">head-dev</versionNo>
                      <url><xsl:value-of select="concat($wit-slug,'.xml')"/></url>
                    </version>
                  </transcription>
                </transcriptions>
              </xsl:when>

条件的存在正是为了避免这个错误。有时文件在那里有时不存在。如果不是,则产生以下输出,否则继续。

在 Oxygen 中运行此程序我注意到我确实遇到了这些错误,但它们并不致命。脚本继续完成。

过去在命令行中运行 saxon 会导致相同的行为。

现在,我脚下的某些东西似乎发生了变化,以至于 saxon 命令行工具在遇到此错误时完全停止,而不是继续运行。

这是我 mac 上的 java 版本

java -version
java version "1.8.0_74"
Java(TM) SE Runtime Environment (build 1.8.0_74-b02)
Java HotSpot(TM) 64-Bit Server VM (build 25.74-b02,mixed mode)

如果您有任何想法或建议,我将不胜感激。

解决方法

您最近是否更改了 Saxon 的版本?

Undocumented change of IO failure handling when using document() between Saxon 9 and 10