Static Code Documentation

Introduction

This document provides information about the static build process for MoEML. All of the documents are processed through an Apache Ant build, which calls on a number of XSLT tranformations. Below is generated documentation regarding the Ant build and the XSLT stylesheets. For a brief summary of our release stages, go here.

ANT Build

Documentation for the ANT build.

Tasks

clean

Documentation This task cleans site content that may have been generated in previous runs. Each time the build is run, we delete all of the old content, and retrieve all necessary internal files as well as the the TEI-P5 RelaxNG schema.
Called from

getSvnInfo

Documentation This target retrieves the latest information from MoEML’s Subversion (SVN) repository and outputs it into a text file for use in site page generation.
Called from

getStaticSearchCode

Documentation TARGET getStaticSearchCode This target retrieves the latest version of the staticSearch codebase from its GitHub repo. It is configurable to use the master or dev branches, defaulting to the former, but allowing the use of the latter for testing purposes. This retrieval is a substitute for the original use of svn:externals, which (we think) was the cause of Jenkins repeatedly building the project over and over again.
Called from

buildStaticSearch

Documentation TARGET buildStaticSearch This target uses the code in the staticSearch folder created above to build a static search engine.
Called from

copySiteAncillaryFiles

Documentation This target copies CSS, JavaScript and other static files from the static/ folder to the output site/folder.
Called from

createBinaryDocList

Documentation This target creates lists of binary documents which are in the repository and are actually referenced in real documents on the site, so that we only end up copying documents which are needed to the output.
Files used
Called from

copyBinaryDocs

Documentation This target copies the set of required binary documents which has been calculated in the preceding target from their original locations to the output folders in the static/site folder.
Called from

createImageLists

Documentation This target creates lists of images which are in the repository and are actually referenced in real documents on the site, so that we only end up copying images which are needed to the output.
Files used
Called from

copyImages

Documentation This target copies the set of required images which has been calculated in the preceding target from their original locations to the output folders in the static/site folder.
Called from

extractSchematron

Documentation This target extracts the Schematron ruleset from the tei_all RelaxNG schema, so that it can be used for validation.
Called from

createXslCaptions

Documentation This target processes the /db/data/boilerplate/boilerplate.xml file to extract all of the TEI <seg> elements which contain caption and boilerplate text definitions; it turns them into <xsl:variable> elements in an XSLT stylesheet module which is used throughout the rest of the build process.
Files used
Called from

createStowChapters

Documentation This task splits our edition of stow_1598 into chapters for ease of processing. This must come before the creation of the original XML so we can have accurate listings in many of our generated items (like the divGen in the peer_review page or the aggregate document type listings).
Files used

createImportXsl

Documentation This creates the XSLT files for each document that will eventually be imported into a master file.
Files used
Called from

applyImportXsl

Documentation ADD DOCUMENTATION HERE
Called from

createOriginalXml

Documentation This target takes the set of TEI markup files which constitutes our dataset, in /db/data, and moves them to the output site/original folder, flattening their folder structure in the process. It also applies some minimal processing to them to regularize various things, expand XIncludes, and so on.
Files used
Called from

createGeneratedContent

Documentation This target creates a large set of additional TEI XML files which are mechanically constructed from existing data, including consolidated listings of variant spellings for place names, listings files for all the document categories and so on; it also creates some non-TEI files such as JSON files for the Agas Map. It calls a set of other ant targets to accomplish individual tasks.
Included Ant tasks
Called from

createVariantSpellingsFile

Documentation This target creates the global generated file listing variant spellings for place names. This is used for creating the Gazetteer pages, and also for components which appear on the HTML versions of individual location files.
Files used
Called from

createGazetteerAndCategories

Documentation This target creates the Gazetteer listings pages in the form of TEI XML files (later processed to create web pages), as well as the listings pages for each of the document categories in our document type taxonomy, again in the form of XML which will be later processed into HTML.
Files used
Called from

createAgasJsonFiles

Documentation This target creates the two JSON files used to power the interactive Agas Map: one is a list of categories for constructing the location menu, and the other is the list of actual locations, with info and coordinates.
Files used
Called from

createGeoJson

Documentation This target creates the global generated file of all the locations in GeoJSON format. Still in development.
Files used
Called from

createRDF

Documentation This target creates RDF/XML formats for the various datasets across the site.
Files used
Called from

cleanRegnalCalendar

Documentation This target processes the spreadsheet file where all the data for the regnal calendar is maintained, to create a TEI XML file which can be processed in other ways later in the build process.
Files used

validateOriginalXml

Documentation This target validates the content of the site/xml/original folder, which consists of the slightly-massaged XML content from the source dataset along with a collection of generated XML files created in previous build steps. These files are validated against the tei_all schema (RNG and Schematron), and also against our project RelaxNG and Schematron.
Called from

createStandaloneXml

Documentation This target processes the files in the site/xml/original folder to create fully-expanded standalone versions of all of the documents. This involves copying referenced content from all over the rest of the collection into the target file, so that everything referenced inside it is basically included in it. These standalone files are the ones which are later processed to create the various other output formats, including XHTML5.
Files used
Called from

