本文介绍了撒克逊人从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?

推荐答案

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

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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-19 14:58