<?xml version="1.0" encoding="UTF-8"?>
<?xml-model href="../schemas/london_all.rng" type="application/xml" schematypens="http://relaxng.org/ns/structure/1.0"?>
<?xml-model href="../schemas/london_all.rng" type="application/xml" schematypens="http://purl.oclc.org/dsdl/schematron"?>

<TEI xmlns="http://www.tei-c.org/ns/1.0" version="5.0" xml:id="pdfDev_about">
  <teiHeader>
    <fileDesc>
      
      <titleStmt>
        <title>MoEML’s PDF Developer Documentation</title>
        <respStmt>
          <resp ref="PERS1.xml#aut">Author<date notBefore="2018"/>
          </resp>
          <name ref="PERS1.xml#ELHA1">Tracey El Hajj</name>
        </respStmt>
        <respStmt>
          <resp ref="PERS1.xml#prg">Junior Programmer<date notBefore="2018"/>
          </resp>
          <name ref="PERS1.xml#ELHA1">Tracey El Hajj</name>
        </respStmt>
        <respStmt>
          <resp ref="PERS1.xml#prg">Programmer<date notBefore="2018"/>
          </resp>
          <name ref="PERS1.xml#TAKE1">Joey Takeda</name>
        </respStmt><respStmt>
          <resp ref="PERS1.xml#prg">Programmer<date notBefore="2011"/>
          </resp>
          <name ref="PERS1.xml#HOLM3">Martin Holmes</name>
        </respStmt>
        <respStmt>
          <resp ref="PERS1.xml#pmg">Project Manager<date notBefore="2016"/></resp>
          <name ref="PERS1.xml#MCQU1">Ryann McQuarrie-Salik</name>
        </respStmt>
        <respStmt>
          <resp ref="PERS1.xml#pdr">Project Director<date notBefore="1999"/>
          </resp>
          <name ref="PERS1.xml#JENS1">Janelle Jenstad</name>
        </respStmt>
      </titleStmt>
      
      <publicationStmt>
        <publisher><title level="m">The Map of Early Modern London</title></publisher><idno type="URL">http://mapoflondon.uvic.ca/includes.xml</idno><pubPlace>Victoria, BC, Canada</pubPlace><address>
        <addrLine>Department of English</addrLine>
        <addrLine>P.O.Box 3070 STNC CSC</addrLine>
        <addrLine>University of Victoria</addrLine>
        <addrLine>Victoria, BC</addrLine>
        <addrLine>Canada</addrLine>
        <addrLine>V8W 3W1</addrLine>
    </address><date when="2016">2016</date><distributor>University of Victoria</distributor><idno type="ISBN">978-1-55058-519-3</idno><authority>
          <name ref="PERS1.xml#JENS1">Janelle Jenstad</name>
          <email>london@uvic.ca</email>
        </authority><availability>
            <p>Copyright held by <title level="m">The Map of Early Modern London</title> on behalf of the contributors.</p>
            <licence target="http://creativecommons.org/licenses/by-sa/4.0/">
              <p>This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License. </p>
            </licence>
            <p>Further details of licences are available from our
              <ref target="licence.xml">Licences</ref> page. For more
              information, contact the project director, <name ref="PERS1.xml#JENS1">Janelle Jenstad</name>, for
              specific information on the availability and licensing of content
              found in files on this site.</p>
        </availability>
      </publicationStmt>
      
      <sourceDesc>
        <p>Born Digital</p>
      </sourceDesc>
    </fileDesc>
    <profileDesc>
      <textClass>
        <catRef scheme="includes.xml#molDocumentTypes" target="includes.xml#mdtBornDigital"/>
        <catRef scheme="includes.xml#molDocumentTypes" target="includes.xml#mdtDocumentationProgramming"/>
      </textClass>
    </profileDesc>
    
    <encodingDesc>
      <listPrefixDef>
        <prefixDef ident="mol" matchPattern="(.+)(#.+)?" replacementPattern="../../$1.htm$2">
          <p>Most MoEML documents, or significant fragments with <att>xml:id</att> attributes, can
            be addressed using the <code>mol:</code> prefix and accessed through the web application
            with their id + <code>.xml</code>.</p>
        </prefixDef>
        <prefixDef ident="molagas" matchPattern="(.+)" replacementPattern="https://mapoflondon.uvic.ca/agas.htm?locIds=$1">
          <p>The molagas prefix points to the shape representation of a location on 
            MoEML’s OpenLayers3-based
          rendering of the Agas Map.</p>
        </prefixDef>
        <prefixDef ident="moleebo" matchPattern="([0-9]+)\|([0-9]+)" replacementPattern="http://eebo.chadwyck.com/fetchimage?vid=$1&amp;page=$2&amp;width=1200">
          <p>Links to page-images in the Chadwyck-Healey <title level="m">Early English Books Online</title> (EEBO)
            repository. Note that this is a subscription service, and may not be accessible to those
            accessing it from locations outside member institutions.</p>
        </prefixDef>
        <prefixDef ident="molebba" matchPattern="(.+)" replacementPattern="http://ebba.english.ucsb.edu/ballad/$1">
          <p>Links to page-images in the <title level="m">English Broadside Ballad Archive</title> (EBBA).</p>
        </prefixDef>
        <prefixDef ident="mdt" matchPattern="(.+)" replacementPattern="includes.xml#$1">
          <p>The mdt (MoEML Document Type) prefix used on <gi>catRef</gi>/<att>target</att> points
            to a central taxonomy in the includes file.</p>
        </prefixDef>
        <prefixDef ident="mdtlist" matchPattern="(.+)" replacementPattern="$1.xml">
          <p>The mdtlist (MoEML Document Type listing) prefix used in linking attributes points to a listings page constructed from a category in the central MDT taxonomy in the includes file. There are two variants, one with the plain <att>xml:id</att> of the category, meaning all documents in the specified category, and one with the suffix <q>_subcategories</q>, meaning all subcategories of the category.</p>
        </prefixDef>
        <prefixDef ident="molgls" matchPattern="(.+)" replacementPattern="GLOSS1.xml#$1">
          <p>The molgls (MoEML gloss) prefix used on <gi>term</gi>/<att>corresp</att> points
            to a a glossary entry in the GLOSS1.xml file.</p>
        </prefixDef>
        <prefixDef ident="molvariant" matchPattern="(.*)\|(.+)" replacementPattern="spelling_variants.xml#$2">
          <p>This molvariant prefix is used on <gi>ref</gi>/<att>target</att> attributes during automated 
          generation of gazetteer index files. It points to an element in the generated variant spellings
          listing file which lists all documents which contain a particular spelling variant for a 
          location.</p>
        </prefixDef>
        <prefixDef ident="molajax" matchPattern="(.+)" replacementPattern="../../ajax/$1.xml">
          <p>This molajax prefix is used on <gi>ref</gi>/<att>target</att> attributes during the static build 
          process, to specify links which point to MoEML resources which should not be loaded into the source 
          page during standalone processing; instead, these should be turned into links to the XML source 
          documents, and at HTML page load time, these should be turned into AJAX calls. This is to handle 
          the scenario in which a page such as an A-Z index of the whole site would end up containing 
          virtually the whole site inside itself.</p>
        </prefixDef>
        <prefixDef ident="molstow" matchPattern="(.+)|(.+)" replacementPattern="https://hcmc.uvic.ca/stow/$1/SL$1_$2.jpg">
          <p>The molstow prefix is used on <att>facs</att> attributes to link to the HCMC verison of the Stow facsimiles.
          Usually the first group is the year (1633) and then last is the image number (0001).</p>
        </prefixDef>
        
        <prefixDef ident="molshows" matchPattern="([^\|]+)\|([^\|]+)\|([^\|]+)" replacementPattern="https://hcmc.uvic.ca/~london/images/shows/$1/$2/$3.jpg">
          <p>The molshows prefix is used on <att>facs</att> attributes to link to the copies of page-images
            from mayoral shows stored in the london account on the HCMC server.
            The first group is the year (1633), the second is the source repository, and then last is the image
            file name.</p>
        </prefixDef>
        
        <prefixDef ident="sb" matchPattern="(.+)" replacementPattern="https://johnstowsbooks.library.utoronto.ca/admin/items/show/$1">
          <p>The sb prefix is used on <gi>ref</gi>/<att>target</att> attributes to link to 
          Stow’s Books URLs at UToronto.</p>
        </prefixDef>
      </listPrefixDef>
      <p>
        Our editorial and encoding practices are documented
        in detail in the <ref target="praxis.xml">Praxis</ref>
        section of our website.
      </p>
    </encodingDesc>
    
    
    <revisionDesc status="draft">
      <change who="PERS1.xml#ELHA1" when="2020-06-02">Created document.</change>
    </revisionDesc>
  </teiHeader>
  <text>
    <front>
      <docTitle>
        <titlePart type="main">
          MoEML’s PDF Developer Documentation
        </titlePart>
      </docTitle>
    </front>
    <body>
      <div xml:id="pdfDev_about_files">
        <head><code>XSLT</code> files responsible for creating MoEML PDFs:</head>
        <list>
          <item><code>pdf_globals.xsl</code></item>
          <item><code>createPdfs.xml</code> (ant application)</item>
          <item><code>add_special_styles_to_fo_master.xsl</code></item>
          <item><code>get_attribute_sets_names.xsl</code></item>
          <item><code>list_classes_for_pdf.xsl</code></item>
          <item><code>list_fonts_for_pdf.xsl</code></item>
          <item><code>list_images_for_pdf.xsl</code></item>
          <item><code>xhtml5_to_fo_master.xsl</code></item>
          <item><code>xhtml5_to_fo_styles_module.xsl</code></item>
        </list>
        <p>This documentation goes through the <code>XSL</code> and <code>XML</code> files responsible for building the PDFs.</p>
      </div>
      <div xml:id="pdfDev_about_globals">
        <head><code>pdf_globals.xsl</code></head>
        <p>The <code>pdf_globals</code> is an <code>XSL</code> file that contains the variables, parameters, and functions necessary for the creation of every PDF. <code>$docId</code> is the variable that gets the <code>xml:id</code> of the document, so that we can use it to build this particular file and all of its required components. <code>$attSetDoc</code> is a variable that gets the docId-specific styling module and the master styling module (used later to assign corresponding attribute sets as per the respective classes). Two parameters assign the locations of necessary folders: the <code>FO</code> folder and the output folder. Two other parameters get the titles of the document at hand: one for born digital files and one for primary sources. <code>pdf_globals</code> also contains a function, <code>getAtts</code>, that allows us to add attributes from the class’ corresponding attribute sets, in addition to the attributes that are unique to the class, which we retrieve from the style element in the original <code>HTML</code> source document. This function finds the appropriate attributes selected in the master styles module, and then finds the document specific attribute sets. Attributes get added if they were not already, and if they are already written in, they get overwritten by the specific styling. The same function also manipulates some attributes and their values, to accommodate the <code>FO</code> restrictions, such as <code>rem</code> (replaced with <code>pt</code>), and the small-caps font variant, which gets a specific font-family selected for this particular purpose.</p>
      </div>
      <div xml:id="pdfDev_about_createPdf">
        <head><code>createPdfs.xml</code></head>
        <p><code>createPdfs.xml</code> is the Ant application that builds the selected PDFs. This file runs through the terminal application. It checks for <code>FOP</code>; if it is not available it gets downloaded. If <code>FOP</code> is downloaded, it checks whether or not it is up to date and updates it if need be. Images and fonts folders are defined in properties, to be used later in retrieving the appropriate material. The <code>listFiles</code> property lists the document ids that need to be built into PDFs.</p>
        <p>The Ant application creates a list of images mentioned and used in the source documents and then downloads said images. The same process is applied to the fonts. In addition, the ant application runs the following targets:</p>
        <list rend="bulleted">
          <item>
            <label><code>createSpecialStylesModule</code></label>
            <p>Creates a special styles module, particular to the document that is being processed. This special module contains the formatting from the <gi>html</gi>/<gi>head</gi>/<gi>style</gi> element.</p>
          </item>
          <item>
            <label><code>addSpecialModulesToMaster</code></label>
            <p>Adds the special module to other <code>XSLT</code>s responsible for the creation of the PDFs.</p>
          </item>
          <item>
            <label><code>ValidateFo</code></label>
            <p>Validates the resulting <code>FO</code> document.</p>
          </item>
          <item>
            <label><code>getSourceFileFromJenkins</code></label>
            <p>Is responsible for retrieving the source <code>HTML</code> file from our server.</p>
          </item>
          <item>
            <label><code>processOneFile</code></label>