resolveStyleSelectors

Documentation This target processes any document which makes use of the rendition/@selector attribute to add an explicit pointer to the rendition element on any descendant element of <text> which the selector applies it to. This is a two-stage process involving the creation of temporary XSLT documents, which are applied, and then deleted.
Files used
Called from

runTempXslt

Documentation This target runs the temporary XSLT files produced in target resolveStyleSelectors.

rationalizeStyleAttributes

Documentation This target processes the various methods used to describe layout, appearance and other bibliographic features in primary source documents to make them more straightforward and efficient. For instance, all instances of equivalent @style attributes are converted into a single rendition element in the document header, and the @style attributes in the text replaced with pointers to the rendition element.
Files used
Called from

validateStandaloneXml

Documentation This target validates the TEI document collection in site/xml/standalone using the tei_all schema (RNG and Schematron).
Called from

createAjaxFragments

Documentation This target creates fragmentary XHTML5 documents which can be retrieved by AJAX calls from full documents in the output website content. These fragments are not normally needed, since most documents include all the popup content they need inside themselves due to having been built from standalone versions of their XML precursors, but if a popup content block itself contains a reference to another piece of content, that second-level reference will require an AJAX call in the final site. In addition, these AJAX fragments are themselves processed to create full standalone pages, and to provide the local content for standalone pages which will show info in popup form.
Files used
Called from

createStandardXml

Documentation This target takes the Standalone version of all our XML files (in site/xml/standalone) and transforms them to create a more standard form of TEI which is more likely to be processable in other projects, by changing or removing some of the more project-specific or idiosyncratic forms of encoding we happen to use in this project.
Files used
Called from

validateStandardXml

Documentation This target validates the content of the site/xml/standard folder, which consists of the standardized XML content created from the standalone files created in previous build steps. These files are validated against the tei_all schema (RNG and Schematron).
Called from

createSimpleXml

Documentation This target takes the Standalone version of all our XML files (in site/xml/standalone) and transforms them to create TEI Simple versions of the files, in the process discarding and normalizing a lot of the more obscure or unusual encoding from our project.
Files used
Called from

validateSimpleXml

Documentation This target takes the TEI Simple version of all our XML files (in site/xml/simple) and validates them against the current version of the TEI Simple schema.
Called from

createLiteXml

Documentation This target takes the Standalone version of all our XML files (in site/xml/standalone) and transforms them to create TEI Lite versions of the files, in the process discarding and normalizing a lot of the more obscure or unusual encoding from our project.
Files used
Called from

validateLiteXml

Documentation This target takes the TEI Lite version of all our XML files (in site/xml/lite) and validates them against the current version of the TEI Lite schema, retrieved from the TEI release site.
Called from

createXhtmlDocs

Documentation This target generates most of the collection of XHTML5 documents comprising the output website from the standalone TEI documents in /site/xml/standalone.
Files used
Called from

copyAgasMapTiles

Documentation This target takes existing set of tiled images comprising the Agas Map and copies them to the output location in site/zoomify.
Called from

createAgasMapXhtml

Documentation This target creates the Agas Map XHTML5 interface page based on OpenLayers.
Files used
Called from

validateXhtmlDocs

Documentation This target validates the complete collection of XHTML5 documents comprising the output website, using the VNU validator (the same validator used by the W3C’s online validation service). We have to start by copying them to a temporary location, otherwise the vnu validator will try to validate all sorts of other files as well.
Called from

createTxtList

Documentation This target creates the list of texts used to identify which documents need to be processed into text files
Files used
Called from

createTxtFiles

Documentation This target creates the text files that we can pull to use in Voyant and/or for text analysis purposes.
Files used
Called from

validateXml

Documentation This target is intended for developers to use after using a target, like subset or quick, that does not perform validation, but you would like to validate the XML products before committing your documents. Note that this validates the entire set of products, so it assumes that the framework and the products from the build are intact. This should be run before and after running a subset or quick target to test whether or not local changes are valid.
Included Ant tasks

subset

Documentation This target is intended for developers to use when they wish to pass a single document or a small subset through the whole process, so they don’t have to wait for the entire build to complete. It assumes that the framework of the output products is already in place; it does no cleanup; and it would normally be run with -DdocsToBuild=ABCH1,STMA12 etc.
Included Ant tasks

quick

Documentation This target is intended for developers to use when they wish to pass a single document or a small subset through the HTML generation sequence. It works the same way as the subset target except that it dispenses with the generation of Standard, Simple, and Lite versions. It would normally be run with -DdocsToBuild=ABCH1,STMA12 etc.
Included Ant tasks

all

Documentation This is the default complete static build process target used by the Jenkins build process. If you are building locally, run this at least once to create a full output document set, and then you can run smaller targets as necessary to process smaller subsets of documents. This one removes all existing content first, and it takes a long while to complete (45 minutes to an hour, depending on the system it’s running on).
Included Ant tasks

XSLT Documents

Documentation for various XSLT documents called from the ANT build.

json_agas_master_NEW.xsl

