Created a template file for L. to start marking up an article, and posted it on Endive with instructions by email.
One of my days on lates this week.
According to the eXist docs, following:: and preceding:: will work, but not with wildcards; so following::text() is worth a shot...
Today:
- Added rendering for the document title and authors to the output.
- Re-thought the db structure for default strings and styles. It turns out we'll need GUI strings specific to individual style guides (e.g. "Retrieved [date], from [URL]" for APA), so I've subdivided the default subcollection into strings and styles subcollections, added an
apa_strings.xslfile, and updated thegetGuiStrings.xqcode so that it collects strings from the wholedefault/stringssubcollection. Similarly, the code for retrieving styles had to be slightly updated to take account of the db structure change. - Greatly expanded the db style information. We're now getting down to the nitty-gritty of rendering styles as the XHTML code moves forward, and I'm making a lot of decisions about what goes in the base styles and what goes into the style-guide style document.
- Added rendering for appendices.
- Began serious work on the bibliography rendering. So far I've done books and journal articles; a lot of stuff that needs to be done for all document types is now complete, including retrieval information for electronic references, name rendering, and title handling.
Tomorrow I'll try to finish first pass through the biblio code. One major issue still remains: finding out if the current set of authors (or editors, or whatever) is the same as the previous set, so that a dash should be used. That may take some thought.
Some of the code written today makes good use of the new features in XSLT/XPath 2.0 (for instance, I use a regular expression match to determine whether a title ends with punctuation or not, so I can add a period in the reference only when it's needed). The power of this has got me thinking about the possibility that the old thorny issue of commas inside quote marks could be handled this way. Imagine that, when rendering an article title in the text, the code looks ahead to the next text() element to see if it starts with punctuation. If it does, it grabs that punctuation and includes it in before the closing quote; similarly, a text() matching template could check for the preceding sibling to see if it's an element that would be rendered with quotes, and if so, any leading punctuation is removed. That would be cool. It would require a list of all elements that are rendered with quotes, to check against. The only thing not quite clear to me yet is how to reliably find the text() element immediately following the quoted element. There is a following:: axis, so following::text() should do it, but IIRC eXist doesn't yet support this axis.
Two CDs of new images arrived from the BN. Copied them to my HD so they'll get backed up, and renamed two files which have parentheses in them. Went through the images -- two seem like mistakes, but the others are fine, and look better than the last batch. Discussed how we'll get them started; Greg or I will go through and clean up the backgrounds, then we'll generate the thumbnails; meanwhile, Claire will supply titles. After that, I'll set up the IMT files for each image, with a title, and generate the wv_ 800px files for the website using the IMT. After that, I'll put all the images and files on the server where France can find them, and she can start marking up the text areas on the images.
Set up copies of the existing XML documents on Endive, and spent some time discussing XML, TEI, DTDs and schemas with Leif. He's worked through a lot of introductory material already, and he should be ready to start marking up tomorrow.
Per Martin's recommendation I suggest we purchase 2 Yamaha S659 DVD players for the labs. They will cost $199 each at A&B Sound. My justification for the recommendation is that DVD playback in the labs is too flaky, convoluted and unreliable. I have easily spent $400 worth of labour on trying to resolve this issue, to no avail.
UPDATE: these have been ordered (early September 2007)
Minor edits to History home page and employment opp. page per Leslie's request (sessional job postings and course space availability pdfs). PDFs were added to the files dir.
Cracked a major set of problems for teiJournal today.
Display styles are stored in three different places in the database: base_styles.xsl,
[styleguide]_styles.xsl, and the user's styles.xsl (containing customized styles). Each file contains a block of <xsl:attribute-set> elements, each of which represents a ruleset, and contains a set of <xsl:attribute> elements, each of which represents a property and a value.
These blocks then have to be combined in an intelligent way. The basic hierarchy is that base styles are overridden by any applicable styles in the style guide, and those styles are overridden by any in the user styles file. So any user styles replace styles from the other two files, style guide styles replace base styles, and base styles are output where there are no overrides in the other two files. Furthermore, where there are rulesets or rules in either of the two lower files which are not represented in their ancestors, these need to be output as well.
The big step forward today was the creation of an XQuery file capable of doing this cascading combination. The resulting code is pretty small, and worth documenting in full. There are two functions, f:getCombinedDoc(), which retrieves all the rulesets from the three documents in the database and joins them together into one file, and then f:getAttributeSets(), which combines rulesets together, ignoring any overridden rules, to produce a single source in the form of an <xsl:stylesheet> document. The functions look like this:
declare function f:getCombinedDoc() as element(){
let $guideId := request:get-parameter('guide', 'apa'),
$base := doc('/db/teiJournal/settings/default/base_styles.xsl'),
$guidePath := concat('/db/teiJournal/settings/default/', $guideId, '_styles.xsl'),
$guide := doc($guidePath),
$user := doc('/db/teiJournal/settings/user/styles.xsl')
return
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
{$base//xsl:attribute-set}
{$guide//xsl:attribute-set}
{$user//xsl:attribute-set}
</xsl:stylesheet>
};
declare function f:getAttributeSets() as element()*{
let $doc := f:getCombinedDoc()
for $setName in distinct-values($doc//xsl:attribute-set/@name)
return
<xsl:attribute-set name="{$setName}">
{
for $attName in distinct-values($doc/xsl:attribute-set[@name=$setName]/xsl:attribute/@name)
return
$doc//xsl:attribute[@name=$attName][./parent::xsl:attribute-set[@name=$setName]][position() = last()]
}
</xsl:attribute-set>
};
The resulting document is then passed on to an XSLT transformation which turns it into a real CSS stylesheet. The pipeline looks like this:
<map:match pattern="*/style.css">
<map:generate src="xq/getStyleSheet.xq" type="xquery">
<map:parameter name="guide" value="{1}" />
</map:generate>
<map:transform type="saxon" src="xsl/attribute_sets_to_css.xsl"/>
<map:serialize type="text" mime-type="text/css" />
</map:match>
Note the mime-type attribute on the serializer: without this, the file is served as text/plain, and the browser fails to interpret it as CSS, so it doesn't apply it to the Web page (this took half an hour to figure out).
So styles are now being applied to the XHTML output, and I can begin refining those styles by building the attribute-set files. Meanwhile, the last bits and pieces of the XHTML output itself need to be completed (appendix and biblio handling).
Met with JT and Leif, who will be doing workstudy this semester. Set up Leif on Endive, to do XML markup using oXygen. Initially he'll work through some TEI introductory materials, then start marking up Vol 17 articles. As he does each section of each type of article for the first time, we'll both work on documenting the practices that have evolved over the lifetime of the project, merging Trish's and my old documentation with newer info to create full documentation for the markup.