added a simple validation script
[acawiki-csl] / scripts / csl.rnc
1 namespace atom = "http://www.w3.org/2005/Atom"
2 namespace cs = "http://purl.org/net/xbiblio/csl"
3 namespace dc = "http://purl.org/dc/elements/1.1/"
4 namespace s = "http://www.ascc.net/xml/schematron"
5 namespace xhtml = "http://www.w3.org/1999/xhtml"
6
7 dc:title [ "Citation Style Language" ]
8 dc:creator [ "Bruce D'Arcus" ]
9 dc:creator [ "Simon Kornblith" ]
10 dc:copyright [ "Bruce D'Arcus and Simon Kornblith, 2007" ]
11 dc:rights [ "Permission to freely use, copy and distribute." ]
12 dc:description [
13   "Citation Style Language (CSL) schema for describing bibliographic and citation formatting."
14 ]
15 start = style
16
17 ## The CSL data model consists of resources and variables. Primary resources are the 
18 ## citation object itself, as well as related agents and events. Variables are 
19 ## attributes of the resource: titles, dates, volume numbers, and so forth. From the 
20 ## perspective of CSL, resources templates involve a list of variables. By contrast, 
21 ## a variable can be accessed directly.
22 ## In addition, CSL also contains structures for macros and parameter options.
23 div {
24   style =
25     element cs:style {
26       attribute xml:lang { xsd:language }?,
27       
28       ## Refers to the default locale for the style; should generally 
29       ## be set for any academic journal, since it can be used to ensure 
30       ## proper quote formatting and such.
31       attribute default-locale { xsd:language }?,
32       attribute class { "in-text" | "note" },
33       info,
34       (terms? & macro* & citation & bibliography?)?
35     }
36 }
37
38 ## info element
39 div {
40   
41   ## The Content model for the metadata is borrowed from Atom.
42   info =
43     element cs:info {
44       info-author*
45       & info-category*
46       & info-contributor*
47       & info-id
48       & info-issn?
49       & info-link*
50       & info-published?
51       & info-rights?
52       & info-source?
53       & info-summary?
54       & info-title
55       & info-updated
56     }
57   info-text =
58     attribute xml:lang { xsd:language }?,
59     text
60   info-author = element cs:author { info-Contributor-pattern }
61   info-Contributor-pattern =
62     element cs:name { text }
63     & element cs:email { text }?
64     & element cs:uri { xsd:anyURI }?
65   div {
66     
67     ## The schema attribute should be understood to specify the controlled 
68     ## CSL category list. The terms thus typically include further logic, 
69     ## such as the broader categories to which they belong ("humanities", 
70     ## "social sciences") as well as the class of style ("author-date", "note", etc.).
71     info-category =
72       element cs:category {
73         attribute term { info-fields | info-classes },
74         attribute scheme { xsd:anyURI }?,
75         attribute label { text }?
76       }
77     
78     ## Add one or more field categories. The "generic-base" category is reserved 
79     ## for the handful of truly generic styles (APA, Harvard, etc.) from which most descend.
80     info-fields =
81       "anthropology"
82       | "astronomy"
83       | "biology"
84       | "botany"
85       | "chemistry"
86       | "communications"
87       | "engineering"
88       | "generic-base"
89       | "geography"
90       | "geology"
91       | "history"
92       | "humanities"
93       | "law"
94       | "linguistics"
95       | "literature"
96       | "math"
97       | "medicine"
98       | "philosophy"
99       | "physics"
100       | "psychology"
101       | "sociology"
102       | "science"
103       | "political_science"
104       | "social_science"
105       | "theology"
106       | "zoology"
107       | info-categories.extension
108     info-classes = "author-date" | "numeric" | "label" | "note" | "in-text"
109     
110     ## You can override in a customization schema, though please report 
111     ## obvious gaps for inclusion in the schema.
112     info-categories.extension = notAllowed
113   }
114   info-contributor = element cs:contributor { info-Contributor-pattern }
115   info-translator = element cs:translator { info-Contributor-pattern }
116   
117   ## As in Atom, the cs:id element is a required URI that is globally-unique 
118   ## and persistant. Once assigned it should never change. Ideally, of course, 
119   ## the URI resolves to the correct CSL file.
120   info-id = element cs:id { string }
121   info-link =
122     element cs:link {
123       attribute href { xsd:anyURI },
124       
125       ## For transformation to Atom, the rel values should be expanded to include the 
126       ## base URI <http://purl.org/net/xbiblio/csl/relations#>.
127       attribute rel {
128         
129         ## The CSL file URI whose configuration content should be 
130         ## used for processing. To be used where, for example, a 
131         ## journal may use a generic publisher style that is shared 
132         ## with other journals.
133         "source"
134         | 
135           ## The CSL file URI on which the style is based. Since most 
136           ## styles are based on a handful of core styles, this can be 
137           ## useful metadata to see those relationships.
138           "template"
139         | 
140           ## The homepage URI for the style.
141           "homepage"
142         | 
143           ## A documentation URI for a style.
144           "documentation"
145       }?,
146       # type borrows from Atom schema pattern
147       
148       ## media-type
149       attribute type {
150         xsd:string { pattern = ".+/.+" }
151       }?,
152       attribute hreflang { xsd:language }?,
153       attribute title { text }?,
154       attribute length { text }?,
155       string
156     }
157   info-published = element cs:published { xsd:dateTime }
158   info-rights = element cs:rights { info-text }
159   info-source = element cs:source { info-title & info-link? & info-id }
160   info-summary = element cs:summary { info-text }
161   info-title = element cs:title { info-text }
162   ## the issn for the journal the style corresponds to
163   # might use a regular expression pattern to validate content?
164   info-issn = element cs:issn { text }
165   info-updated = element cs:updated { xsd:dateTime }
166 }
167
168 ## Terms and forms
169 div {
170   cs-terms =
171     
172     ## Miscellaneous Terms
173     "accessed"
174     | "anonymous"
175     | "and"
176     | "and others"
177     | "at"
178     | "et-al"
179     | "forthcoming"
180     | "from"
181     | "in press"
182     | "ibid"
183     | "in"
184     | "no date"
185     | "references"
186     | "retrieved"
187     | "letter"
188     | "interview"
189     | "online"
190     | "cited"
191     | "edition"
192     | "internet"
193     | "presented at"
194     | 
195       ## Roles
196       "editor"
197     | "translator"
198     | "interviewer"
199     | "recipient"
200     | 
201       ## Months
202       "month-01"
203     | "month-02"
204     | "month-03"
205     | "month-04"
206     | "month-05"
207     | "month-06"
208     | "month-07"
209     | "month-08"
210     | "month-09"
211     | "month-10"
212     | "month-11"
213     | "month-12"
214     | 
215       ## Other
216       cs-terms.locator
217     | cs-terms.extension
218     | info-fields
219   
220   ## Locators
221   cs-terms.locator =
222     "book"
223     | "chapter"
224     | "column"
225     | "figure"
226     | "folio"
227     | "issue"
228     | "line"
229     | "note"
230     | "opus"
231     | "page"
232     | 
233       ## a synonym for "page" (to be deprecated)
234       "page-range"
235     | "page-first"
236     | "paragraph"
237     | "part"
238     | "section"
239     | "sub verbo"
240     | "volume"
241     | "verse"
242   
243   ## "symbol" and reverts to "short" if no term exists
244   ## "verb-short" reverts to "verb" if no term exists
245   ## all others revert to "long" if no term exists
246   cs-term-forms = "long" | "verb" | "short" | "verb-short" | "symbol" | cs-term-forms.extension
247   
248   ## include-period adds a period after a term if and only if the
249   ## term used (not necessarily term specified; see above) is
250   ## of form "short" or "verb-short"
251   include-period = attribute include-period { xsd:boolean }?
252   
253   ## Extension structures. You may override these in a customization 
254   ## schema. If you do, please contact the xbiblio project to add 
255   ## the term or form to the formal controlled list in the schema.
256   div {
257     cs-terms.extension = notAllowed
258     cs-term-forms.extension = notAllowed
259   }
260 }
261
262 ## Locales
263 div {
264   
265   ## Terms are localized strings used as content for the cs:text field. 
266   ## It is only needed where you need to add a term not supported by 
267   ## default, or override an existing one.
268   terms = element cs:terms { locale+ }
269   
270   ## A language-specific wrapper.
271   locale =
272     element cs:locale {
273       
274       ## Where localization is other than that of the style, use the 
275       ## xml:lang attribute.
276       attribute xml:lang { xsd:language }?,
277       (simple-term | compound-term)+
278     }
279   term-attributes =
280     attribute form { cs-term-forms }?,
281     attribute name { cs-terms },
282     include-period
283   
284   ## Simple terms are basic strings, used to represent genres, media, etc.
285   simple-term = element cs:term { term-attributes, text }
286   
287   ## Compound terms are those whose output can be either singular or plural. 
288   ## Typically used for things like page number or editor labels.
289   compound-term = element cs:term { term-attributes, single-term, multiple-term }
290   multiple-term = element cs:multiple { text }
291   single-term = element cs:single { text }
292 }
293
294 ## Names is a data type holding a text of authors, editors, or translators.
295 div {
296   names-attributes =
297     formatting,
298     delimiter,
299     attribute variable {
300       list { cs-names+ }
301     }
302   names = element cs:names { names-attributes, (name & name-label*), substitute? }
303   
304   ## Short version of "names" element, without children, allowed in <substitute>
305   names-short = element cs:names { names-attributes }
306   name =
307     element cs:name {
308       formatting,
309       
310       ## Indicates long (first name + last name, for Western names) or short
311       ## (last name only, for Western names) form of name. Default is long
312       ## form
313       attribute form { "long" | "short" }?,
314       
315       ## Controls appearance of "and"/"&". To disable, do not specify.
316       attribute and { "text" | "symbol" }?,
317       
318       ## Delimiter between names (delimiter between variables is on <names>
319       ## tag, where it should be). This is ", " in "J. Doe, S. Smith."
320       delimiter,
321       
322       ## delimiter for the last name is a list
323       attribute delimiter-precedes-last {
324         
325         ## The "always" value means that result is "J. Doe, and T. Timmons"
326         "always"
327         | 
328           ## Default behavior; would result in "J. Doe and T. Timmons," but "J. Doe,
329           ## S. Smith, and T. Timmons" (note comma preceding 'and').
330           "never"
331       }?,
332       
333       ## Sets the first-author name order to correspond to the sort order of
334       ## the bibliography; e.g. Doe, John (name-as-sort-order) vs. John Doe (w/o
335       ## attribute).
336       attribute name-as-sort-order { "first" | "all" }?,
337       
338       ## The delimiter for personal name parts where sort order differs from 
339       ## display order (for example, in standard Western names). This is the
340       ## ", " in "Doe, John."
341       attribute sort-separator { text }?,
342       
343       ## Indicates whether given name parts ought to be given as initials
344       ## (e.g., J. K. Rowling) and the text to follow each initial.
345       attribute initialize-with { text }?
346     }
347   
348   ## Similar to label as below, but inherits variable from <names> tag
349   name-label = element cs:label { label-primitives }
350   
351   ## Substitutions, if the name does not exist
352   substitute = element cs:substitute { (names-short | cs-element)+ }
353   cs-names =
354     "author"
355     | "editor"
356     | "translator"
357     | "recipient"
358     | "interviewer"
359     | "publisher"
360     | "composer"
361     | "original-publisher"
362     | "original-author"
363     | 
364       ## to be used when citing a section of a book, for example, to distinguish the author 
365       ## proper from the author of the containing work
366       "container-author"
367     | 
368       ## use for series editor
369       "collection-editor"
370 }
371
372 ## date
373 div {
374   date =
375     element cs:date {
376       attribute variable {
377         list { cs-date-tokens+ }
378       },
379       formatting,
380       delimiter,
381       date-part+
382     }
383   date-part = element cs:date-part { formatting, (month | day | year-other) }
384   
385   ## Month formats:
386   ##     long (default): January
387   ##     short: Jan
388   ##     numeric: 1
389   ##     numeric-leading-zeros: 01
390   month =
391     attribute name { "month" },
392     (attribute form { "long" | "short" | "numeric" | "numeric-leading-zeros" }?,
393      include-period)
394   
395   ## Day formats:
396   ##     numeric (default): 5
397   ##     numeric-leading-zeros: 05
398   ##     ordinal: 5th
399   day =
400     attribute name { "day" },
401     attribute form { "numeric" | "numeric-leading-zeros" | "ordinal" }?
402   
403   ## Year formats:
404   ##     long (default): 2005
405   ##     short: 05
406   ## Other represents any non-month/day/year date part
407   year-other =
408     attribute name { "year" | "other" },
409     attribute form { "short" | "long" }?
410   cs-date-tokens = "issued" | "event" | "accessed" | "container" | "original-date" | "submitted"
411 }
412
413 ## The cs:text element is the main formatting element used to layout down content.
414 div {
415   cs-text =
416     element cs:text {
417       formatting,
418       ((((
419           ## adds a variable belonging to this item
420           attribute variable {
421             list { variables+ }
422           }
423           & delimiter)
424          | 
425            ## adds the results of a macro, as specified in the main body of the CSL
426            attribute macro { token }
427          | 
428            ## A descriptor that locates sub-item content within a cited resource. Used
429            ## in some styles to indicate specific page numbers for excerpted
430            ## content, for example.
431            attribute point-locator { cs-terms.locator }),
432         attribute form { "short" | "long" }?)
433        | (
434           ## adds a localized term
435           attribute term { cs-terms },
436           attribute form { cs-term-forms }?,
437           include-period,
438           plural?)
439        | 
440          ## adds the text in the value field. use sparingly.
441          ## when dealing with localizable text, <text term="(term)"/> should be
442          ## used, even if this means defining a new term.
443          attribute value { text })
444     }
445   
446   ## The number markup directive matches the first number found in a field, 
447   ## and returns only that component. If no number is detected, the result 
448   ## is empty. A non-empty number may be subject to further formatting consisting 
449   ## of a form attribute whose value may be numeric, ordinal or roman to format 
450   ## it as a simple number (the default), an ordinal number (1st, 2nd, 3rd etc) 
451   ## or roman (i, ii, iii, iv etc). The text-case can also apply to capitalize 
452   ## the roman numbers for instance. The other normal formatting rules apply 
453   ## too (font-style, ...). When used in a conditional, number tests if 
454   ## there is a number present, allowing conditional formatting.
455   cs-number =
456     element cs:number {
457       formatting,
458       attribute variable { "edition" | "volume" | "issue" | "number" | "number-of-volumes" },
459       attribute form { "numeric" | "ordinal" | "roman" }?
460     }
461   variables =
462     
463     ## the primary title for the cited item
464     "title"
465     | 
466       ## the secondary title for the cited item; for a book chapter, this 
467       ## would be a book title, for an article the journal title, etc.
468       "container-title"
469     | 
470       ## the tertiary title for the cited item; for example, a series title
471       "collection-title"
472     | 
473       ## collection number; for example, series number
474       "collection-number"
475     | 
476       ## title of a related original version; often useful in cases of translation
477       "original-title"
478     | 
479       ## the name of the publisher
480       "publisher"
481     | 
482       ## the location of the publisher
483       "publisher-place"
484     | 
485       ## the name of the archive
486       "archive"
487     | 
488       ## the location of the archive
489       "archive-place"
490     | 
491       ## the location within an archival collection (for example, box and folder)
492       "archive_location"
493     | 
494       ## issuing authority (for patents) or judicial authority (such as court  
495       ## for legal cases)
496       "authority"
497     | 
498       ## the name or title of a related event such as a conference or hearing
499       "event"
500     | 
501       ## the location or place for the related event
502       "event-place"
503     | 
504       ##
505       "page"
506     | 
507       ## a description to locate an item within some larger container or 
508       ## collection; a volume or issue number is a kind of locator, for example.
509       "locator"
510     | 
511       ## version description
512       "version"
513     | 
514       ## volume number for the container periodical
515       "volume"
516     | 
517       ## refers to the number of items in multi-volume books and such
518       "number-of-volumes"
519     | 
520       ## refers to the number of pages in a book or other document
521       "number-of-pages"
522     | 
523       ## the issue number for the container publication
524       "issue"
525     | 
526       ##
527       "chapter-number"
528     | 
529       ## medium description (DVD, CD, etc.)
530       "medium"
531     | 
532       ## the (typically publication) status of an item; for example "forthcoming"
533       "status"
534     | 
535       ## an edition description
536       "edition"
537     | 
538       ## a section description (for newspapers, etc.)
539       "section"
540     | 
541       ##
542       "genre"
543     | 
544       ## a short inline note, often used to refer to additional details of the resource
545       "note"
546     | 
547       ## notes made by a reader about the content of the resource
548       "annote"
549     | 
550       ##
551       "abstract"
552     | 
553       ##
554       "keyword"
555     | 
556       ## a document number; useful for reports and such
557       "number"
558     | 
559       ## for related referenced resources; this is here for legal case 
560       ## histories, but may be relevant for other contexts.
561       "references"
562     | 
563       ##
564       "URL"
565     | 
566       ##
567       "DOI"
568     | 
569       ##
570       "ISBN"
571     | 
572       ##
573       "call-number"
574     | 
575       ## the number used for the in-text citation mark in numeric styles
576       "citation-number"
577     | 
578       ## the label used for the in-text citation mark in label styles
579       "citation-label"
580     |
581       ## The number of a preceding note containing the first reference to
582       ## this item. Relevant only for note-based styles, and null for first references.
583       "first-reference-note-number"
584     |
585       ## The year suffix for author-date styles; e.g. the 'a' in '1999a'.
586       "year-suffix"
587 }
588 ## The cs:label element.
589 div {
590   
591   ## The label element is used to print text terms that depend on document content
592   ## for pluralization. For labeling pages, this is preferable, as pages may be
593   ## either singular or plural (p. or pp.)
594   label =
595     element cs:label {
596       label-primitives,
597       attribute variable { "page" | "locator" }
598     }
599   label-primitives =
600     formatting,
601     include-period?,
602     attribute form { cs-term-forms },
603     
604     ## On cs:label, use to modify default pluralization behavior. 
605     plural?
606   
607   ## modifies plualization behavior [ a:defaultValue = "contextual" ]
608   plural = attribute plural { xsd:boolean }
609 }
610
611 ## The cs:macro element
612 div {
613   
614   ## The macro element works something like in BibTeX, and provides a ready-made 
615   ## bundle of formatting templates that can be easily reusesd elsewhere.
616   macro =
617     element cs:macro {
618       attribute name { token },
619       cs-element+
620     }
621 }
622
623 ## The cs:group element
624 div {
625
626   ## Group is used to provide delimiters and a common prefix/suffix. It is syntactic 
627   ## sugar for a conditional that tests for the presence of any non-null child variable 
628   ## or macro call results. So if there are no such results, then any <text term="(term)"> 
629   ## content will not be printed.
630   group =
631     element cs:group {
632       formatting,
633       delimiter,
634       ## the class attribute can be used to pass on styling hooks for CSS and such
635       attribute class { token }?,
636       cs-element+
637     }
638 }
639 div {
640   layout = element cs:layout { formatting, delimiter, cs-element }
641   cs-element = (names | date | label | cs-text | cs-number | choose | group)+
642 }
643
644 ## The cs:citation element
645 div {
646
647   ## The cs:citation handles printing of citations. A citation may consist of 
648   ## one-or-more references to bibliographic sources. These references can either 
649   ## be simple in-text keys [doe99] or numeric markers [1], or more complex short 
650   ## descriptors generated at runtime common in author-date (Doe, 1999a) or note-based
651   ## styles.  
652   ## note: one issue unique to note-based styles is that a citation reference 
653   ## effectively may become a full sentence. Implementers should consider this in 
654   ## their design and insert the final formatted citation in the correct title form.
655   ## For example, if a citation is footnoted without any additional text, the first 
656   ## character of the output should be uppercased. By contrast, if the citation is 
657   ## within a pre-existing footnote, and preceded by non-citation text, then it should 
658   ## be printed as is.
659   citation = element cs:citation { (citation-options* & sort?), layout }
660 }
661
662 ## The cs:bibliography element
663 div {
664   bibliography = element cs:bibliography { (bibliography-options* & sort?), layout }
665 }
666
667 ## The cs:option element
668 div {
669   citation-options = et-al | et-al-subsequent | disambiguate | collapse
670   bibliography-options =
671     et-al | hanging-indent | second-field-align | subsequent-author-substitute | line-formatting | group-by
672   
673   ## Pattern for options that are either true or false
674   option-tf = attribute value { xsd:boolean }
675
676   ## Sorting and grouping by author assumes by default that the string includes the entire list 
677   ## of authors. This option allows you to instead use first author only.
678   group-by = 
679     element cs:option {
680       attribute name { "group-by" },
681       attribute value { "first-author" }
682     }
683   
684   ## sets the bibliographic entries to be rendered with hanging-indents
685   hanging-indent =
686     element cs:option {
687       attribute name { "hanging-indent" },
688       option-tf
689     }
690   
691   ## "citation-number" collapses numeric citations from [1, 2, 3] to [1-3]
692   ## "year" collapses authors from (Doe 2000, Doe 2001) to (Doe 2000,
693   ##   2001)
694   ## "year-suffix" collapses as "year", but also collapses (Doe 2000a,
695   ##   Doe 2000b) to (Doe 2000a, b) (ignored if
696   ##   disambiguate-add-year-suffix is missing)
697   collapse =
698     element cs:option {
699       attribute name { "collapse" },
700       attribute value { "citation-number" | "year" | "year-suffix" }
701     }
702   
703   ## second-field-align is useful for formatting a numbered list. It aligns
704   ## any subsequent lines of a bibliography entry with the beginning of the
705   ## second field. For example, if the first field is
706   ## <text variable="citation-number" suffix=". "/>
707   ## 
708   ## 1. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do
709   ##    eiusmod
710   ## 
711   ## If set to "margin," then the first field is put in the margin and all
712   ## subsequent lines of text are aligned with the margin. This is useful for
713   ## IEEE style.
714   second-field-align =
715     element cs:option {
716       attribute name { "second-field-align" },
717       attribute value { "true" | "margin" }
718     }
719   
720   ## substitutes subsequent recurrences of an author for a given string
721   subsequent-author-substitute =
722     element cs:option {
723       attribute name { "subsequent-author-substitute" },
724       attribute value { text }
725     }
726   
727   ## defines parameters relating to "et al" formatting:
728   ##     et-al-min: the minimum number of contributors to use "et al"
729   ##     et-al-use-first: the number of contributors to explicitly print under
730   ##          "et al" conditions
731   ##     et-al-subsequent-*: same as above, but for subsequent references
732   ##                         (citation only)
733   et-al =
734     element cs:option {
735       attribute name { "et-al-min" | "et-al-use-first" },
736       attribute value { xsd:integer }
737     }
738   et-al-subsequent =
739     element cs:option {
740       attribute name { "et-al-subsequent-min" | "et-al-subsequent-use-first" },
741       attribute value { xsd:integer }
742     }
743   
744   ## defines parameters relating to disambiguation, followed in the order given
745   ## below until a citation is disambiguated
746   ##     disambiguate-add-names: add additional names, disregarding
747   ##          the "et-al" setting, to disambiguate the citations
748   ##     disambiguate-add-givenname: add a given name to a citation
749   ##          to disambiguate it (e.g., John Doe, 2005 vs. Doe, 2005)
750   ##     disambiguate-add-year-suffix: add a suffix to the year (e.g.,
751   ##          2007a) when there are two works by the same author published in
752   ##          the same year included in one bibliography
753   disambiguate =
754     element cs:option {
755       attribute name {
756         "disambiguate-add-givenname" | "disambiguate-add-names" | "disambiguate-add-year-suffix" 
757       },
758       option-tf
759     }
760   # defines spacing between entries and between lines
761   #     line-spacing: in units of lines; default 1
762   #     entry-spacing: in units of line-spacing; default 1
763   line-formatting =
764     element cs:option {
765       attribute name { "line-spacing" | "entry-spacing" },
766       attribute value { xsd:integer }
767     }
768 }
769
770 ## The cs:sort element
771 div {
772   all-variables = variables | cs-date-tokens | cs-names
773   
774   ## The sort element specifies the sort order for a citation or for the
775   ## bibliography. If it is not added, citations are sorted according to user
776   ## preferences, and bibliography is sorted according to order cited.
777   sort = element cs:sort { key+ }
778   key =
779     element cs:key {
780       (attribute variable { all-variables }
781        | attribute macro { token }),
782       
783       ## Default sort order is ascending
784       attribute sort { "ascending" | "descending" }?
785     }
786 }
787
788 ## The cs:choose element
789 div {
790   
791   ## The choose elements provides a simple conditional structure.
792   choose = element cs:choose { if, else-if*, else? }
793   if = element cs:if { condition, cs-element* }
794   else-if = element cs:else-if { condition, cs-element* }
795   else = element cs:else { cs-element+ }
796   condition =
797     
798     ## If the entry is of a given type, this is true
799     attribute type {
800       list { cs-types+ }
801     }?,
802     
803     ## If a given variable exists, this is true
804     attribute variable {
805       list { all-variables+ }
806     }?,
807     
808     ## If a given variable contains numeric data, this is true
809     attribute is-numeric {
810       list { all-variables+ }
811     }?,
812     
813     ## If a given variable contains a date, this s true
814     attribute is-date {
815       list { all-variables+ }
816     }?,
817     
818     ## The position of a citation. Whenever position="ibid-with-locator"
819     ## is true, position="ibid" is also true, and whenever position="ibid"
820     ## is true, position="subsequent" is also true
821     attribute position {
822       list { ("first" | "subsequent" | "ibid" | "ibid-with-locator")+ }
823     }?,
824     
825     ## If text inside an <if disambiguate="true"> block can be used to
826     ## differentiate two otherwise identical citations, it will be added.
827     ## If the citations remain identical after its addition, it will not
828     ## be added.
829     attribute disambiguate { xsd:boolean }?,
830     
831     ## A conditional on the locator for this specific entry
832     attribute locator { 
833        list { cs-terms.locator+ } 
834     }?,
835     attribute match { "all" | "any" | "none" }?
836 }
837
838 ## variables and types; needs some more thought
839 div {
840   cs-types =
841     "article"
842     | "article-magazine"
843     | "article-newspaper"
844     | "article-journal"
845     | "bill"
846     | "book"
847     | "broadcast"
848     | "chapter"
849     | "entry"
850     | "entry-dictionary"
851     | "entry-encyclopedia"
852     | "figure"
853     | "graphic"
854     | "interview"
855     | "legislation"
856     | "legal_case"
857     | "manuscript"
858     | "map"
859     | "motion_picture"
860     | "musical_score"
861     | "pamphlet"
862     | "paper-conference"
863     | "patent"
864     | "post"
865     | "post-weblog"
866     | "personal_communication"
867     | "report"
868     | "review"
869     | "review-book"
870     | "song"
871     | "speech"
872     | "thesis"
873     | "treaty"
874     | "webpage"
875 }
876
877 ## Formatting attributes.
878 div {
879   delimiter = attribute delimiter { text }?
880   
881   ## attributes are drawn directly from CSS and FO where possible
882   formatting =
883     attribute prefix { text }?,
884     attribute suffix { text }?,
885     attribute font-family { text }?,
886     attribute font-style { "italic" | "normal" | "oblique" }?,
887     attribute font-variant { "normal" | "small-caps" }?,
888     attribute font-weight { "normal" | "bold" | "light" }?,
889     attribute text-decoration { "none" | "underline" }?,
890     attribute vertical-align { "baseline" | "sup" | "sub" }?,
891     attribute text-case {
892       
893       ## display all text as lowercase
894       "lowercase"
895       | 
896         ## display all text as uppercase
897         "uppercase"
898       | 
899         ## capitalize first character; other characters
900         ## displayed as is
901         "capitalize-first"
902       | 
903         ## capitalize first character of every word;
904         ## other characters displayed lowercase
905         "capitalize-all"
906       | 
907         ## display as title case (the Chicago Manual
908         ## of Style calls this "headline style")
909         "title"
910       | 
911         ## display as sentence case/sentence style
912         "sentence"
913     }?,
914     
915     ## For examples such as abstracts and notes in annotated bibliographies 
916     ## use the "block" display value. Otherwise, content is displayed inline.
917     attribute display { "block" | "inline-block" }?,
918     attribute quotes { xsd:boolean }?
919 }

Benjamin Mako Hill || Want to submit a patch?