View source.
Documentation
  • Created on: 23 June 2019 from mholmes’ version.
  • Author: mholmes and jtakeda
  • The purpose of this stylesheet is to generate the JSON code for the mdtEncyclopediaLocations subcategories, and for the Agas Map locations for each of the location. This tranformation was first rewritten by mholmes in 2014-15 and has been subsequently adapted to use XSLT 3.0 and the xml-to-json function in 2019 by jtakeda.
  • MDH 2021-03-22: It does not appear that this was ever put into production, but it probably should be at some point.
Includes

fix_epub_css.xsl

View source.
Documentation
  • Created on:Oct. 23, 2018
  • Author:mholmes and tmelhajj
  • This identity transform is designed to change position:absolute and position:fixed to position:static is epub css files.
Includes

xhtml5_to_fo_master_draft.xsl

View source.
Documentation
  • Created on: Sept 1, 2018
  • Author: mholmes. This transformation is designed to convert a MoEML XHTML5 static site document into a PDF. It converts the document to XSL:FO, validates the FO, and then the calling ant script uses FOP to generate a PDF.
Includes

xhtml5_to_epub_draft.xsl

View source.
Documentation
  • Created on: Aug 29, 2018
  • Author: mholmes and Tracey El-Hajj
  • This identity transform is designed to process a regular XHTML5 page produced as part of the MoEML static build process and remove a bunch of components that we don’t want as part of the ePub version of the page.

jenkins_to_epub.xsl

View source.
Documentation
  • Created on:Oct 12, 2018
  • Author:mholmes and tmelhajj
  • This identity transform processes the source xhtml file (from Jenkins), to make it compatible with the epub output desired. It mostly deletes components that we don’t need.
Includes

list_images_for_epub.xsl

View source.
Documentation
  • Created on: Oct. 16, 2018
  • Author: mholmes and Tracey El-Hajj
  • This identity transform is designed to read the xhtml and css files and list the images needed for this particular epub.
Includes

list_css_for_epub.xsl

View source.
Documentation
  • Created on: Oct. 11, 2018
  • Author: mholmes and tmelhajj
  • This identity transform is designed to read the xhtml file and list the css files needed for this particular epub.
Includes

list_fonts_for_epub.xsl

View source.
Documentation
  • Created on:Oct. 19, 2018
  • Author:mholmes and tmelhajj
  • This identity transform is designed to read the css files and list the fonts needed for this particular epub.
Includes

xhtml5_to_epub.xsl

View source.
Documentation
  • Created on: Oct. 11, 2018
  • Author: mholmes and Tracey El-Hajj
  • This identity transform is designed to process a regular XHTML5 page produced as part of the MoEML static build process and remove a bunch of components that we don’t want as part of the ePub version of the page.

epub_supplementary_files.xsl

View source.
Documentation
  • Created on:Oct. 18, 2018
  • Author:mholmes and tmelhajj
  • This identity trasform provides all the supplementary files needed for the generation of every e-pub.
Includes

locations_to_geojson.xsl

View source.
Documentation
  • Created on: Dec 21, 2017
  • Author: mholmes
  • This is a module designed to generate GeoJSON from the MoEML location files. It also pilots the generation of GeoJSON geometries from the existing geo elements, which at the time of writing are simply crude lists of coordinates.
  • We use XSLT 3.0 so that we can create an XML framework to be saved out in JSON, a simpler and less error-prone approach than simply constructing the literal text output.
  • The included global locations variable contains the complete set of MoEML location files. For the moment, we use the untransformed original versions; in future we may work with versions further down the static build process.
Includes
Called from

epub_globals.xsl

View source.
Documentation
  • Created on: Oct 12, 2018
  • Author:mholmes and tmelhajj
  • This identity transform creates the main forlders and parameters needed for the entire epub. It will be included in other epub xslts, and will provide the source file for
Included by

pdf_globals.xsl

View source.
Documentation
  • Created on: Jan 16, 2019
  • Author:mholmes and tmelhajj
  • This identity transform creates the main folders and parameters needed for the entire pdf. It will be included in other pdf xslts
Included by

txt_globals.xsl

View source.
Documentation
  • Created on: Sept 13, 2019
  • Author:mholmes and tmelhajj
  • This identity transform creates the main forlders and parameters needed for the .txt transformation. It will be included in other txt xslts.

eebo_to_proquest_ids.xsl

View source.
Documentation
  • Created on: May 20, 2020
  • Author: lsimpson
  • Identity transform to replace old eebo facsimile page identifiers with eebo proquest identifiers.

xhtml_agas_master.xsl

View source.
Documentation
  • Started on: June 13, 2016.
  • Author: mholmes
  • This module is part of the static site build process for MoEML. It generates the HTML output page for the OpenLayers3-based version of the Agas Map.
Includes
Called from

xml_standalone_master.xsl

