Today a basic display, tomorrow the world?

Thanks in very large part to the patience and availability of a couple of awesome open source developers, I have a basic application that displays the texts in the collection with header info! I haven’t started on formatting, searching, exporting, or incorporating the page images, but soon. Also, I learned where to put the .PNG file for your application icon so it’s visible in the exist-db dashboard (here, as ICON.PNG: C:eXist-dbwebappWEB-INFdataexpathrepoNiC-0.1 — or whatever your app is called). For some reason there’s an empty “title” in the work list, though, which I have to figure out. I also want to add a sort by author and type feature. That should be pretty easy to do, right? Right.

An icon!
Frong page
Sample text

I also was able to add a console module, so I can see what’s getting called where–thanks especially to @wolfgangm. Overall, I’ve been working on simplifying the code so it makes more sense to me and so I can learn how to follow it from point to point. My new XQL page to view the work–like the screen shot above of The Memoirs of Emma Courtney–looks like this:

module namespace tei2=””;
import module namespace console=””;

declare namespace tei=”″;

declare function tei2:tei2html($nodes as node()*) {
for $node in $nodes
typeswitch ($node)
case text() return
case element(tei:TEI) return
case element(tei:teiHeader) return
case element(tei:front) return
case element(tei:body) return
case element(tei:p) return
<p xmlns=””&gt;{$node}</p>
case element(tei:span) return
case element() return
default return

declare function tei2:header($header as element(tei:teiHeader)) {
let $titleStmt := $header//tei:titleStmt
let $pubStmt := $header//tei:publicationStmt
let $sourceDesc := $header//tei:sourceDesc

<div xmlns=”; class=”text-header”>
<h2>By {$titleStmt/tei:author/text()}</h2>

for $resp in $titleStmt/tei:respStmt
<p>{$resp/tei:resp/text()}: {$resp/tei:name/text()} </p>

{ tei2:tei2html($pubStmt/*) }
for $publisher in $sourceDesc/tei:imprint
<li class=”imprint”>{$publisher/tei:publisher/text()}, {$publisher/tei:pubPlace/text()}. {$publisher/tei:extent/text()}. {$publisher/tei:date/text()}. {$publisher/tei:biblScope/text()}. {$publisher/tei:note/text()}</li>

declare function tei2:front($front as element (tei:front)) {
let $frontTitle := $front//tei:head
let $epigraph := $front//tei:epigraph
let $quote := $front//tei:quote
let $bibl := $front//tei:bibl

<div xmlns=”; class=”main-text-frontmatter”>
for $cit in $epigraph

declare function tei2:body($body as element (tei:body)) {
let $para := $body//tei:p

<div xmlns=”; class=”main-text”>
for $para in $body/* (: without the slash asterisk nothing returns–why? : )
<p>{$para//text()}</p> (: adding an extra slash shows the text of the span anas inside each p; with one slash, content of spans are dropped. why? tag is stripped. : )

declare %private function tei2:get-id($node as element()) {
($node/@xml:id, $node/@exist:id)[1]

I know what most of this means, too! (The private function, not so much, nor the logic behind the asterisk and the extra slash in the context above. But still.) So, progress. Yay!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: