genericode-validator is a tool for validating genericode files according to:
- the genericode XML schema;
- the genericode document rules;
- additional rules specified in this repository.
The installation instructions assume that the installation is done on a Windows computer.
- genericode-validator: clone this repository on your local machine (no releases are available at the moment);
- Java:
- Ensure you have a Java 11 (or later) installation;
- Ensure that environment variable
JAVA_HOMEis set and points to that Java installation;
- Saxon:
- Download and unzip the XSLT 3 processor Saxon into a suitable directory;
- Set environment variable
SAXON_CPto the location of the principal Saxon jar file, saxon-he-x.y.jar;
- Morgana:
- Download and unzip the XProc 3 processor Morgana into a suitable directory;
- Add the path to that directory to your user's Path environment variable;
- Place a copy of jar file saxon-he-x.y.jar in the MorganaXProc-IIIse\MorganaXProc-IIIse_lib folder.
- schxslt:
- Download the Schematron processor schxslt (schxslt-x.y.z-xslt-only.zip), extract the zip file and move the contents to an appropriate place.
- XSpec (only needed for development):
- Download/clone the unit testing framework XSpec
- Set the environment variable
XSPEC_HOMEto the location where XSpec is stored.
Create a file morgana-config.xml file in folder local-scripts.
<morgana-config xmlns="http://www.xml-project.com/morganaxproc">
<XSLTValidationMode>LAX</XSLTValidationMode>
<!-- See "Selecting the XSLTConnector" on https://www.xml-project.com/manual/ch02.html#configuration_s1_1_s2_2 -->
<xslt-connector>saxon12-3</xslt-connector>
<!-- See "Selecting the Schematron processor" on https://www.xml-project.com/manual/ch02.html#configuration_s1_1_s2_5 -->
<schematron-connector>schxslt</schematron-connector>
<path_to_SchXSLT_2>file:///path/to/schxslt-x.y.z/2.0</path_to_SchXSLT_2>
<!-- See "Adding media type mappings" on https://www.xml-project.com/manual/ch02.html#configuration_s1_5 -->
<mediatype-mapping>
<map file-extension="gc" media-type="application/xml" />
</mediatype-mapping>
</morgana-config>Customize morgana-config.xml:
- Customise the value of element
xslt-connectorto match the value specified for your version of Saxon as specified in https://www.xml-project.com/manual/ch02.html#configuration_s1_1_s2_2; - Customise the path in element
path_to_SchXSLT_2.
To check your configuration, run batch file print-configuration.bat in folder scripts from the root directory of the working tree of your local repository:
scripts\print-configuration.batThe output will show the versions of the applications needed by the sripts.
Note
XSpec is only needed for running the tests.
The usage instructions assume that the application is used on a Windows computer.
To validate one local genericode file, run batch file validate-genericode-main in folder scripts from the root directory of the working tree of your local repository:
scripts\validate-genericode-main.bat C:\path\to\codelist.gc C:\path\to\output-directoryTo validate all genericode files in a local directory, run batch file validate-genericode-main in folder scripts from the root directory of the working tree of your local repository:
scripts\validate-genericode-main.bat C:\path\to\input-directory C:\path\to\output-directoryTo validate one online genericode file, run batch file validate-genericode-main in folder scripts from the root directory of the working tree of your local repository:
scripts\validate-genericode-main.bat https://example.org/codelist.gc C:\path\to\output-directoryOpen the validation report(s) created in C:\path\to\output-directory in a browser.
Run the batch file without arguments to see all the options:
scripts\validate-genericode-main.batThe Schematron schemas are tested using XSpec, a unit test and behaviour-driven development (BDD) framework for XSLT, XQuery, and Schematron.
On Windows, the XSpec Schematron tests can be run using batch file run-schematron-tests.bat in the scripts folder. Run the batch file from the root directory of the repository:
scripts\run-schematron-tests.batOn Windows, the tests written in XProc can be run using batch file run-xproc-tests.bat in the scripts folder. Run the batch file from the root directory of the repository:
scripts\run-xproc-tests.batTo create and publish the validation rules documentation:
- Update both your local
mainandgh-pagesbranches so they match the corresponding branches in the central repository; - Create a new local branch, e.g.
doc, that has branchgh-pagesas start point and check that new branch out:git checkout -b doc gh-pages; - Merge branch
maininto the newly created branch:git merge main; - Run batch file
generate-docs.batfrom the root directory of the repository:scripts\generate-docs.bat; - Commit the files in the
docsfolder and push your changes to your fork; - Create a pull request that is based on the central repository's
gh-pagesbranch (⚠️ not on themainbranch!).
Genericode, also known as Code List Representation, is “a single semantic model for code lists and accompanying XML serialization that is designed to IT-enable and standardize the publication of machine-readable code list information and its interchange between systems”1. Genericode is developed by the Organization for the Advancement of Structured Information Standards (OASIS). See the website of the OASIS Code List Representation TC for more information.
Xproc is an XML based programming language for processing documents in pipelines. XProc 3 is developed by the XProc Next Community Group, a community group of the World Wide Web Consortium (W3C).