JATS Core
Introduction
Jats.core is a XSLT 2.0 - based framework for Jats document transformation to CXML.
General purpose
Jats.core is developed to avoid code duplication in projects with Jats documents conversion. Another benefit of this framework is reducing of project creation time. As a separate layer with jats-to-cxml transformation logic in can be reused in Jats based projects.
Design
Framework was designed considering extensibility and easy integration to the project. For these purposes module based architecture (see module list) with a single entry point (jats.xsl) was used. jats.xsl entry point connects all modules using the jats/jats-imports.xsl (see jats.xsl doc.) file import. All modules are connected via xsl:import instruction.
Jats.core modules are grouped by several criteria:
- Part of xml tree which is processed (like jats-article.xsl)
- Feature logic
- Common elements - templates, functions, parameters and variables(e.g. jats-functions.xsl)
Feature list
- Table conversion
XHTML and CALS table formats conversion to CXML (see jats-tables.xsl). - Text processing
character mapping and generating character styles for text (see jats-text.xsl). - Style processing
Includes soft and character styles processing (see jats-styles.xsl). - Break up
Splits paragraphs that contain nested block elements (see jats-break-up.xsl)
Installation
Jats.core initiation steps:
- Create URI with a link to jats.xsl using XML Catalog
Example:
CUSTOM-PROJECT/trunk/xsl/resources/CUSTOM-PROJECT-catalog.xml
<nextCatalog catalog="../../../../../libraries/xsl/JATS.core/branches/v1.0/resources/catalog.xml"/> <uri name="core-library/jats.xsl" uri="../../../../../libraries/xsl/JATS.core/trunk/src/jats.xsl"/>
- Import jats.xsl into the project.
Example:
CUSTOM-PROJECT/trunk/xsl/CUSTOM-PROJECT.xsl
<xsl:import href="core-library/jats.xsl"/>
- Import Ant build
Example:
CUSTOM-PROJECT/trunk/xsl/build.properties
#customization project name
customization.name = CUSTOM-PROJECT
#customization project base dir
customization.dir = ${basedir}
#path to customization XML catalog file
catalog.file=${basedir}/resources/pediatrics-catalog.xml
#usses Jats Core version
core.part = branches
core.version = v1.0
core.dir = ../../../../libraries/xsl/JATS.core/${core.part}/${core.version}
core.build.file = ${core.dir}/build.xml
#dir with xsl resources
sources.dir = ${basedir}/src
data.dir = ${basedir}/data
Project build
Use Ant for project build. Ant targets list:
- docs - builds Jats Core documentation
- package - packs sources to zip (used for creating build delivery in customization)
- prepare-catalog - prepare XML catalogs
- setup-customization - automatically creates new project that customizes Jats Core
- test - runs all tests (test-core and test-customization targets)
- test-core - runs Jats Core tests
- test-customization - used for running tests in customization project
- transform - runs transformation
- validate - validating result document against CXML schema
Unit tests description
XSPEC test framework is used for Unit tests creation. All test scenarios are grouped by modules according to their functionality and can be found in ‘test’ folder. Entry point for all modules is test-configuration.xsl which imports jats.xsl entry point and contains mocked up templates.
Contribution
All project changes should be reported in Jira:
https://wiki.typefi.com/display/TYPEFI/How+to+Create+a+Typefi+Support+Ticket