citation-style-language / styles

Official repository for Citation Style Language (CSL) citation styles.
https://citationstyles.org/
3.29k stars 3.76k forks source link

Specifying schema in style files #1823

Open adunning opened 8 years ago

adunning commented 8 years ago

It would be handy if the CSL files specified the schema, to allow XML editors that support RELAX NG/Schematron (e.g. Oxygen) to pick this up automatically. This can be achieved by adding an xml-model declaration to the beginning of the files. For example:

<?xml version="1.0" encoding="utf-8"?>
<?xml-model href="https://raw.githubusercontent.com/citation-style-language/schema/master/csl.rnc" type="application/relax-ng-compact-syntax"
  schematypens="http://relaxng.org/ns/compatibility/annotations/1.0"?>
<?xml-model href="https://raw.githubusercontent.com/citation-style-language/schema/master/csl.rnc" type="application/relax-ng-compact-syntax"
  schematypens="http://purl.oclc.org/dsdl/schematron"?>
adam3smith commented 8 years ago

That seems like a lot of duplicate text, no? I'm using emacs and you can pretty easily add this to your schema declaration for the validator, which seems like a better place. The same has got to be possible in Oxygen?

rmzelle commented 8 years ago

oXygen doesn't automatically recognize embedded Schematron? That would eliminate a line.

Is xml-model supported by any other tools? Despite the W3C working note (http://www.w3.org/TR/xml-model/), Emacs's nxml-mode (still) doesn't seem to: http://www.emacswiki.org/emacs/NxmlMode and https://bugs.launchpad.net/ubuntu/+source/nxml-mode/+bug/586735.

I'm hesitant to add this, because: a) linking to raw.githubusercontent.com content isn't really desired (see https://rawgit.com/faq; although we could of course always host copies of the schema elsewhere), b) this adds considerable bulk to dependent styles (which are typically only 15-20 lines), and c) the number of CSL style authors that actually use an XML editor seems limited.

adunning commented 8 years ago

Typical problem of XML technology itself being reasonably good but very poorly implemented. Oxygen supports embedded Schematron, but it seems one has to tell it that the file contains this. According to the spec, one also shouldn't need to define schematypens for RNC, but Oxygen doesn't validate properly without it.

The reasons for suggesting this are entirely about discoverability and improving the experience of editing a file by hand. While one can manually define schemata, it's really a pain. I didn't even realize for the longest time that using an XML editor made any difference – which it really does. If we want the schema to have any chance of actually making it to an editor, this is the way to do it. But obviously there may be other technical considerations that outweigh this,

stale[bot] commented 5 years ago

This issue hasn't seen any activity in the past 30 days. It will be automatically closed if no further activity occurs in the next two weeks.

rmzelle commented 5 years ago

Probably still worth considering.

Regarding my concern about linking directly to GitHub files served over https://raw.githubusercontent.com/, I just came across a blog post on https://rawgit.com/ mentioning that RawGit will be shut down, but it suggests using the jsDelivr CDN, which might be a good fit for us. E.g.: https://cdn.jsdelivr.net/gh/citation-style-language/schema@1.0.1/csl.rnc

And regarding xml-model, it looks like one of the main Atom packages for RELAX NG schema validation, linter-autocomplete-jing, offers support, so next to Oxygen that makes two. https://github.com/aerhard/linter-autocomplete-jing/tree/master/spec/validation/xml has a number of XML examples that define their schemas. nxml still looks to be AWOL.

adunning commented 5 years ago

Could it be served somehow through GitHub Pages? See https://digitallatin.github.io/guidelines/ for an example. It has never given me problems with either Oxygen or Atom.

rmzelle commented 5 years ago

Yes, that should be a good solution as well (we could probably have either https://schema.citationstyles.org/ or https://citationstyles.org/schema/). The benefit is that that likely should be more stable than jsDelivr long term, and the citationstyles.org domain is under our control. The main drawback is that we would have to sync it with the schema repo. With jsDelivr, we can refer directly to the various schema versions.