Special characters XSD and XSLs

This module was developed in order to provide a standard way of handling XChars markup.
So far, it was only possible by using the proprietary XChars Java package. With a XML schema and some XSL stylesheets it should be possible to access XChars information from virtually any programming language, given that there is plenty of tools for any of them related to these XML technologies.
Initially, this module's files come from processing the XChars configuration file from maven artifact uk.ac.ebi.xchars:xchars-config:1.0.3. This file was used as source for the XSLT stylesheets in directory src/main/xsl:
  • specialCharacters2xcharsxsd.xsl: transforms the original specialCharacters.xml into an equivalent XML schema (in src/main/resources directory).
  • specialCharacters2xcharsxsl.xsl: transforms the original specialCharacters.xml into several XSL stylesheets - depending on the 'encoding' parameter passed for the transformation -, in src/main/resources directory. The resulting stylesheets were manually simplified (for example, removing all the <xsl:if/> generated for every chemical element, all of them with the same formatting). Besides, xchars2default.xsl had to be manually modified in order to fix the 'composite' encoding used for some xchars tags.
    As only 'default', 'sp_code' and 'chebi_code' encodings are currently in use, the others haven't been properly maintained This results in lots of errors for their resulting xsl stylesheets, which have been excluded from the tests and the final maven artifact.


Use the XSD and XSL files as per your favourite tool documentation. With the XSD schema you will be able to generate code or validate XML containing xchars markup.
With the XSLs you can transform any text containing xchars markup in your preferred encoding. Please note that you will probably have to put the xchars text into a XML element.