Convert CSL schema to xsd

In my search for the best CSL editor I’ve tried to convert the rnc-schema to xsd, but no success so far.

I have tried this:

  1. Merge with jing
  2. convert with trang
jing -s csl.rnc > csl-temp.rnc" 
trang csl-temp.rnc csl.xsd

Here I’ll end up with an syntax error message (“csl/csl-temp.rnc:1:1: error: syntax error”).

Next try: Convert in one step:

trang csl.rnc csl.xsd

Here, I’ll end up with “csl.rnc:619:8: warning: choice between attributes and children cannot be represented; approximating”
If I use this to validate a style in VS Code it says “Cannot find the declaration of element ‘style’”

Any ideas?

Sorry I missed this earlier.

Why are you wanting to convert it?

RNG is a richer language than XSD, and relies on at least one of those features (interleave); that’s why you get that error.

So it’s possible an editor validating against an XSD conversion would flag some/many styles as invalid, or that it could create “valid” files that are not valid against the RNG schema.

Ok, I see.

I prefer VScode to Atom, but I cannot use RNG with the available XML helper packages. XSD would be an option though. But not if this could produce false negatives/positives…

To be clear, I’m just speculating. Interleave allows you to specify an unordered list of requirements. Normally, to convert that to a language that does not support unordered statements (like XSD), you’d need a looser definition.

So logically, what I suggest is possible. Not sure how big a practical problem it is though.

You could experiment a bit.

For Atom-based RNG validation, while I haven’t touched it in a long time, this worked the last time I tested!

That does/did work, but Atom is no longer maintained. Among other things, github integration is broken, which makes it much less fun to work with.
There is now theoretically RNG validation support in VS-Code, but Dennis and I haven’t been able to get that to work when we last tried.

Has anyone tried the atom fork, yet? https://pulsar-edit.dev/

Doh; forgot about that!

On pulser, no. I have VSCode install, but don’t really use it. Maybe you should @Denis_Maier?

Emacs nxml-mode is still a really good XML editor, created by the guy that created RNG/RNC.

You mean this?

I tried to figure it out, but ran into a brick wall of a massively annoying config process. Like, not only does it not work ATM, but I can’t figure out why; there’s no indication I can see of whether it’s trying to use a schema, and why it may not actually be (bad path? something else?).

Compare that to NXML-mode:

If one of us can figure it out, perhaps we can document it somewhere?

Here’s what I had for the catalog file, which should work, since it’s independent of file paths:

<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
  <uri
    name="http://purl.org/net/xbiblio/csl"
    uri="~/csl/schema/csl.rnc" />
</catalog>

Here’s @Denis_Maier and my attempts to get this to work: Schema validation in VS Code · Issue #6272 · citation-style-language/styles · GitHub