BetaMasaheft / Schema

TEI schema for project documents
1 stars 0 forks source link

Schema

TEI schemas for project documents.

This repo contains the schema and annotated template files to be used to enter new data while a proper form is prepared.

Project members can find more documentation as part of the project guidelines.

Contents

Build requirements

For creating a XAR file with the schemas:

Build instructions

Run

ant

or

ant xar

Generating Schema files locally

While the workflow is automated to run on CI, should you wish to process the ODDs locally, there are different alternatives.

Generating the Schema files with oXygen

If you have the XML editor oXygen, you can configure a transformation scenario (Ctrl + Shift + C). If the ODD files have the .odd extension (instead of .xml), oXygen already offers an associated scenario to this extension that converts the ODD to RELAXNG, so you only need to select this option.

From a file with the .xml extension, you need to create a new scenario, or even easier, modify one of the TEI existing scenarios to create the the ODD to RELAXNG one. To do so:

  1. Press Ctrl + Shift + C to open the Configure transformation scenario(s) window.
  2. Select one of ANT scenarios that appear, e.g. TEI P5 DOCX.
  3. Then click on Edit and a dialogue will offer you to create a copy instead and edit that copy. Accept.
  4. In the window that opens, you can change the name of the scenario (to ODD to RELAXNG for example).
  5. Update the build configuration. You can leave all the default options as they are, except for:
    • In the field Build file paste the following path: ${frameworksDir}/tei/xml/tei/stylesheet/relaxng/build-to.xml
    • Click on the Output tab and change in the field Open (at least) the extension of the output file. You can also define here the output folder (as default, oXygen creates a out folder but you can change that behaviour by having in the field Open the following path: ${cfd}/${cfn}.rng).

Generating the Schema files with the TEI toolkit

There are different options:

Generating the Schema files following the same process as on CI

Requirements

Validation

java -jar saxon-he-xx.x.jar -s:tei_odds.rng -xsl:extract-schematron.xslt -o:tei_odds.sch

Since at the moment TEIGarage cannot resolve local sources, we delete the @source attribute with sed in the derived ODD (the expanded version).

sed -i 's/ source="tei-betamesaheft_compiled.xml"//' tei-betamesaheft-expanded_compiled.xml 

After this change we can use TEIGarage for the RELAXNG transformation.

We check that the generated schemas are well-formed with xmllint. E.g.:

xmllint --noout tei-betamesaheft.rng 

Working with the Schema files

Your XML editor will recognize the <?xml-model?> instruction on the top of the XMLs files.

Your ODD files should be associated to the the tei_odds customisation:

<?xml-model href="http://www.tei-c.org/release/xml/tei/custom/schema/relaxng/tei_odds.rng" type="application/xml" schematypens="http://relaxng.org/ns/structure/1.0"?>
<?xml-model href="http://www.tei-c.org/release/xml/tei/custom/schema/relaxng/tei_odds.rng" type="application/xml" schematypens="http://purl.oclc.org/dsdl/schematron"?>

The project files should be associated to the RELAXNG files of this repository:

<?xml version="1.0" encoding="UTF-8"?><?xml-model href="https://raw.githubusercontent.com/BetaMasaheft/Schema/master/tei-betamesaheft.rng" 
schematypens="http://relaxng.org/ns/structure/1.0"?>
<?xml-model href="https://raw.githubusercontent.com/BetaMasaheft/Schema/master/tei-betamesaheft.rng" type="application/xml" schematypens="http://purl.oclc.org/dsdl/schematron"?>

A .xar package can be installed in eXist-db to make the RELAXNG schema files available via import statements.