Fixed rendering bug with teaser text
This post describes the problem I worked on this morning. It turned out to be much more complicated than I'd anticipated. It wasn't an XSLT problem at heart; it was an XQuery issue. The root of it was this: During the process of creating a list of documents for the contents pages, the XQuery makes copies of the <biblStruct>
and <bibl>
elements inside the <sourceDesc>
of each document. However, in the process, it needs to inject some extra attributes into them, so it can't just copy them to the output; it has to reconstruct them. However, the bibl element content is mixed content (or at least, it was till today) when titles and so on are mentioned. There's no easy way to copy mixed content in a reliable way; you end up getting all the elements followed by all the text, or the elements don't get through at all, or any number of failure patterns depending on the strategy you take. In the end, I decided on a compromise solution: where the <bibl>
element contains mixed content, that content should be wrapped in a single <note>
element, so that it's copied intact to the output.
Having fixed the output of the 1621 Sonnet document by the addition of a <note>
element inside the <bibl>
, I then discovered that the XSLT in index.xsl
was not expecting any mixed content, so it just copied text to the output on the page. Once I changed the value-of
to an apply-templates
, I found that there weren't actually any templates for title elements at all (in this case, I needed monograph titles to appear in italics), so I added those to teiGeneral.xsl
, along with appropriate classes in the CSS file mariage_layout_typography.xsl
.
The difficulties thrown up by what looks like it should be a simple processing issue are typical of a project which has tended to grow organically rather than being planned at full scale before the markup was done. But that's the kind of project we have, for better or worse.