View source.
Documentation
  • Created on: Dec 24, 2015
  • Author: mholmes and jtakeda
  • This module is part of the static site build process for MoEML. It collects all of the current XML files in the MoEML project, in the original folder (meaning the slightly-massaged versions of our files that we provide to the public, rather than the original source, which is a bit confusing in its folder structure) and generates from them a collection of fully-expanded standalone version, which are then used as the basis for generating both other XML versions and the HTML pages for the site.
  • Note: this is a multi-stage transformation, relying on modes to process the content in two different ways. All templates must have a mode attribute, and all calls to apply-templates must pass on a mode.
  • Note: this was originally written to transform the original XML source documents, but it has been rewritten to process instead the set of documents in site/xml/original, on the basis that these have already been flattened and had their XIncludes expanded.
  • This process completes one more task: it generates a utility text file which contains a sequence of lines each of which has one of the unique ids in the project. This is to help encoders rapidly check if an id has already been used or not.
Includes
Called from

xml_normalize_styles_master.xsl

View source.
Documentation
  • Created on: Apr 28, 2015; updated and extended after moving into MoEML project 2016-01
  • Author: mholmes
  • The purpose of this identity transform is to to rationalize and reorganize the use of CSS in a set of files. It enables the marshalling of all uses of @style in a TEI document, and can normalize and compare these to create a set of rendition elements to which elements previously bearing @style can be linked.
Includes
Called from

get_captions_master.xsl

View source.
Documentation
  • Created on: Jan 04, 2016
  • Authors: mholmes and jtakeda
  • This module collects up user-designated captions from the boilerplate file and creates an XSLT file which makes them available as variables. These captions are used throughout the HTML rendering process.
  • Created on by an automated process.
  • Author: mholmes
  • This is a collection of captions and other useful strings used throughout TEI-to-HTML transformations.
Called from

xhtml_docs_master.xsl

View source.
Documentation
  • Created on: March 7, 2016.
  • Author: mholmes and jtakeda
  • This module is designed to process each of the standalone XML documents created in previous transformations into XHTML5 standalone documents.
Includes
Called from

test_xhtml_functions_master.xsl

View source.
Documentation
  • Created on: February 2, 2016.
  • Author: mholmes
  • This module is designed to test only the functions in the xhtml_functions.xsl file. It will not be used in any actual build code.
Includes

ajax_fragments_master.xsl

View source.
Documentation
  • Started on: January 5, 2016
  • Author: mholmes, jtakeda
  • This module is part of the static site build process for MoEML. It generates HTML fragments which are retrievable through AJAX calls in the static site.
  • The process is in three stages: first it retrieves all the fragments from key documents (bibl entries, person entries, orgs, location abstracts and all that); then it expands each fragment by adding information such as the number of mentions or citations or responsibilities associated with that item or person; then it passes the resulting TEI fragment to standard templates in a linked module for processing into XHTML5.
  • Source documents for the work are the standalone/complete XML documents produced at the first stage of the build process.
Includes
Called from

xml_stow_chapter_master.xsl

View source.
Documentation
  • Created in: April 2016
  • Authors: jtakeda and mholmes
  • This is a master module that splits the divisions of an edition of Stow into individual TEI files. It also neccessarily changes @xml:ids and pointers so that everything is internally coherent. The TEI header is also adapted so that it better describes the chapter.
Includes
Called from

xml_standard_master.xsl

View source.
Documentation
  • Created on: March 23, 2016
  • Author: jtakeda and mholmes
  • This transformation is designed to generate a compliant TEI Standard file from any MoEML XML document. It is essentially an identity transform with special cases for every element and attribute not permitted in Simple. At the time of creation, Simple was still under steady development, so the schema will change and this file will need to be updated.
Called from

xhtml5_to_fo_master.xsl

View source.
Documentation
  • Created on: Sept 1, 2018
  • Author: mholmes. This transformation is designed to convert a MoEML XHTML5 static site document into a PDF. It converts the document to XSL:FO, validates the FO, and then the calling ant script uses FOP to generate a PDF.
Includes

exist_app_master.xsl

View source.
Documentation
  • Started on: August 16, 2016
  • Author: mholmes
  • This module is part of the static site build process for mapoflondon. It creates some components which are required for the building of a deployable eXist-db application. It is intended to be run after a complete static build process has succeeded, normally as part of a second ant task which creates the eXist application in the form of a xar file.
Includes

kml_master.xsl

View source.
Documentation
  • Created on: March 15, 2016
  • Author: jtakeda and mholmes
  • This transformation, based off of of XQuery written by mholmes for MoEML v5, is designed to create individual and aggregate KML files from geographic data in MoEML’s TEI files.
  • It creates two full version of MoEML’s KML data, since zipping into a KMZ require slight changes in path structure.
Includes

list_binary_docs_used_master.xsl

View source.
Documentation
  • Created on: August 19, 2016
  • Author: mholmes
  • The purpose of this module is to parse through the XML documents in the project and generate a list of all the binary documents which are actually used (since there are many hanging around in the repo which are never referenced).
  • This list will be used by the ant static build task to copy over only those documents we actually need into the output images folder. The file will be a flat text file listing the filenames of these files.
Called from

xml_original_master.xsl

