撒克逊人从Schematron生成空XML [英] Saxon produces empty XML from Schematron

查看:101
本文介绍了撒克逊人从Schematron生成空XML的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在Saxon9HE的帮助下通过XSLT文件(iso_svrl_for_xslt2.xsl)编译Schematron文件,如

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.

我在这里用3个参数呼叫撒克逊人:

Here I am calling Saxon with 3 arguments:

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

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

-s:example_schematron.xsl 是源文件

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

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

以下是文件:

example_schematron.sch:

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:

schema-compiled.xsl:

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

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

Why am I getting empty schema-compiled.xsl?

推荐答案

我没有看过样式表,但我认为(基于

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.

这篇关于撒克逊人从Schematron生成空XML的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