2013-06-05 24 views
0

我試圖通過XSLT文件(iso_svrl_for_xslt2.xsl)在Saxon9HE的幫助下編譯Schematron文件,如herethere所述。Saxon從Schematron生成空的XML

在這裏,我呼籲撒克遜與3個參數:

-o:架構compiled.xsl是輸出文件(XSLT腳本)

-s:example_schematron.xsl是源文件

異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> 

架構compiled.xsl:

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

爲什麼我會收到空​​模式,compiled.xsl?

回答

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樣式表。

+0

非常感謝!它終於奏效了。你是對的,我的文件中的命名空間已經過時了,因爲它在這裏說明了[鏈接](http://www.schematron.com/resources.html)。但我讀錯了,並認爲這是另一種方式:'http:// purl.oclc.org/dsdl/schematron'不得不改爲'http:// www.ascc.net/xml/schematron'。傻我。 – Jugo