问题描述
有没有可以使用嵌入式iso schematron处理松弛ng-Schema的命令行验证器?
Are there any command line-validators that can cope with relax ng-Schemas with embedded iso schematron?
我有一些带有嵌入式等电调子规则的松弛ng方案,必须在命令行上进行验证.看起来,我们通常的验证器jing仅适用于schematron 1.5.在网上冲浪时,我找不到支持嵌入式iso schematron的任何验证器,但我使用oXygen作为xml编辑器,因此可以从那里进行验证.
I've got a couple of relax ng-schemas with embedded iso-schematron rules which I have to be able to validate on the command line. As it seems, jing, our usual validator, only works with schematron 1.5. Surfing the web, I haven't been able to find any validator supporting embedded iso schematron but I use oXygen as an xml editor and I can validate just fine from there.
推荐答案
只要首先提取Schematron规则,然后对提取的Schematron模式运行单独的验证,就可以使用Jing. RNG2Schtrn.xsl XSLT样式表可以进行Schematron提取(在网上很难找到,但是我们在 https://github.com/citation-style-language/utilities/blob/master/RNG2Schtrn.xsl )和Saxon(与Jing捆绑在一起) ).如果您的模式采用紧凑的.rnc语法,则首先必须将其转换为XML .rng语法,可以使用Trang.
You can use Jing, as long as you first extract the Schematron rules, and then run a separate validation against the extracted Schematron schema. Schematron extraction is possible with the RNG2Schtrn.xsl XSLT style sheet (it's a bit hard to find online, but we have a copy at https://github.com/citation-style-language/utilities/blob/master/RNG2Schtrn.xsl) and Saxon (which is bundled along with Jing). If your schema is in the compact .rnc syntax, you first have to convert it to the XML .rng syntax, for which you can use Trang.
摘录自 https://github. com/citation-style-language/utilities/blob/master/style-qc.sh
# Jing currently ignores embedded Schematron rules.
# For this reason, the schema is first converted to
# RELAX NG XML, after which the Schematron code is
# extracted and tested separately.
java -jar ${pathTrang} ${pathCSLSchema} ${TMP_DIR}/csl.rng
java -jar ${pathSaxon} -o ${TMP_DIR}/csl.sch ${TMP_DIR}/csl.rng RNG2Schtrn.xsl
java -jar ${pathJing} ${TMP_DIR}/csl.sch ${pathCSLStyles}/*.csl || true
# RELAX NG Compact validation
java -jar ${pathJing} -c ${pathCSLSchema} ${pathCSLStyles}/*.csl || true
另请参见 https://stackoverflow.com/a/18616036/1712389
这篇关于命令行验证器,支持使用嵌入式iso Schematron放松Schemas的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!