View source.
Documentation
  • Created on: April 4, 2016
  • Author: mholmes and jtakeda
  • This module is part of the static site build process for MoEML. It processes all the current source XML files from the project into a flattened, single-folder representation, rewriting their xml-model processing instructions and expanding their XIncludes to create something from which other XML and XHTML outputs can more easily be derived. The meat of it is in the included xml_flatten_module.xsl file.
Includes
Called from

test_xhtml_dates_master.xsl

View source.

xml_resolve_imports_styles_master.xsl

View source.
Documentation
  • Created on: July 09 2018
  • Author: jtakeda
  • This stylesheet takes documents from the original XML and imports them
Includes
Called from

xml_variants_master.xsl

View source.
Documentation
  • Created on: Apr 13, 2016
  • Author: mholmes
  • This module handles the generation of an XML source file containing a very simple encoded collection of variant spellings for each location name. It is run as a standalone process to generate a useful file which can then serve as input for the gazetteer page generation process, as well as providing variant spellings for later incorporation into the XTHML output. The file is called on itself.
Includes
Called from

txt_master.xsl

View source.
Documentation
  • Created on: March 23, 2016
  • Author: tmelhajj and jtakeda
  • This transformation is designed to generate a text file from any MoEML html document.
Called from

doc_network_master.xsl

View source.
Documentation
  • Author: mol:HOLM3. Date: 2017-06.
  • The purpose of this transformation is to generate a variety of resources expressing the network relationships between documents in the MoEML collection. It is experimental.
Includes

list_images_used_master.xsl

View source.
Documentation
  • Created on: Mar 10, 2016
  • Author: mholmes
  • The purpose of this module is to parse through two sources, the XML documents in the project, and the CSS documents used for HTML rendering, and generate two lists of all the images which are actually used (since there are many hanging around in the repo which are never referenced).
  • This list will be used by the ant static build task to copy over only those images we actually need into the output images folder. The file will be a flat text file listing the filenames of these images, since we’re going to
Called from

json_agas_master.xsl

View source.
Documentation
  • Created on: 13th June 2016, from an existing file in /db/data/utilities.
  • Author: mholmes
  • The purpose of this stylesheet is to generate the JSON code for the mdtEncyclopediaLocations subcategories, and for the Agas Map locations for each of the location. These files are used by as rewritten 2014-15.
Includes
Called from

add_special_styles_to_fo_master.xsl

View source.
Documentation
  • Created on: March 8, 2019
  • Author: mholmes and tmelhajj. This transformation is designed to iclude a special xsl in the xhtml5_to_fo_master
Includes

xml_resolve_style_selectors_master.xsl

View source.
Documentation
  • Created on: July 18 2016
  • Author: mholmes
  • The purpose of this module is to process documents which make use of the TEI attribute rendition/@selector. The content of this attribute is one or more CSS selectors which select elements in the transcribed content of the document to which the host rendition element should be applied. In this transformation, a new temporary XSLT file is created for each document in the collection which uses this attribute; the created XSLT can later be applied by the build process to perform an identity transform which adds explicit instances of @rendition to the target elements, replacing the use of @selector with a more easily-processable link between the element and the rendition rules to be applied to it.
  • The main requirement here is to transform the CSS selector(s) in the @selector attribute of the rendition element into XSLT @match attributes on xsl:template elements.
Includes
Called from

xml_simple_master.xsl

View source.
Documentation
  • Created on: June 2, 2015
  • Author: jtakeda and mholmes
  • This transformation, derived from mholmes’s earlier incarnation for MoEML v5, is designed to generate a compliant TEI Simple file from any MoEML XML document. It is essentially an identity transform with special cases for every element and attribute not permitted in Simple. At the time of creation, Simple was still under steady development, so the schema will change and this file will need to be updated.
Called from

fods_expand_master.xsl

View source.
Documentation
  • Created on: Oct 5, 2015
  • Authors: mholmes and jtakeda
  • Based off of stylesheet by mholmes for the Landscapes of Injustice project. The purpose of this stylesheet is to expand a generic FODS file (a flat-file version of a ODS spreadsheet) to add empty cells where they’re signalled by attribute values and to explicitly name style attributes when necessary. The result is much easier to process into other types of output.
Called from

xml_lite_master.xsl

View source.
Documentation
  • Created on: March 23, 2016
  • Author: jtakeda and mholmes
  • This transformation is designed to generate a compliant TEI Standard file from any MoEML XML document. It is essentially an identity transform with special cases for every element and attribute not permitted in Simple. At the time of creation, Simple was still under steady development, so the schema will change and this file will need to be updated.
Includes
Called from

rss_feeds_master.xsl

View source.
Documentation
  • Created on: 14th July 2016.
  • Author: mholmes
  • The purpose of this stylesheet is to generate RSS feeds for MoEML site content.
Includes

test_xhtml_templates_master.xsl

View source.
Documentation
  • Created on: July 20, 2016.
  • Author: mholmes
  • This module is designed to test only the functions in the xhtml_templates_module.xsl file. It will not be used in any actual build code.
Includes

xml_create_generated_master.xsl

