I discuss some of the issues (some inevitable, some merely unfortunate) involved in the TEI encoding of lexicon entries in Lexicons. Reading that section will explain, for example, why the "wordlist-headword" and "wordlist-sense" note types exist (even though they simply duplicate content from the rest of the entry).
The two types of "wordlist" notes are intended to be XIncluded into other documents, without XIncluding anything higher up from them in the <entry> structure. So they may be distinguished in two contexts: when they have an ancestor which is an <entry> element (in which case they're part of the encoding of an overall entry) and when they do not (in which case they've been XIncluded into somewhere else). They should be ignored (no output) if they're part of an <entry> element, and processed if they're not (if they're XIncluded elsewhere).
The "wordlist-entry" note should be wrapped in a link to the actual lexicon entry. There is already an XSL function elsewhere in this Stylesheet which, given the current depth in the directory structure, generates the right number of "../../../" uplinks to get back to its root. Here, we want to go up one level less than that, because I'll adopt a convention that full lexicons exist in a first-level subdirectory of the language Notebook named "lexicon". So we'll need a "linkup-minus-one" function now, too.
This being XSL, I can't simply call the function where I need it (because XSL is only being used like a procedural language where one is needed; it isn't one). So I adopt the ruse of declaring a variable, setting it to the function's return value, and using the variable (which is really a constant) instead.
<<refrain>>= <xsl:template match="/"> <xsl:for-each select="*"> <xsl:text>I will not say rude things about language standards.</xsl:text> </xsl:for-each> </xsl:template>
The XSL 2.0 "escape-html-uri" function transforms a possibly Unicode string which might have spaces into a printable hex, basically. At present, the Mozilla I'm using to test this doesn't correctly recognize the resultant string, but I'm hoping it's the right encoding.
<<lexicons-wordlists>>= <xsl:template match="tei:note[@type='wordlist-headword']"> <xsl:if test="not(ancestor::tei:entry)"> <xsl:text> </xsl:text> <xsl:variable name="category-relative-url"> <xsl:call-template name="linkup-minus-one"> <xsl:with-param name="levels" select="$depth-in-category"/> </xsl:call-template> </xsl:variable> <a> <xsl:attribute name="href"><xsl:value-of select="$category-relative-url" />../lexicon/index.html#<xsl:value-of select="escape-html-uri(@xml:id)" /></xsl:attribute> <span type="wordlist-headword"><xsl:value-of select="." /></span>, </a> </xsl:if> </xsl:template> <xsl:template match="tei:note[@type='wordlist-sense']"> <xsl:if test="not(ancestor::tei:entry)"> <xsl:text> </xsl:text> <span type="wordlist-sense"> "<xsl:value-of select="." />"</span> </xsl:if> </xsl:template>
<<linkup-minus-one>>= <xsl:template name="linkup-minus-one"> <xsl:param name="levels" select="1"/> <xsl:if test="$levels > 1"> <xsl:text>../</xsl:text> <xsl:call-template name="linkup"> <xsl:with-param name="levels" select="$levels -1"/> </xsl:call-template> </xsl:if> </xsl:template>
The xml:id of the ENTRY element is the first part of the xml:id of its "wordlist-headword" note; append "-wordlist-headword" to this to get a reference to that (they cannot simply be encoded as the same, as all xml:id values must be unique; the note's xml:id must be encoded as it will be XIncluded where the full entry is not).
For now, I don't do much with entries.
<<lexicons-entries>>= <xsl:template match="tei:entry"> <xsl:text> </xsl:text> <ab> <xsl:attribute name="id"><xsl:value-of select="escape-html-uri(@xml:id)" />-wordlist-headword</xsl:attribute> <xsl:attribute name="type">lexicon-entry</xsl:attribute> <xsl:apply-templates/> </ab> </xsl:template> <xsl:template match="tei:form[@type='simple']"> <xsl:apply-templates/><xsl:text>. </xsl:text> </xsl:template> <xsl:template match="tei:form[@type='inflected']"> </xsl:template> <xsl:template match="tei:gramGrp"> </xsl:template> <xsl:template match="tei:sense[@type='simplistic']"> <xsl:apply-templates/> </xsl:template> <xsl:template match="tei:def"> <xsl:apply-templates/>. </xsl:template> <xsl:template match="tei:note[@type='in-vocabulary-of']"> <xsl:choose> <xsl:when test=". = 'athenaze'"> <xsl:text>A </xsl:text> </xsl:when> <xsl:when test=". = 'athenaze1'"> <xsl:text>A1 </xsl:text> </xsl:when> <xsl:when test=". = 'athenaze2'"> <xsl:text>A2 </xsl:text> </xsl:when> <xsl:when test=". = 'cheadle1'"> <xsl:text>C1 </xsl:text> </xsl:when> <xsl:when test=". = 'cheadle2'"> <xsl:text>C2 </xsl:text> </xsl:when> <xsl:when test=". = 'hansen and quinn'"> <xsl:text>HQ </xsl:text> </xsl:when> <xsl:when test=". = 'luschnig1'"> <xsl:text>L1 </xsl:text> </xsl:when> <xsl:when test=". = 'mastronarde'"> <xsl:text>M </xsl:text> </xsl:when> <xsl:when test=". = 'xenophon anabasis'"> <xsl:text>XA </xsl:text> </xsl:when> </xsl:choose> </xsl:template> <xsl:template match="tei:note[@type='language-or-dialect']"> </xsl:template>
<<lexicons>>= << lexicons-wordlists>> << lexicons-entries>> << linkup-minus-one>>
One final problem, which could probably be handled with a bit more attention in the make process, is that (unlike XML External Entity handling in graphein) there is no automatic determination of dependencies for XInclude. An update in a lexicon won't trigger, or even flag, a rebuild of things which use it. To be sure everything is right, do one last clean make from the top.
<<graphein-tohtml.xsl>>= <?xml version="1.0" encoding="utf-8" ?> <!-- graphein-tohtml.xsl "graphein" CircuitousRoot.com / lemur.com Tools XSLT to Transform TEI to XHTML Requires: A CSS stylesheet TEI P5 encoded source Attribute convensions as discussed in the graphein documents XSLT 1.1 compliant processor Parameters: required: base name of a CSS stylesheet Outputs: XHTML 1.0 Tested with: Saxon 6.5.3 Copyright 2006, 2022 by David M. MacMillan. This work is licensed under the Creative Commons Attribution-ShareAlike License. To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/2.0/ or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. CircuitousRoot.com and lemur.com are service marks of David M. MacMillan. "graphein" is not claimed by us as a service or trade mark; it's just a name. For other trademark attributions, see CircuitousRoot.com/trademarks Presented originally by CircuitousRoot.com --> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:tei="http://www.tei-c.org/ns/1.0" version="2.0"> <!-- ========== --> <!-- Parameters --> <!-- ========== --> <xsl:param name="own-basename" /> <xsl:param name="css-basename" /> <xsl:param name="scale-factor" /> <xsl:param name="location" /> <xsl:param name="depth-in-hierarchy" /> <xsl:param name="depth-in-category" /> <!-- ================= --> <!-- XSL Configuration --> <!-- ================= --> <xsl:output method="xml" encoding="utf-8" /> <!-- Suppress inter-tag whitespace in output. --> <!-- (Do output prettyprinting explicitly, adding #xA (linefeed) entities and spaces explicitly in xsl:text.) --> <xsl:strip-space elements="*" /> <!-- note: opposite is xsl:preserve-space --> <!-- ================== --> <!-- / --> <!-- root and TEI nodes --> <!-- | --> <!-- ================== --> <!-- TEI --> <xsl:template match="/"> <!-- yes, this is redundant --> <xsl:apply-templates/> </xsl:template> <xsl:template match="tei:TEI"> <xsl:text> </xsl:text> <html> <xsl:apply-templates/> <xsl:text> </xsl:text> </html> </xsl:template> <!-- ============= --> <!-- TEI --> <!-- TEI teiHeader --> <!-- |.... teiHeader --> <!-- ============= --> <!-- |.... text --> <xsl:template match="tei:teiHeader"> <xsl:text> </xsl:text> <head> <xsl:text> </xsl:text> <title> <xsl:value-of select="//tei:title" /> </title> <xsl:text> </xsl:text> <link> <xsl:attribute name="rel">stylesheet</xsl:attribute> <xsl:attribute name="type">text/css</xsl:attribute> <xsl:attribute name="media">screen</xsl:attribute> <xsl:attribute name="title"> <xsl:value-of select="$css-basename" /> </xsl:attribute> <xsl:attribute name="href"> <xsl:value-of select="$css-basename"/> <xsl:text>.css</xsl:text> </xsl:attribute> </link> <xsl:text> </xsl:text> </head> </xsl:template> <!-- suppress other teiHeader stuff --> <xsl:template match="tei:fileDesc"></xsl:template> <xsl:template match="tei:editionStmt"></xsl:template> <xsl:template match="tei:publicationStmt"></xsl:template> <xsl:template match="tei:sourceDesc"></xsl:template> <xsl:template match="tei:revisionDesc"></xsl:template> <!-- ============= --> <!-- text ......front --> <!-- TEI text Node --> <!-- |...body --> <!-- ============= --> <!-- |...back --> <xsl:template match="tei:text"> <xsl:apply-templates/> </xsl:template> <xsl:template match="tei:body"> <xsl:text> </xsl:text> <body> <xsl:apply-templates/> </body> </xsl:template> <!-- ================ --> <!-- TEI Front Matter --> <!-- ================ --> <xsl:template match="tei:front"> <xsl:apply-templates/> </xsl:template> <xsl:template match="tei:docTitle"> <xsl:apply-templates/> </xsl:template> <xsl:template match="tei:titlePart[@type='main']"> <xsl:text> </xsl:text> <xsl:text> </xsl:text> <h1 class="main"> <xsl:value-of select="." /> </h1> </xsl:template> <xsl:template match="tei:titlePart[@type='sub']"> <xsl:text> </xsl:text> <xsl:text> </xsl:text> <h1 class="sub"> <xsl:value-of select="." /> </h1> </xsl:template> <!-- Grab the contents of the teiHeader publicationStmt availability section, format it for the "legal matters" div, and put it whereever this template is called from (right before the close of the body, as it will happen. --> <xsl:template name="legal-matters"> <xsl:text> </xsl:text> <div class="legal-matters"> <xsl:apply-templates select="//tei:availability"/> <xsl:text> </xsl:text> </div> </xsl:template> <xsl:template match="tei:ab[@type='legal-item-pd']"> <xsl:text> </xsl:text> <p> <xsl:apply-templates/> </p> </xsl:template> <xsl:template match="tei:ab[@type='legal-item-regtm']"> <xsl:text> </xsl:text> <p> <xsl:apply-templates/> </p> </xsl:template> <xsl:template match="tei:ab[@type='legal-license-ccbysa']"> <xsl:text> </xsl:text> <p>This work is licensed under the Creative Commons "Attribution - ShareAlike" license. See <a href="http://creativecommons.org/licenses/by-sa/2.0/"> http://creativecommons.org/licenses/by-sa/2.0/</a> for its terms.</p> </xsl:template> <xsl:template match="tei:ab[@type='legal-license-gfdl']"> <xsl:text> </xsl:text> <p>Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled "<a href="gfdl">GNU Free Documentation License</a>".</p> </xsl:template> <xsl:template match="tei:ab[@type='legal-license-gfdl-ccbysa']"> <xsl:text> </xsl:text> <p>This work is licensed under either of two licenses, at your option:</p> <p>(A) Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled "<a href="gfdl">GNU Free Documentation License</a>".</p> <p>(B) This work is licensed under the Creative Commons "Attribution - ShareAlike" license. See <a href="http://creativecommons.org/licenses/by-sa/2.0/"> http://creativecommons.org/licenses/by-sa/2.0/</a> for its terms.</p> </xsl:template> <xsl:template match="tei:ab[@type='legal-license-gpl-gfdl-ccbysa']"> <xsl:text> </xsl:text> <p>The computer program(s) contained in this work are free software; you can redistribute them and/or modify them under the terms of the <a href="gpl">GNU General Public License</a> as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.</p> <p>These programs are distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.</p> <p>You should have received a copy of the GNU General Public License along with these programs; if not, write to the Free Software Foundation, Inc. 59 Temple Place, Suite 330 Boston, MA 02111-1307 USA</p> <p>This work considered as a document is licensed under either of two licenses, at your option:</p> <p>(A) Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled "<a href="gfdl">GNU Free Documentation License</a>".</p> <p>(B) This work is licensed under the Creative Commons "Attribution - ShareAlike" license. See <a href="http://creativecommons.org/licenses/by-sa/2.0/"> http://creativecommons.org/licenses/by-sa/2.0/</a> for its terms.</p> </xsl:template> <xsl:template match="tei:ab[@type='presented-by']"> <xsl:text> </xsl:text> <p>Presented originally by <xsl:value-of select="." /> <!-- <a> <xsl:attribute name="href"> <xsl:value-of select="." /> </xsl:attribute> </a> --> </p> </xsl:template> <!-- note: 'ab type="code" is block-level; for phrase-level code examples, use "code" --> <xsl:template match="tei:ab[@type='code']"> <xsl:text> </xsl:text> <pre> <xsl:apply-templates/> </pre> </xsl:template> <xsl:template name="pd-disclaimers"> <strong> <a href="http://www.circuitousroot.com/pd-disclaimers.html">Important disclaimers of warranty and liability in the presentation of public domain material</a>. </strong> </xsl:template> <!-- ======== --> <!-- TEI Body --> <!-- ======== --> <xsl:template match="tei:div[@type='chapter']"> <xsl:text> </xsl:text> <xsl:text> </xsl:text> <h2> <a name="{generate-id(.)}"> <xsl:number level="multiple" count="tei:div" format="1.1. "/> <xsl:value-of select="tei:head" /> </a> </h2> <xsl:apply-templates /> </xsl:template> <xsl:template match="tei:div[@type='section']"> <xsl:text> </xsl:text> <xsl:text> </xsl:text> <h2> <a name="{generate-id(.)}"> <xsl:number level="multiple" count="tei:div" format="1.1. "/> <xsl:value-of select="tei:head" /> </a> </h2> <xsl:apply-templates /> </xsl:template> <xsl:template match="tei:div[@type='broadside']"> <xsl:text> </xsl:text> <xsl:text> </xsl:text> <div class="broadside"> <xsl:apply-templates /> </div> </xsl:template> <xsl:template match="tei:div[@type='broadside-divider']"> <xsl:text> </xsl:text> <xsl:text> </xsl:text> <div class="broadside-divider"> <xsl:apply-templates /> </div> </xsl:template> <!-- This is null because we pick up the traversal of tei:head in the tei:div[@type='section'] template, above. --> <xsl:template match="tei:head"></xsl:template> <!-- Match tei:bibl only if NOT in a citation --> <xsl:template match="tei:bibl"> <xsl:choose> <xsl:when test="ancestor::tei:cit"> <!-- <xsl:when test="@n='citation'"> --> <xsl:text> </xsl:text> </xsl:when> <xsl:otherwise> <xsl:text> </xsl:text> <p class="bibl"> <xsl:attribute name="id"> <xsl:value-of select="@xml:id" /></xsl:attribute> <xsl:apply-templates/> </p> </xsl:otherwise> </xsl:choose> </xsl:template> <xsl:template match="tei:p"> <xsl:text> </xsl:text> <p> <xsl:apply-templates/> </p> </xsl:template> <xsl:template match="tei:ab[@type='epigraph']"> <xsl:text> </xsl:text> <div class="epigraph"> <xsl:apply-templates/> </div> </xsl:template> <!-- N.B.: (trick for CSS) output an empty, clear=both div as the last thing to ensure that by growing to include it (and it clears left and right) the enclosing CSS box will actually be as tall as the stuff it encloses. The xsl:text tag forces Saxon, at least, to use an explicit closing tag (which shouldn't matter to the browser, but does). --> <xsl:template match="tei:ab[@type='abstract']"> <xsl:text> </xsl:text> <div class="abstract"> <xsl:apply-templates/> <div style="clear:both;"><xsl:text> </xsl:text></div></div> </xsl:template> <xsl:template match="tei:distinct[@type='abstract-title']"> <xsl:text> </xsl:text> <p class="abstract-title"> <xsl:apply-templates/> </p> </xsl:template> <xsl:template match="tei:distinct[@type='abstract-p']"> <xsl:text> </xsl:text> <p class="abstract-p"> <xsl:apply-templates/> </p> </xsl:template> <xsl:template match="tei:emph"> <xsl:text> </xsl:text> <i> <xsl:apply-templates/> </i> </xsl:template> <xsl:template match="tei:hi[@rend='italic']"> <xsl:text> </xsl:text> <i> <xsl:apply-templates/> </i> </xsl:template> <!-- +++++++++++++ --> <!-- "boilerplate" --> <!-- +++++++++++++ --> <xsl:template match="tei:ab[@type='boilerplate-about-the-images']"> <xsl:text> </xsl:text> <p>All of the images here are in the public domain in the USA, with sources as indicated.</p> <p>Often the originals are too large to present online. Click (or right-click to download) on each image for a larger (if not as large as possible) version.</p> <p>The images which serve as links to other documents on this site are described on the "About the Images" pages for those linked documents.</p> </xsl:template> <!-- For "grapheinlink" links, the "target" attribute specifies only the base name of the link. If it contains a "#", then this attribute's value must be split into filename#location-in-file. Append a scale factor suffix and ".html" to the filename, then (if present), #location-in-file The alternative is to code the location-in-file separately in the TEI, but the TEI doesn't really accomodate this (the "target" attribute takes a URI, basically, which is what this is; the alternative cRef (canonical ref) attribute doesn't quite fit). The XPath substring-before() and substring-after() make this almost too easy (the only trick is to realize that if there is no # then substring-before(), logically, returns an empty string). Note: The part after the # is called the "fragment identifier" This is defined in RFC 2396 "The format and interpretation of fragment identifiers is dependent on the media type (RFC2046) of the retrieval result." So I think there's no reason it can't be null, which makes it possible always to append # here, even when substring-after() returns an empty string. --> <xsl:template match="tei:ref[@n='grapheinlink']"> <xsl:text> </xsl:text> <a> <xsl:if test="true() = contains(@target,'#')"> <xsl:attribute name="href"> <xsl:value-of select="substring-before(@target,'#')" />-<xsl:value-of select="$scale-factor" />.html#<xsl:value-of select="substring-after(@target,'#')" /></xsl:attribute> </xsl:if> <xsl:if test="true() != contains(@target,'#')"> <xsl:attribute name="href"> <xsl:value-of select="@target" />-<xsl:value-of select="$scale-factor" />.html</xsl:attribute> </xsl:if> <xsl:apply-templates/> </a> </xsl:template> <!-- For non-"grapheinlink" links, the "target" attribute specifies the entire link filename, including any ".jpg" or ".png" suffixes (for local images) or ".html" suffixes (probably for offsite links. --> <xsl:template match="tei:ref"> <xsl:text> </xsl:text> <a> <xsl:attribute name="href"> <xsl:value-of select="@target" /></xsl:attribute> <xsl:apply-templates/> </a> </xsl:template> <xsl:template match="tei:list"> <xsl:text> </xsl:text> <ul> <xsl:apply-templates/> </ul> </xsl:template> <xsl:template match="tei:item"> <xsl:text> </xsl:text> <li><xsl:apply-templates/></li> </xsl:template> <xsl:template match="tei:table"> <xsl:text> </xsl:text> <table> <xsl:apply-templates/> </table> </xsl:template> <xsl:template match="tei:row"> <xsl:text> </xsl:text> <tr> <xsl:apply-templates/> </tr> </xsl:template> <xsl:template match="tei:cell"> <xsl:text> </xsl:text> <td> <xsl:apply-templates/> </td> </xsl:template> <xsl:template match="tei:cit"> <xsl:text> </xsl:text> <xsl:apply-templates/> </xsl:template> <xsl:template match="tei:quote"> <xsl:text> </xsl:text> <div class="bc"> <xsl:apply-templates/> - <xsl:value-of select="../tei:bibl/tei:author" />. <cite><xsl:value-of select="../tei:bibl/tei:title" /></cite>. </div> </xsl:template> <xsl:template match="tei:l"> <xsl:text> </xsl:text> <xsl:apply-templates/> <br /> </xsl:template> <xsl:template match="tei:title"> <i><xsl:apply-templates/></i> </xsl:template> << lexicons>> <!-- note: "code" is phrase-level, for block-level code examples, use 'ab type="code"' --> <xsl:template match="tei:code"> <xsl:text> </xsl:text> <tt> <xsl:apply-templates/> </tt> </xsl:template> <xsl:template match="tei:distinct[@type='filename']"> <xsl:text> </xsl:text> <tt> <xsl:apply-templates/> </tt> </xsl:template> <xsl:template match="tei:distinct[@type='input']"> <xsl:text> </xsl:text> <tt> <xsl:apply-templates/> </tt> </xsl:template> <xsl:template match="tei:distinct[@type='output']"> <xsl:text> </xsl:text> <tt> <xsl:apply-templates/> </tt> </xsl:template> <xsl:template match="tei:distinct[@type='output-block']"> <xsl:text> </xsl:text> <pre> <xsl:apply-templates/> </pre> </xsl:template> <xsl:template match="tei:distinct[@type='keyword']"> <xsl:text> </xsl:text> <b> <xsl:apply-templates/> </b> </xsl:template> <xsl:template match="tei:distinct[@type='variable']"> <xsl:text> </xsl:text> <tt> <xsl:apply-templates/> </tt> </xsl:template> <!-- "function" is a synonym for "variable" in usage here --> <xsl:template match="tei:distinct[@type='function']"> <xsl:text> </xsl:text> <u><tt> <xsl:apply-templates/> </tt></u> </xsl:template> <xsl:template match="tei:distinct[@type='program']"> <xsl:text> </xsl:text> <b><tt> <xsl:apply-templates/> </tt></b> </xsl:template> <xsl:template match="tei:figure"> <xsl:text> </xsl:text> <xsl:apply-templates/> <p><xsl:value-of select="tei:head" /></p> </xsl:template> <xsl:template match="tei:figDesc"> </xsl:template> <!-- Case 1: non-scalable bitmap if width exists assume height exists, too assume that this is a non-scalable bitmap Case 2: not a non-scalable bitmap generate bitmap img tag check first for PNG, then for JPG For now, don't specify width/height I can't figure out how to extract width/height from the image from XSLT. The shell commands to get the information are: echo `identify linking-example.png` | awk '{ print substr($3,0,index($3,"x")-1) }' echo `identify linking-example.png` | awk '{ print substr($3,index($3,"x")+1,length($3)-index($3,"x")) }' check if SVG version exists; generate href to it if it does --> <xsl:template match="tei:graphic"> <xsl:variable name="image-name-base" select="@url" /> <xsl:choose> <xsl:when test="@width"> <img> <xsl:attribute name="src"> <xsl:value-of select="@url" /></xsl:attribute> <!-- do not generate these here; will be patched up using awk in makefile <xsl:attribute name="width"> <xsl:value-of select="@width" /></xsl:attribute> <xsl:attribute name="height"> <xsl:value-of select="@height" /></xsl:attribute> --> <xsl:attribute name="alt"> <xsl:value-of select="../tei:figDesc" /></xsl:attribute> </img> </xsl:when> <xsl:otherwise> <img> <xsl:attribute name="src"> <xsl:value-of select="$image-name-base" />-sf<xsl:value-of select="$scale-factor" />.jpg</xsl:attribute> <xsl:attribute name="alt">image <xsl:value-of select="$image-name-base" />-sf<xsl:value-of select="$scale-factor" />.jpg</xsl:attribute> </img> </xsl:otherwise> </xsl:choose> </xsl:template> <!-- =============================== --> <!-- Minimalist Literate Programming --> <!-- =============================== --> <!-- Note: The run-on line in the PRE definition is important for avoiding extra space in the HTML. --> <xsl:template match="tei:ab[@type='code-chunk-start']"> <xsl:text> </xsl:text> <pre class="code-chunk"><<<xsl:value-of select="@xml:id" />>>=<xsl:apply-templates/></pre> </xsl:template> <xsl:template match="tei:ab[@type='code-chunk']"> <xsl:text> </xsl:text> <pre class="code-chunk"><<<xsl:value-of select="@xml:id" />>>=<xsl:apply-templates/></pre> </xsl:template> <xsl:template match="tei:seg[@type='code-chunk-ref']"> <<<u><xsl:apply-templates/></u>>></xsl:template> <xsl:template match="tei:ab[@type='gmlp-static-reference']"> <xsl:apply-templates/> </xsl:template> <!-- ============= --> <!-- Legal Section --> <!-- ============= --> <xsl:template match="tei:ab[@type='copyright']"> <xsl:text> </xsl:text> <p> <xsl:text>All portions of this document not noted otherwise are Copyright © </xsl:text> <xsl:apply-templates/> </p> </xsl:template> <!-- ========================== --> <!-- Backward and Forward Links --> <!-- ========================== --> <!-- These differ from the "Standard Links" below in that they require information coded in the TEI. --> <xsl:template match="tei:div[@type='backward-forward-links']"> <xsl:text> </xsl:text> <p> <xsl:apply-templates/> </p> </xsl:template> <xsl:template match="tei:ab[@type='backward']"> <xsl:text> </xsl:text> §<a> <xsl:attribute name="href"> <xsl:value-of select="@n" />-<xsl:value-of select="$scale-factor" />.html</xsl:attribute> Back to Previous Section </a>§ </xsl:template> <xsl:template match="tei:ab[@type='forward']"> <xsl:text> </xsl:text> <a> <xsl:attribute name="href"> <xsl:value-of select="@n" />-<xsl:value-of select="$scale-factor" />.html</xsl:attribute> Forward to Next Section </a>§ </xsl:template> <!-- ============== --> <!-- Standard Links --> <!-- ============== --> <!-- (Automatically generated, not from TEI encoding per se.) --> <!-- Aside on CSS: I'm hiding a bit of CSS trickery here. Originally, I'd wanted to put the "Home", "Category", etc. words below the images. The trouble with that is that, first, CSS doesn't automatically make the enclosing div as high as the divs it encloses - so it ends up here being just an empty invisible line with the various link divs "hanging" down from it. I can overcome this by outputting an empty div after the "Up" div and specifying in its CSS (either here with "style=" or in the CSS stylesheet) "clear: both". But although this makes the enclosing div actually enclose the link divs, it still isn't possible to make the link divs align to the bottom of the enclosing div (I *think* they still think it's a zero-height line, but I could be wrong here). So I avoid the problem entirely by putting the words above the pictures, so that top-alignment seems natural. There must be a philosophical message here, but whatever it is I don't think I like it. --> <xsl:template name="standard-links"> <xsl:text> </xsl:text> <hr /> <div class="standard-links"> <!-- note: must use the lt entity rather than the literal left-angle character --> <!-- Home link appears in locations 2, 1, 0 --> <xsl:if test="$location < 3"> <xsl:variable name="home-relative-url"> <xsl:call-template name="linkup"> <xsl:with-param name="levels" select="$depth-in-hierarchy"/> </xsl:call-template> </xsl:variable> <div class="standard-linking-image"> <a> <xsl:attribute name="href"><xsl:value-of select="$home-relative-url" />index.html</xsl:attribute> Home<br /> <img> <xsl:attribute name="src">link-home-sf<xsl:value-of select="$scale-factor" />.jpg</xsl:attribute> <xsl:attribute name="alt">Link to Home Page</xsl:attribute> </img> </a> </div> </xsl:if> <!-- Category link appears in locations 1, 0 --> <xsl:if test="$location < 2"> <!-- <xsl:if test="$own-basename = 'index'"> --> <xsl:variable name="category-relative-url"> <xsl:call-template name="linkup"> <xsl:with-param name="levels" select="$depth-in-category"/> </xsl:call-template> </xsl:variable> <div class="standard-linking-image"> <a> <xsl:attribute name="href"><xsl:value-of select="$category-relative-url" />index.html</xsl:attribute> Category<br /> <img> <xsl:attribute name="src">link-category-sf<xsl:value-of select="$scale-factor" />.jpg</xsl:attribute> <xsl:attribute name="alt">Link to Catetory Page</xsl:attribute> </img> </a> </div> </xsl:if> <!-- <xsl:if test="$own-basename != 'index'"> <div class="standard-linking-image"> <a href="index.html"> <img> <xsl:attribute name="src">link-topic-sf<xsl:value-of select="$scale-factor" />.jpg</xsl:attribute> <xsl:attribute name="alt">Link to Category Page at same level; = Topic</xsl:attribute> </img><br /> Category </a> </div> </xsl:if> </xsl:if> --> <!-- Topic link appears in location 0 --> <xsl:if test="$location = 0"> <div class="standard-linking-image"> <a href="index.html"> Topic<br /> <img> <xsl:attribute name="src">link-topic-sf<xsl:value-of select="$scale-factor" />.jpg</xsl:attribute> <xsl:attribute name="alt">Link to Topic Page</xsl:attribute> </img> </a> </div> </xsl:if> <!-- Up link appears in locations 1, 0 --> <xsl:if test="$location < 2"> <div class="standard-linking-image"> <a href="../index.html"> Up<br /> <img> <xsl:attribute name="src">link-up-sf<xsl:value-of select="$scale-factor" />.jpg</xsl:attribute> <xsl:attribute name="alt">Link Up</xsl:attribute> </img> </a> </div> </xsl:if> </div> <!-- "Select Resolution: ..." --> <div class="broadside"> <xsl:variable name="home-relative-url"> <xsl:call-template name="linkup"> <xsl:with-param name="levels" select="$depth-in-hierarchy"/> </xsl:call-template> </xsl:variable> <!-- this is a kludge, but I'm tired :-) I should loop up to the max scale factor --> <xsl:if test="$scale-factor = 0"> <p>Select <a> <xsl:attribute name="href"><xsl:value-of select="$home-relative-url" />about-resolution-0.html</xsl:attribute>Resolution</a>: <xsl:text>0 </xsl:text> <a> <xsl:attribute name="href"><xsl:value-of select="$own-basename" />-1.html</xsl:attribute>1 </a> <xsl:text> </xsl:text> <a> <xsl:attribute name="href"><xsl:value-of select="$own-basename" />-2.html</xsl:attribute>2 </a> </p> </xsl:if> <xsl:if test="$scale-factor = 1"> <p>Select <a> <xsl:attribute name="href"><xsl:value-of select="$home-relative-url" />about-resolution-1.html</xsl:attribute>Resolution</a>: <a> <xsl:attribute name="href"><xsl:value-of select="$own-basename" />-0.html</xsl:attribute>0 </a> <xsl:text> 1 </xsl:text> <a> <xsl:attribute name="href"><xsl:value-of select="$own-basename" />-2.html</xsl:attribute>2 </a> </p> </xsl:if> <xsl:if test="$scale-factor = 2"> <p>Select <a> <xsl:attribute name="href"><xsl:value-of select="$home-relative-url" />about-resolution-2.html</xsl:attribute>Resolution</a>: <a> <xsl:attribute name="href"><xsl:value-of select="$own-basename" />-0.html</xsl:attribute>0 </a> <xsl:text> </xsl:text> <a> <xsl:attribute name="href"><xsl:value-of select="$own-basename" />-1.html</xsl:attribute>1 </a> <xsl:text> 2</xsl:text> </p> </xsl:if> <!-- W3C validators --> <!-- If the objects, the W3C validator logo images, can be loaded from the W3C's server, then it is likely that their links also work. If they cannot, then keep their links, but default to text messages that indicate that validation is not available. This is useful whenever there is no connection to the public Internet. --> <!-- <p> <a href="http://validator.w3.org/check?uri=referer"> <object title="W3C XHTML 1.0 Validated Logo" type="image/png" width="88" height="31" standby="W3C XHTML 1.0 Validated Logo" data="http://www.w3.org/Icons/valid-xhtml10.png"> [XHTML 1.0 Validation Unavailable] </object></a> <a href="http://jigsaw.w3.org/css-validator/check/referer"> <object title="W3C CSS Validated Logo" type="image/png" width="88" height="31" standby="W3C CSS Validated Logo" data="http://jigsaw.w3.org/css-validator/images/vcss.png"> [CSS Validation Unavailable] </object></a> </p> --> </div> </xsl:template> <!-- print out n "../"s, for use in standard linking --> <!-- use recursion to do loops in XSL --> <xsl:template name="linkup"> <xsl:param name="levels" select="1"/> <xsl:if test="$levels > 0"> <xsl:text>../</xsl:text> <xsl:call-template name="linkup"> <xsl:with-param name="levels" select="$levels -1"/> </xsl:call-template> </xsl:if> </xsl:template> <!-- =============== --> <!-- TEI Back Matter --> <!-- =============== --> <xsl:template match="tei:back"> <xsl:text> </xsl:text> <xsl:call-template name="legal-matters" /> <xsl:apply-templates/> <xsl:text> </xsl:text> <xsl:call-template name="standard-links" /> </xsl:template> <xsl:template match="tei:ab[@type='about-the-images-link']"> <xsl:text> </xsl:text> <p> <a> <xsl:attribute name="href">about-the-images-<xsl:value-of select="$scale-factor" />.html</xsl:attribute>About the images</a></p> </xsl:template> </xsl:stylesheet>
All portions of this document not noted otherwise are Copyright © 2006-2007, 2022 by David M. MacMillan.
Circuitous Root is a Registered Trademark of David M. MacMillan.
This work is licensed under either of two licenses, at your option:
(A) Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled " GNU Free Documentation License".
(B) This work is licensed under the Creative Commons "Attribution - ShareAlike" license. See http://creativecommons.org/licenses/by-sa/3.0/ for its terms.
Presented originally by Circuitous Root®