【问题标题】:Saxon produces empty XML from SchematronSaxon 从 Schematron 生成空 XML
【发布时间】:2013-06-05 14:44:40
【问题描述】:

我正在尝试在 Saxon9HE 的帮助下通过 XSLT 文件 (iso_svrl_for_xslt2.xsl) 编译 Schematron 文件,如 herethere 所述。

这里我用 3 个参数调用 Saxon:

-o:schema-compiled.xsl 是输出文件(XSLT 脚本)

-s:example_schematron.xsl是源文件

iso-schematron-xslt2/iso_svrl_for_xslt2.xsl是样式表文件,用于将schematron文件编译成XSLT脚本

java -jar saxon9he.jar -o:schema-compiled.xsl -s:example_schematron.sch iso-schematron-xslt2/iso_svrl_for_xslt2.xsl

这里是文件:

example_schematron.sch:

<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://www.ascc.net/xml/schematron">
  <title>Test Schematron</title>
  <pattern name="My rules">
      <rule context="User">
            <assert test="count(email) != 1">
                  User shall have exactly one email
            </assert>
      </rule>
</pattern>
</schema>

schema-compiled.xsl:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>

为什么我得到空的 schema-compiled.xsl?

【问题讨论】:

    标签: xml xslt saxon schematron


    【解决方案1】:

    我没有查看样式表,但我认为(基于http://www.schematron.com/iso/iso-schematron.rnc.txthttp://en.wikipedia.org/wiki/Schematron#Versions)ISO Schematron 语言在命名空间http://purl.oclc.org/dsdl/schematron 中定义了它的元素,而您的文件使用不同的命名空间。因此,您可能需要调整架构以使用 ISO 命名空间,或者您需要为架构使用与 ISO 样式表不同的样式表。

    【讨论】:

    • 非常感谢!它终于奏效了。你是对的,我文件中的命名空间已经过时了,正如这里所说的 link。但我读错了,以为是反过来:http://purl.oclc.org/dsdl/schematron 必须改为http://www.ascc.net/xml/schematron。傻我。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-03-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-02-06
    • 1970-01-01
    相关资源
    最近更新 更多