View source.
Documentation
  • Created on: Mar 31, 2016; based firmly on the createGazetteer.xsl module in the main utilities folder of the project.
  • Author: mholmes and jtakeda
  • The purpose of this stylesheet is to parse the entire data collection of the MoEML repo and create a set of MoEML TEI files each of which is the source for a single-letter page of the alphabetized gazetteer. This component of the file, although originally adapted from existing code, has now been rewritten completely (2016-04-22) because it can draw all its data from the spelling_variants.xml file which has already been created in a previous stage of the build.
  • This file is designed to run on itself, and find the collection of XML documents it operates on through a relative path on the filesystem. It runs as part of the static build process, and generates a set of TEI files. Those files are later processed into XHTML5 web pages, standalone XML, and so on.
  • A second component of the process generates the JSON code for the mdtEncyclopediaLocations subcategories, and for the Agas Map locations for each of the location documents (based on SVG paths). These files are used by the Agas Map interface rewritten 2014-15.
Includes
Called from

xhtml_templates_module.xsl

View source.
Documentation
  • Created on: January 5, 2016
  • Author: mholmes and jtakeda
  • This module is part of the static site build process for MoEML. It provides generic templates which are used in the conversion of TEI XML to XHTML5 output.
  • Because this module is used as part of larger XSLT transformations involving multiple namespaces and target outputs, most of the templates use the xhtml5 mode attribute. It depends on the captions.xsl file which is also generated during the build, but it does not include that file because it will most likely be included by the root module which includes this one.
Includes
Included by

xml_flatten_module.xsl

View source.
Documentation
  • Created on: Apr 4, 2016
  • Author: mholmes and jtakeda
  • The purpose of this module is to provide templates which flatten the original XML in our db/data repository. There are a number of reasons for doing this:
    • Our original XML has a range of difficult-to-process XIncludes (involving XPointer) which for the purposes of making our codebase available are more barriers than conveniences.
    • The original XML is in a folder structure which is arbitrarily nested, to suit the conveniences of encoders. We mitigate this by the use of private URI schemes for linking, but those schemes assume a flat folder structure, which we can provide in the context of the original eXist web application, but which does not accurately represent the reality of the actual source files. This means that (for instance) xml-model pointers to schemas are variable and will in many cases fail when the documents are moved to a flattened structure.
Included by

xhtml_dates_module.xsl

