Saxon produces empty XML from Schematron

社会主义新天地 提交于 2019-12-25 03:08:37

问题


I am trying to compile Schematron file through the XSLT file (iso_svrl_for_xslt2.xsl) with help of Saxon9HE as described here and there.

Here I am calling Saxon with 3 arguments:

-o:schema-compiled.xsl is the output file (XSLT script)

-s:example_schematron.xsl is the source file

iso-schematron-xslt2/iso_svrl_for_xslt2.xsl is the stylesheet file, used to compile schematron file into XSLT script

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

Here are the files:

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"?>

Why am I getting empty schema-compiled.xsl?


回答1:


I haven't looked at the stylesheet but I think (based on http://www.schematron.com/iso/iso-schematron.rnc.txt and http://en.wikipedia.org/wiki/Schematron#Versions) that the ISO Schematron language defines its elements in the namespace http://purl.oclc.org/dsdl/schematron while your file uses a different namespace. So perhaps you need to adapt your schema to use the ISO namespace or you need to use a different stylesheet for your schema than the ISO stylesheet.



来源:https://stackoverflow.com/questions/16942939/saxon-produces-empty-xml-from-schematron

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!