我正在尝试创建一个用于验证xhtml文档的例程。我使用在Calabash中运行的xproc。In是一个xhtml文档。此文档可能无效。
为了测试,我编辑了一个xhtml文档。我只需删除a并引入一个错误。这是我希望在验证文档时检测到的错误。
为了验证我的使用,我提供了一个模式,并将验证结果输出到一个新文件中。
但是,如果输入文件首先无效,xproc/Calabash就会停止。错误消息基本上是来自Saxon的错误消息,指出缺少。但是我想在我的输出文件中得到验证输出。我该怎么做?
<p:input port="source" primary="true"/>
<p:load name="xml-doc" href="'input.xhtml'"/>
<p:validate-with-xml-schema name="validate">
<p:input port="source">
<p:pipe port="result" step="xml-doc"/>
</p:input>
<p:with-option name="assert-valid" select="'false'"/>
<p:with-option name="mode" select="'lax'"/>
<p:input port="schema">
<p:document href="xhtml-schema.xsd"/>
</p:input>
</p:validate-with-xml-schema>
<p:store name="valid-store">
<p:input port="source">
<p:pipe port="result" step="validate"/>
</p:input>
<p:with-option name="href" select="'output.xml'"/>
</p:store>
发布于 2014-07-02 17:12:02
从您的问题看,不清楚Saxon到底在抱怨什么,但我假设它找不到输入的XHTML文件。在p:load/@href中使用单引号将文件名括起来,这是不正确的。当您对选项使用基于属性的快捷形式时,属性值将按原样接受,并且不会解释为XPath表达式(使用长p:with-option形式时就是这种情况)。
https://stackoverflow.com/questions/24424812
复制相似问题