View source.
Documentation
  • Created in: January 2016
  • Authors: jtakeda and mholmes
  • This module contains templates intended for processing dates into XHTML output. Assumptions: this module has access to the list of caption variables available in captions.xsl (which itself is auto-generated as part of the static build process. Its templates coexist with those in xhtml_templates.xsl as well.
Includes
Included by

xml_citation_module.xsl

View source.
Documentation
  • Created in: January 2016
  • Author: mholmes and jtakeda
  • This module handles the generation of TEI bibl elements each of which contains a citation of the sending document arranged optimally for a particular style guide. These are stored in the notesStmt element in the header of the document, and later used to generate the popup Cite this document feature, as well as providing bibliographic information for the reference list of another document which cites the current one (a mol:bibl reference). This code is adapted from the XQuery developed for the MoEML eXist webapp.
Included by

xml_category_lists_module.xsl

View source.
Documentation
  • Created on: Feb 29, 2016
  • Author: mholmes and jtakeda
  • This module creates XML versions of the category listings pages for each category in the document type taxonomy. It is part of the static build process. The XML documents it generates will later be converted to XHTML5.
  • Different types of document result in different tabular listings, so there is a lot of switching in the code below.
Included by

xml_id_listing_module.xsl

View source.
Documentation
  • Created in: June 2016
  • Authors: mholmes and jtakeda
  • This module generates the id listings page (A-Z index) in XML form.
Included by

xml_static_documentation_module.xsl

View source.
Documentation
  • Created on: June 18, 2016
  • Author: jtakeda and mholmes
  • This module creates a TEI page that gives a list of all XSLT modules and masters that produce the static version of MoEML.
Included by

xml_stats_module.xsl

View source.
Documentation
  • Created on: May 24, 2016
  • Author: jtakeda and mholmes
  • This transformation creates a TEI file of tables of various statistics on the MoEML site. It takes inspiration from mholmes’ stats.xql.
Included by

xml_create_style_selectors_transform_module.xsl

View source.
Documentation
  • Originally created on: July 18 2016
  • Author: mholmes
  • Split into separate file and slightly modified on: July 9 2018
  • Editor: jtakeda
  • This module, which should be called from another XSLT, takes in a single document that uses the TEI attribute rendition/@selector scheme and creates an XSLT in order to resolve that selector. This created XSLT can later be applied by the build process to perform an identity transform which adds explicit instances of @rendition to the target elements, replacing the use of @selector with a more easily-processable link between the element and the rendition rules to be applied to it.
  • The main requirement here is to transform the CSS selector(s) in the @selector attribute of the rendition element into XSLT @match attributes on xsl:template elements.
  • Created on by an automated process.
  • Author: mholmes
  • This is a temporary stylesheet designed for one-off processing of a single document, to replace usages of @selector with @rendition attributes on the target elements.
Included by

xml_respTaxonomy_module.xsl

View source.
Documentation
  • Created on: August 18, 2016
  • Author: jtakeda
  • This transformation generates the documentation for MoEML’s responsibility taxonomy found in the teiHeader of PERS1.xml.
Included by

xml_resolve_imports_module.xsl

View source.
Documentation
  • Created on: July 09, 2018
  • Author: jtakeda
  • This module includes all of the templates and functions that are necessary to resolve a mol-import processing instruction. It is meant to be run after the source documents have been run through the xml_resolve_imports_styles_master.xsl transformation (and the transformations produced therein). It assumes that that mol-import will also require some modification of the source document’s teiHeader, since there may be items referenced in the imported document that are not within the source document.
  • This work happens in two modes:
    • #import: This is applied to the source document and modifies the teiHeader and imports the content referenced in the processing-instructions.
    • #processImport: These templates are applied to the imported fragments and rationalize and reconfigure ids, pointers, and other bits of encoding that have to change when the fragment gets included into the source document.
    Note that both modes also include an identity transform
Included by

xml_utilities_module.xsl

View source.
Documentation
  • Started on: March 18, 2016.
  • Author: mholmes
  • This module is part of the static site build process for MoEML. It contains custom templates for processing TEI XML in particular ways required for special contexts, such as the removal of xml:id attributes or the suppression of elements that would be turned into links when these are to be output in contexts which are already going to be links. It also has some custom functions.
Included by

xml_praxis_index_module.xsl

View source.
Documentation
  • Created on: May 1, 2015
  • Author: jtakeda and mholmes
  • This transformation creates the index for MoEML’s praxis documentation. Each div of the documentation contains free-text terms as well as explicit references (using gi and att elements) to TEI entities.
Included by

date_functions_module.xsl

View source.
Documentation
  • Created on: April 6, 2016
  • Authors: jtakeda and mholmes
  • This module contains the functions for handling dates that are used throughout the static build process.
  • The primary functions are: hcmc:julianMarToGregorian, hcmc:julianJanToGregorian, hcmc:dateRangeToText, and hcmc:dateRangeToHistorian. These functions are used throughout our processing throughout various stages of the build to translate dates and produce textual content for dates that have no text.
Included by

xml_dates_module.xsl

View source.
Documentation
  • Created in: January 2016
  • Authors: jtakeda and mholmes
  • This module contains all the rather nasty calculations and transformations we need to do relating to dates, as well as rendering rules for dates. It depends on captions defined in captions.xsl. This is an updated version of mholmes’ original dates.xsl to account for the regularization of the year beginning of Julian dates to 1 January.
Includes
Included by

xml_regnal_calendar_module.xsl

View source.
Documentation
  • This version created on: April 9, 2016
  • Authors: tlandels, jtakeda, and mholmes
  • This is a very slightly modified version of tlandels’ regnal_fods_to_tei.xsl, which was created in summer 2015. It processes the MoEML regnal_calendar spreadsheet (that has been flattened to a .fods file) and converts it to TEI.
Included by

geojson_functions_module.xsl

View source.
Documentation
  • Created on: Dec 24, 2017
  • Author: mholmes
  • Module containing utility functions used to process GIS data, normally as part of GeoJSON generation or processing.
Included by

xhtml_appendix_module.xsl

View source.
Documentation
  • Started on: January 26, 2016.
  • Author: mholmes and jtakeda
  • This module is part of the static site build process for MoEML. It provides templates and functions for processing a document in appendix mode.
  • There are many elements in the text of a document which need to be processed twice: the obvious example is footnotes. In the regular processing pass (@mode=xhtml5) a clickable link in the form of a superscripted number is created; in the second pass (@mode=appendix), all notes are processed into a numbered list at the bottom of the page. Other content such as related documents/disambiguation information from the LINKS1 file is also included.
  • This module is intended to be included into higher-level modules which process TEI content into XHTML. It would be invoked as part of a second pass through the document content at the end of the regular processing pass.
Included by

xhtml5_to_fo_styles_module.xsl

View source.
Documentation
  • Created on: Sept 1, 2018
  • Author: mholmes. This module contains the styling and layout data for the XHTML5 to XSL:FO transformation which turns MoEML XHTML5 static site pages into PDFs.
  • We are currently using imperial measurements in this process because of the default North American paper sizes, but we may change this in future, or allow it to be switchable.
  • We will set this up initially so recto and verso have slightly different margins, to allow for binding along the long edge. We may decide to eliminate this distinction at some point.
Included by

xhtml_functions_module.xsl

View source.
Documentation
  • Created on: February 2, 2016.
  • Author: mholmes and jtakeda
  • This module is part of the static site build process for MoEML. It provides a variety of functions which are used in the conversion of TEI XML to XHTML5 output.
  • These include both functions to construct standard parts of the web page output, such as menus and footers, and utility functions of various kinds.
  • Functions taking a $rootEl parameter would normally expect to receive a TEI element, in the case of a page being created from a complete TEI file; however, fragments such as people and bibl entries also get their own pages, so in these cases the $rootEl might be a person or a bibl element.
Includes
Included by

get_attribute_sets_names.xsl

View source.
Documentation
  • Created on: March 10, 2019
  • Author: mholmes and Tracey El Hajj
  • This identity transform is designed to read the docId_styles_module.xsl and gets the attribute sets names to be used in a variable in the xhtml5_to_fo_master.xsl.
Includes

xml_create_download_page.xsl

View source.
Documentation
  • Created on: Oct. 1, 2020.
  • Author: lsimpson
Includes

list_classes_for_pdf.xsl

View source.
Documentation
  • Created on: Feb. 26, 2019
  • Author: mholmes and Tracey El-Hajj
  • This identity transform is designed to read the style element in the htm file and list the style classes needed for this particular pdf.
  • This is an automatically created styles module xsl for this particular document.
Includes

list_fonts_for_pdf.xsl

View source.
Documentation
  • Created on:Jan. 23, 2019
  • Author:mholmes and tmelhajj
  • This identity transform is designed to read the css files and list the fonts needed for this particular pdf. It is adopted directly from the same one designed for epubs.
Includes

list_images_for_pdf.xsl

View source.
Documentation
  • Created on: Oct. 16, 2018
  • Author: mholmes and Tracey El-Hajj
  • This identity transform is designed to read the xhtml and css files and list the images needed for this particular pdf.
Includes

xml_pers1_rdf.xsl

View source.
Documentation
  • Created on: May 10, 2020
  • Author: lsimpson. This transformation converts the MoEML persongraphy to RDF/XML. It expects PERS1 as its input file.
Includes
Called from

customize_staticSearch.xsl

View source.
Documentation
  • Created on: March 4, 2020
  • Author: joeytakeda
  • Author: mholmes
  • This transformation takes in the static search build file (taken in from the Github repo) and simply outputs a new version with more memory added to the targets.
  • Borrowed from Landscapes of Injustice project, where Joey created it, and modified for LEMDO.
Called from

xhtml_to_txt.xsl

View source.
Documentation
  • Created on:Sept 13, 2019
  • Author:tmelhajj
  • This identity transform processes the source xhtml file (from Jenkins) into a txt file so that we can later embed it in Voyant.

list_docs_for_txt.xsl

View source.
Documentation
  • Created on:Sept. 26, 2019
  • Author:tmelhajj, mholmes
  • This template creates a list of the ids of html documents that will be built into text files. Originally created by tmelhajj in 2019, rewritten by mholmes 2021. If the docsToBuild parameter is configured, then those documents will be listed; if not, only primary source published/in proofing documents will be listed. This enables us to test with any document we like, published or not, but defaults to the set which is most appropriate for a site build.
Called from

Cite this page

MLA citation

Holmes, Martin D., and Joey Takeda. Static Code Documentation. The Map of Early Modern London, Edition 7.0, edited by Janelle Jenstad, U of Victoria, 05 May 2022, mapoflondon.uvic.ca/edition/7.0/static_code_documentation.htm.

Chicago citation

Holmes, Martin D., and Joey Takeda. Static Code Documentation. The Map of Early Modern London, Edition 7.0. Ed. Janelle Jenstad. Victoria: University of Victoria. Accessed May 05, 2022. mapoflondon.uvic.ca/edition/7.0/static_code_documentation.htm.

APA citation

Holmes, M. D., & Takeda, J. 2022. Static Code Documentation. In J. Jenstad (Ed), The Map of Early Modern London (Edition 7.0). Victoria: University of Victoria. Retrieved from https://mapoflondon.uvic.ca/editions/7.0/static_code_documentation.htm.

RIS file (for RefMan, RefWorks, EndNote etc.)

Provider: University of Victoria
Database: The Map of Early Modern London
Content: text/plain; charset="utf-8"

TY  - ELEC
A1  - Holmes, Martin
A1  - Takeda, Joey
ED  - Jenstad, Janelle
T1  - Static Code Documentation
T2  - The Map of Early Modern London
ET  - 7.0
PY  - 2022
DA  - 2022/05/05
CY  - Victoria
PB  - University of Victoria
LA  - English
UR  - https://mapoflondon.uvic.ca/edition/7.0/static_code_documentation.htm
UR  - https://mapoflondon.uvic.ca/edition/7.0/xml/standalone/static_code_documentation.xml
ER  - 

TEI citation

<bibl type="mla"><author><name ref="#HOLM3"><surname>Holmes</surname>, <forename>Martin</forename> <forename>D.</forename></name></author>, and <author><name ref="#TAKE1"><forename>Joey</forename> <surname>Takeda</surname></name></author>. <title level="a">Static Code Documentation</title>. <title level="m">The Map of Early Modern London</title>, Edition <edition>7.0</edition>, edited by <editor><name ref="#JENS1"><forename>Janelle</forename> <surname>Jenstad</surname></name></editor>, <publisher>U of Victoria</publisher>, <date when="2022-05-05">05 May 2022</date>, <ref target="https://mapoflondon.uvic.ca/edition/7.0/static_code_documentation.htm">mapoflondon.uvic.ca/edition/7.0/static_code_documentation.htm</ref>.</bibl>

Personography