Editing Styles

Manual editing

At this point there are no dedicated tools to create or modify CSL styles. However, styles can be edited manually in any (plain) text editor (e.g. Notepad on Windows and TextEdit on Mac OS X). Note that text editors with XML support can be of great benefit by offering features like syntax highlighting and real-time validation. Popular choices are the oXygen XML Editor, emacs in nXML mode, and jEdit (the latter does not offer RELAX NG XML validation).

The following sources are good starting points to learn how to edit CSL styles:

CSL 0.8 tutorials:

CSL 1.0 tutorials:

Validation

Validating edited CSL styles (or “locales-xx-XX.xml” localization files) against the Citation Style Language schema is crucial for obtaining the desired citation formatting. The Citation Style Language schema is authored in Relax NG Compact, for which the following validation options are available:

  • oXygen XML Editor: real-time validating editor (commercial)
  • emacs nXML mode: real-time validating mode for Emacs (open source)
  • RNV: command-line utility (open source)
  • Jing: command-line utility (open source)
  • Validator.nu: online XML validator (open source). Instructions:

    1. Select the style or localization file to be validated. When using the “Text Field” option, make sure to select the “XML; don’t load external entities” option for the “Parser” drop-down menu.
    2. Paste the schema link into the “Schemas” text field. The link for CSL 1.0: http://bitbucket.org/bdarcus/csl-schema/raw/855dcc00cba7/csl.rnc, and for CSL 0.8.1: http://bitbucket.org/bdarcus/csl-schema/raw/83f9cf9b53bd/csl.rnc.
    3. Check the option “Be lax about HTTP Content-Type”.
    4. Click the “Validate” button. The edited code is valid if the validator returns the output “The document validates according to the specified schema(s).” (yellow warnings can be ignored). If errors are reported, these should be fixed, after which a new attempt can be made to validate the style.