command line validator supporting relax ng Schemas with embedded iso Schematron

前端 未结 1 459
终归单人心
终归单人心 2021-01-22 20:29

Are there any command line-validators that can cope with relax ng-Schemas with embedded iso schematron?

I\'ve got a couple of relax ng-schemas with embedded iso-schematr

相关标签:
1条回答
  • 2021-01-22 20:59

    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.

    And excerpt from 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
    

    See also https://stackoverflow.com/a/18616036/1712389

    0 讨论(0)
提交回复
热议问题