It’s been a known issue for some time that the current CSL schema has a
limitation when it comes to validation: styles that call undefined macros
still validate. At least one sloppy CSL author has made this mistake (
http://forums.zotero.org/discussion/7736/problems-citing-in-word-2007/), so
it’s clearly desirable to test for this. But as discussed in the forum
thread, RelaxNG doesn’t offer support for this type of validation. Bruce
pointed me to Schematron, and I’ve spent some time trying to built a
(non-embedded) Schematron schema. Fortunately, I found an example that
almost describes our case:
http://www.zvon.org/xxl/SchematronTutorial/Examples/Example17/example.html(which
seems to be written in Schematron 1.5). I should give a warning that
this example doesn’t work under xmllint (Schematron support in xmllint seems
to be quite limited). Jing, on the other hand, could cope with it. I’ve
extended the example to work with CSL styles, and I think everything works
properly now. I hope this can be easily incorporated into the commit
work-flow of the Style Repository. Maybe the Schematron code can be embedded
in the CSL schema. It’s something I haven’t checked. Please let me know if
you have any suggestions/questions.
The files:
-
Schematron 1.5 schema:
http://groups.google.com/group/zotero-dev/web/undefinedMacro.stron -
Broken test-file:
http://groups.google.com/group/zotero-dev/web/ecology-broken.csl
output:
“C:\jing-20081028\bin>java -jar jing.jar undefinedMacro.stron
ecology-broken.csl
C:\jing-20081028\bin\ecology-broken.csl:44: error: assertion failed:
This element calls a non-existing macro.” -
Working test-file
http://groups.google.com/group/zotero-dev/web/ecology-correct.csl
output:
“C:\jing-20081028\bin>java -jar jing.jar undefinedMacro.stron
ecology-correct.csl” (Jing doesn’t give output when the style validates)
Rintze