<p>Is the main (though not the default) target that processes the file (<code>docId</code>) in the following order: gets the file from Jenkins, creates the special styles module, adds the special module to the master module, creates the images list, copies the images, creates the fonts list, copies the fonts, creates the <code>FO</code> file, creates the PDF, and finally gets the <code>.png</code> of the title (cover) page (which is used in the creation of ePubs).</p>
          </item>
          <item>
            <label><code>createFO</code></label>
            <p>Creates the <code>XSL:FO</code> file from the <code>HTML</code> source file, as per the <code>docId_xhtml5_to_fo</code> transformation.</p>
          </item>
          <item>
            <label><code>createPdf</code></label>
            <p>Creates the PDF file from the <code>docID.fo</code> file using the <code>FOP</code> application.</p>
          </item>
          <item>
            <label><code>getTitlePage</code></label>
            <p>Gets the PDF’s title page in <code>.png</code> format, so we can use it for the ePubs. For this we use <code>pdftoppm</code> execution.</p>
          </item>
          <item>
            <label><code>buildFiles</code></label>
            <p>Is the default target; it runs <code>processOneFile</code> to build all the documents listed in the listFiles property.</p>
          </item>
        </list>
      </div>
      <div xml:id="pdfDev_about_addSpecialStyles">
        <head><code>add_special_styles_to_fo_master.xsl</code></head>
        <p>This <code>XSL</code> transformation is designed to include a special <code>XSL</code> styles module in the <code>xhtml5_to_fo_master</code>. It does so by creating a variable that gets the attributes from the special styles module. The file has templates that match onto the following elements: <gi>div</gi>, <gi>span</gi>, and <gi>img</gi>. These templates find the classes and their corresponding attribute sets to add the necessary attributes and their values, and apply other templates as required.</p>
      </div>
      <div xml:id="pdfDev_about_getAttributes">
        <head><code>get_attribute_sets_names.xsl</code></head>
        <p>This stylesheet is a rather simple one that reads the special styles module (<code>docId_styles_module.xsl</code>) and gets the attribute sets that need to be used. It stores them in an output file <code>listOfSets.txt</code> which gets used in <code>xhtml5_to_fo_master.xsl</code>.</p>
      </div>
      <div xml:id="pdfDev_about_listClasses">
        <head><code>list_classes_for_pdf.xsl</code></head>
        <p>This <code>XSL</code> transformation is designed to read the <gi>style</gi> element in the <code>HTML</code> file and list the styling classes needed for the particular PDF being built. It starts by parsing the <gi>style</gi> element as a string, stored in a variable (<code>$style</code>). The variable <code>$parsedClasses</code> stores the name of the classes so that we use them later in naming the attribute-sets. <code>$attribute</code> is the variable that has the attribute names as well as their values.</p>
        <p>The root template of this transformation creates the attribute sets corresponding to classes mentioned in the style element of the source file. It results in a document saved in <code>db/data/static/xsl</code> called <code>$docId_styles_module.xsl</code>. The template recreates the following variables: <code>parsedClasses</code>, and <code>parsedStyle</code>.</p>
      </div>
      <div xml:id="pdfDev_about_listFonts">
        <head><code>list_fonts_for_pdf.xsl</code></head>
        <p>This <code>XSLT</code> is designed to read the <code>CSS</code> files and list the fonts needed for the particular PDF being built. We adopt it from the transformation designed for ePubs. The root (main) template creates a list of fonts mentioned in the corresponding <code>CSS</code> files, to be then used by the ant file to copy these fonts into the PDF container folder. It first creates a variable that lists the css files. The files are then tokenized in $tokenizedCss and normalized in <code>$allCss</code>. The variable <code>$parsedCssFonts</code> results in a document <code>listOfFonts.txt</code> that contains <code>$distinctSiteFonts</code>, which gets the distinct values of the <code>$parsedCssFonts</code> variable.</p>
      </div>
      <div xml:id="pdfDev_about_listImages">
        <head><code>list_images_for_pdf.xsl</code></head>
        <p>This <code>XSLT</code> reads the <code>XHTML</code> and <code>CSS</code> files and list the images needed for the particular PDF being built. It is very similar in its structure to <code>list_fonts_for_pdf.xsl</code>: The root template creates a list of images mentioned in the corresponding <code>CSS</code> files as well as the <code>XHTML</code> file, to be then used by the ant file to copy these images into the PDF container folder. This template first creates a variable that lists the <code>CSS</code> files. The files are then tokenized in <code>$tokenizedCss</code> and normalized in <code>$allCss</code>. The variable <code>$parsedCssImages</code> results in a document <code>listOfImages.txt</code> that contains <code>$distinctSiteImages</code>, which gets the distinct values of the <code>$parsedCssImages</code> variable. This transformation also has a few hard coded images, given that they are not present in the <code>CSS</code> or <code>XHTML</code> files.</p>
      </div>
      <div xml:id="pdfDev_about_xhtmlToFo">
        <head><code>xhtml5_to_fo_master.xsl</code></head>
        <p>This <code>XSLT</code> is designed to convert a MoEML <code>XHTML5</code> static site document into a PDF. It converts the document to <code>XSL:FO</code>, validates the <code>FO</code>, and then the calling Ant script uses <code>FOP</code> to generate a PDF. This file includes the styles module <code>xhtml5_to_fo_styles_module.xsl</code> (discussed below), and <code>pfd_globals.xsl</code>. The root template sets up the <code>FO</code> basics: four simple page masters (title page, first page, recto page, and verso page). The sequence of pages follows. The <soCalled>main</soCalled> page-sequence contains the footers (title page, recto, and verso) and headers (recto and verso). The headers differ in their code as per born digital or primary source, because of the structure of their titles. The template that matches on the <gi>html</gi> element applies templates (both named and unnamed as discussed below).
          <list rend="bulleted">
            <item>
              <label>CreateTitlePage</label>
              <p>This template processes the metadata in the page header to get the key information. The aesthetic and stylistic components include: a background image, two flower logos (top and bottom), decorative lines (top and bottom) between which the title of the document sits, and a snippet of the agas map. The size of the title and the authors depends on the length of the title and the number of authors listed. The title page also contains the edition information (which is basically the release version at the time of the build).</p>
            </item>
            <item>
              <label>CreateHybridTitlePage</label>
              <p>This named template creates another title page that contains hybrid metadata, which includes the title, authors, compilers, and editors, in addition to the publication information. This template contains two conditions: one is when the document at hand is a born digital file, and the other is when it is a primary source file.</p>
            </item>
          </list>
        </p>
      </div>
      <div xml:id="pdfDev_about_unnamedTemplates">
        <head>Unnamed Templates</head>
        <list rend="bulleted">
          <item>
            <label>Matches <gi>div</gi></label>
            <p><gi>div</gi>s are transformed into <gi>fo:blocks</gi>. Their ids are replicated into <att>id</att> attributes. Depending on the class attribute of the <gi>div</gi>, the <gi>fo:block</gi> element gets assigned the appropriate attribute set(s). <gi>div</gi>s that are children or descendant of the appendix <gi>div</gi>, get special attribute sets that correspond to the appendix styling of the PDF.
            </p>
          </item>
          <item>
            <label>Matches <gi>nav</gi></label>
            <p><gi>nav</gi> elements are transformed into <gi>fo:blocks</gi>, and their ids are copied into corresponding <att>id</att> attributes.
            </p>
          </item>
          <item>
            <label>Matches <gi>ul</gi></label>
            <p><gi>ul</gi> elements are transformed into <gi>fo:list-block</gi> elements. Their ids are replicated into corresponding <att>id</att> attributes. <gi>ul</gi>s that are descendant of the appendix get special styling to correspond with the appendix styles.
            </p>
          </item>
          <item>
            <label>Matches <gi>ol</gi></label>
            <p><gi>ol</gi> elements are transformed into <gi>fo:list-block</gi> elements. Their ids are replicated into corresponding <att>id</att> attributes. <gi>ol</gi>s that are descendant of the appendix get special styling to correspond with the appendix styles.</p>
          </item>
          <item>
            <label>Matches <gi>li</gi></label>
            <p><gi>li</gi> elements are transformed into <gi>fo:list-item</gi> elements. Every <gi>fo:list-item</gi> contains an <gi>fo:list-item-label</gi> and an <gi>fo:list-item-body</gi>. Depending on their level in the list structure, <gi>fo:list-item-label</gi> and <gi>fo:list-item-body</gi> elements get the following attribute sets, respectively: <code>list-item-label</code> and <code>list-item-body</code>, <code>list-item-label-descendant</code> and <code>list-item-body-descendant</code>, <code>list-item-label-level3</code> and <code>list-item-body-level3</code>, <code>list-item-label-appendix</code> and <code>list-item-body-appendix</code>. In tables, <gi>fo:list-item-label</gi> and <gi>fo:list-item-body</gi> get attribute sets <code>list-item-label-table</code> and <code>list-item-body-table</code>, respectively. The page menu <gi>fo:list-item</gi> gets the attribute set <code>pageMenu</code>.</p>
          </item>
          <item>
            <label>Matches <gi>table</gi></label>
            <p><gi>table</gi>s are transformed into <gi>fo:table</gi>. When the table has a class attribute <code>contentTable</code>, the <gi>fo:table</gi> element gets the <code>contentTable</code> attribute set.</p>
          </item>
          <item>
            <label>Matches <gi>thead</gi></label>
            <p><gi>thead</gi>s are transformed into <gi>fo:table-header</gi> elements, with attribute set <code>table-head-td</code>.</p>
          </item>
          <item>
            <label>Matches <gi>tbody</gi></label>
            <p><gi>tbody</gi> elements are transformed into <gi>fo:table-body</gi> elements.</p>
          </item>
          <item>
            <label>Matches <gi>tr</gi></label>
            <p><gi>tr</gi> elements are transformed into <gi>fo:table-row</gi> elements.</p>
          </item>
          <item>
            <label>Matches <gi>td</gi></label>
            <p><gi>td</gi> elements are transformed into <gi>fo:table-cell</gi> elements. <gi>td</gi> elements with parents or ancestor <gi>thead</gi> elements acquire the attribute set <code>table-head-td</code>; if the <gi>td</gi> element has an ancestor <gi>table</gi> that has attribute class <code>contentTable</code>, the <gi>fo:table-cell</gi> gets the attribute set <code>contentTable-td</code>; otherwise, <gi>fo:table-cell</gi> elements get the <code>table-cell</code> attribute set.</p>
          </item>
          <item>
            <label>Matches <gi>a</gi></label>
            <p><gi>a</gi> elements are transformed into <gi>fo:basic-links</gi>, with attributes: <att>id</att>(if applicable), <att>external-destination</att> or <att>internal-destination</att> for the value of the <att>href</att> attribute of the <gi>a</gi> element, and color. If <gi>href</gi> ends with <code>.htm</code>, or contains <code>http</code>, <code>jpg</code>, <code>mp3</code>, the <gi>fo:basic-link</gi> gets an external destination attribute. The <gi>fo:basic-link</gi> also gets an <att>external-destination</att> attribute and other appropriate styling attributes, if the <gi>a</gi> element has a <att>class</att> attribute that is not <code>noteMarker</code> nor <code>returnFromNote</code> nor <code>local</code>. Otherwise, <gi>fo:basic-link</gi> gets an <att>internal-destination</att> attribute.</p>
          </item>
          <item>
            <label>Matches <gi>a</gi><code>[@href[starts-with(., ‘#’)]][not(@class= ‘pilcrow’)]</code></label>
            <p>This template is responsible for links that refer to ids, mostly with internal references. We use the variable <code>$thisid</code> to identify the <att>id</att> of the current <gi>a</gi> element. If <code>$thisid</code> is not stated anywhere else in the document, then the <code>fo:basic-link</code> will have an <att>external-destination</att>, with https://mapoflondon.uvic.ca/$thisid.htm. Otherwise, the <gi>fo:basic-link</gi> will have an internal destination, without the #, and with the appropriate attribute sets as per the class attributes.</p>
          </item>
          <item>
            <label>Matches <gi>p</gi></label>
            <p><gi>p</gi> elements become <gi>fo:blocks</gi>.</p>
          </item>
          <item>
            <label>Matches <gi>span</gi></label>
            <p><gi>span</gi> elements become <gi>fo:inline</gi> elements.</p>
          </item>
          <item>
            <label>Matches <gi>strong</gi></label>
            <p><gi>strong</gi> elements become <gi>fo:block</gi> elements when they have a parent element <gi>li</gi>, and <gi>fo:inline</gi> elements otherwise.</p>
          </item>
          <item>
            <label>Matches <gi>pre</gi></label>
            <p><gi>pre</gi> elements become <gi>fo:block</gi> elements when they have a parent element <gi>li</gi>, and <gi>fo:inline</gi> elements otherwise.
            </p>
          </item>
          <item>
            <label>Matches <gi>q</gi></label>
            <p><gi>q</gi> elements become <gi>fo:block</gi> elements when they have a parent element <gi>li</gi>, and <gi>fo:inline</gi> elements otherwise.</p>
          </item>
          <item>
            <label>Matches <gi>blockquote</gi></label>
            <p><gi>blockquote</gi> elements become <gi>fo:block</gi> elements with the <code>blockquote</code> attribute set.</p>
          </item>
          <item>
            <label>Matches <gi>code</gi></label>
            <p><gi>code</gi> elements are transformed into <gi>fo:inline</gi> elements with the <code>code</code> attribute set.</p>
          </item>
          <item>
            <label>Matches <gi>img</gi></label>
            <p><gi>img</gi> elements are transformed into <gi>fo:external-graphic</gi> elements. They all have the <code>images</code> attribute set, and when appropriate, they have an additional attribute set that corresponds to their appropriate class, including <code>acknowledgementImg</code> and <code>socialMediaImg</code>.</p>
          </item>
          <item>
            <label>Matches <gi>figure</gi></label>
            <p><gi>figure</gi> elements are transformed into <gi>fo:block</gi> elements.</p>
          </item>
          <item>
            <label>Matches <gi>figcaption</gi></label>
            <p><gi>ficgaption</gi> elements are transformed into <gi>fo:block</gi> elements. When the <gi>figcaption</gi> element contains the strings <soCalled>horizontal rule</soCalled> or <soCalled>Printer’s ornament</soCalled>, the <gi>fo:block</gi> element gets the attribute set <code>figcaption_special</code>; otherwise it gets the attribute set <code>figcaption</code>.</p>
          </item>
          <item>
            <label>Matches <gi>h1</gi></label>
            <p><gi>h1</gi> elements are transformed into <gi>fo:block</gi> elements. When <gi>h1</gi> has a child <gi>span</gi> that has a <att>class</att> attribute <code>titlePart</code>, it gets both attribute sets <code>h1</code> and <code>h1TitlePart</code>, otherwise it only get the attribute set <code>h1</code>.</p>
          </item>
          <item>
            <label>Matches <gi>h2</gi></label>
            <p><gi>h2</gi> elements are transformed into <gi>fo:block</gi> elements. When they are appendix headers, they get the attribute set <code>appendixH2</code>, otherwise they get the attribute set <code>h2</code>.</p>
          </item>
          <item>
            <label>Matches <gi>h3</gi></label>
            <p><gi>h3</gi> elements are transformed into <gi>fo:block</gi> elements. When they are appendix headers, they get the attribute set <code>appendixH3</code>; when they are appendix list headers, they get the attribute set <code>appendixListH3</code>, otherwise they get the attribute set <code>h3</code>.</p>
          </item>
          <item>
            <label>Matches <gi>h4</gi></label>
            <p><gi>h4</gi> elements are transformed into <gi>fo:block</gi> elements. When they are appendix headers, they get the attribute set <code>appendixH4</code>, otherwise they get the attribute set <code>h4</code>.</p>
          </item>
          <item>
            <label>Matches <gi>br</gi></label>
            <p><gi>br</gi> elements are transformed into <gi>fo:block</gi> elements.</p>
          </item>
          <item>
            <label>Matches <gi>hr</gi></label>
            <p>[Primary Source Element] <gi>hr</gi> elements are transformed into <gi>fo:leader</gi> elements, with <att>id</att> attributes when appropriate.</p>
          </item>
        </list>
        <p>This transformation is also responsible for removing the following components from the document: the top banner, <soCalled>See XML</soCalled>, <soCalled>More Info</soCalled>, blackletter typeface and toggle, script elements, <soCalled>Send Feedback</soCalled>, the footer menu, the info popup, document mentions, person’s contributions, person’s mentions, the citation header, facsimile figures, links to <code>agas.css</code> and <code>agas_embedded.css</code> from the header, pilcrow (¶) links, and social media logos. It also replaces <code>lightbox.css</code> with <code>nav.css</code>, rewrites some links as necessary, renames <soCalled>Personography</soCalled> into <soCalled>Contributors</soCalled>, rearranges appendix lists (historical persons and variant spellings), and sorts the personography alphabetically.</p>
        <p>Note that there are other removals that happen through <code>add_special_styles_to_fo_master.xsl</code>.</p>
      </div>
      <div xml:id="pdfDev_about_styles">
        <head><code>xhtml5_to_fo_styles_module.xsl</code></head>
        <p>This <code>XSLT</code> module contains the styling and layout data for the <code>XHTML5</code> to <code>XSL:FO</code> transformation, which turns MoEML <code>XHTML5</code> static site pages into PDFs. We will set up the pages 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. This module works with the special one created for the particular files being transformed. It contains all the master attribute sets needed, which have been mostly inspired from the various MoEML site <code>CSS</code> files. The attribute sets in this document do not include attributes or values that do not agree with <code>XSL:FO</code> or <code>FOP</code>. The structure is straight-forward: the <gi>xsl:stylesheet</gi> element contains all <gi>xsl:attribute-set</gi> elements that must have a <att>name</att> attribute. These elements in turn contain <gi>xsl:attribute</gi> elements, which also must have a <att>name</att> attribute and a value.</p>
      </div>
    </body>
  </text>
</TEI>