Validating XSD Schema with Schematron and xsltproc

强颜欢笑 提交于 2019-12-06 14:20:36

Your schema is correct and does what it is meant to do...

The issue is with the script: this script expects to receive a Schematron schema and you give it a XML Schema with embedded rules which is a different kind of beast.

To do your validation, you need to run a first transformation that will extract the Schematron from XML Schema and run validate on this result.

And you could also use xmllint (libxml) to validate the document against the XML Schema which is a different operation.

To do, you can change download ExtractSchFromXSD.xsl your script to:

#!/bin/bash

echo XSD validation
xmllint -schema $1 $2

echo Step0 ...
xsltproc ExtractSchFromXSD.xsl $1 > schema.sch

echo Step1 ...
xsltproc iso_dsdl_include.xsl schema.sch > step1.xsl

echo Step2 ...
xsltproc iso_abstract_expand.xsl step1.xsl > step2.xsl

echo Step3 ...
xsltproc iso_svrl_for_xslt1.xsl step2.xsl > step3.xsl

echo Validation ...
xsltproc step3.xsl $2 | tee result.svrl

Alternatively, you could use an implementation that natively supports embedded Schematron rules in schemas or a tool such as oXygen.

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