[relaxng-user] trang and xsd-friendly schemas

Bruce D'Arcus bdarcus at fastmail.fm
Mon Sep 13 08:43:49 ICT 2004


On Sep 13, 2004, at 8:13 AM, Sebastian Rahtz wrote:

> I am not sure you can solve this without having a clear plan of why 
> you are writing
> schemas, who uses them, when, what problems they solve etc.

The schema in question is a citation style schema; an xml equivalent to 
bibtex .bst files.  I am designing it alongside the XSLT code that will 
format the citations and bibliographies.

In my ideal world, it (or something like it) completely replaces both 
.bst files and the proprietary binary files in commercial applications 
like Endnote.  Intended users are thus scholars (like me), students, 
and researchers across a wide range of disciplines, most of whom -- if 
it is successful -- would never see the XML anyway.  Indeed, I want 
this to be usable in the bibliographic project at OpenOffice.

There are a number of problems with existing citation style languages.  
The most important is that they are too complicated (the other is they 
have dumb data models that mean styles aren't very portable).  This is 
partly a language/syntax issue, but partly about basic design.

In my case, I am basing the design on the principle that while authors 
want a fair bit of flexibility in micro-details like where commas go, 
it is better to enforce more rigorous structure otherwise.  My design 
aims to make styles easier to write and maintain, as well as more 
portable across research fields.

So, I say citation styles are grouped into a small number of broad 
classes, which gets encoded in an attribute value on the root like so:

	<citationstyle class="author-year">

I then use that to drive the rest of the schema.  When the user lays 
out the citation definition, for example, they can only specific 
author, year, and point (page numbers).  By contrast, if they use a 
footnote class, they have access to the full range of options.

So here I'm using one RELAX NG-only feature, and I'm doing it because 
a) it's easier for users, and b) it reflects the entire logic of the 
code behind it (the XSLT formatting, but also ultimately any sort of 
GUI that represents it).

The other place I am drawing on the expressive power of RNG to some 
extent is on how users actually define formatting for bibliographies.  
I require definitions for book, chapter, and article because a) they 
are the most commonly cited resources and authors are familiar with 
them, and b) they each represent different more abstract structural 
classes, and so can serve as fallbacks.

So, current code forces definitions for these three types.  If there is 
nothing else there, everything would get mapped by the XSLT to those 
types; a legal case would get formatted like an article because they 
are structurally equivalent.

I then add a mechanism to allow other types, where those types can 
optionally inherit from the required types.

The question is how to allow for this extensibility.  Currently, I just 
don't control the optional types, but that creates the 
non-deterministic problem.  If I define the types upfront, that is an 
artificial limitation (e.g. I have no idea what sort of types different 
users in different communities might want to define).

Bruce




More information about the relaxng-user mailing list