Я пытаюсь отобразить титульную страницу в формате xml, что я делаю через приложение eXist-db. Вот соответствующий xml:
<front>
<titlePage>
<titlePart>
<lb>THE</lb>
<lb>ADVENTURES</lb>
<lb>OF</lb>
<lb>Roderick Random.</lb>
<lb><epigraph xml:lang="la">
<cit>
<quote xml:lang="la" link="http://www.perseus.tufts.edu/hopper/text?doc=Perseus%3Atext%3A1999.02.0062" title="Satires 2.5.8: 'But birth and virtue, unless [attended] with substance, is viler than seaweed.'">
<l>Et genus & virtus, nisi cum re, vilior alga est.</l>
</quote>
<bibl>
<author ref="HOR" link="http://en.wikipedia.org/wiki/Horace" title="Quintus Horatius Flaccus, Roman lyric poet of the 1st century BCE">HOR.</author>
</bibl>
</cit>
</epigraph>
</lb>
<lb>IN TWO VOLUMES.</lb>
<lb>VOL. I.</lb>
<lb>THE TENTH EDITION.</lb>
<hr/>
<lb><name type="place">LONDON:</name></lb>
<lb>Printed for W. STRACHAN, J. RIVINGTON, R. BALDWIN, HAWES CLARKE, AND COLLINS, W. JOHNSTON, T. CASLON, B. LAW, J. JOHNSON AND Co, W. AND J. RICHARDSON, T. BECKETT, and P.. DeHONDT,</lb>
<lb><date title="1775">MDCCLXXV.</date></lb>
</titlePart>
</titlePage>
<pb n="titlepage" facs="smollett.png"/>
</front>
Графически на данный момент все, что я хочу, это каждые <lb>
в отдельной строке. Я также хочу, чтобы <epigraph>
появлялись везде, где они есть, в рамках существующей логики титульного листа, то есть в соответствии с существующими <lb>
. Этот снимок экрана должен помочь прояснить ситуацию: снимок экрана с некорректной визуализацией страницы
Вот соответствующие биты .xql с преобразованиями xsl. Если вы хотите увидеть все .xql, вы можете увидеть это здесь (опять же, извиняюсь за истинную неэлегантность): https://gist.github.com/tonyahowe/c55167e13ae22139f94080289cb88f47:
declare function tei2:tei2html($nodes as node()*) {
for $node in $nodes
return
typeswitch ($node)
case text() return
$node
case element(tei:TEI) return
tei2:tei2html($node/*)
case element(tei:teiHeader) return
tei2:header($node)
case element(tei:frontTitle) return
<h3>{ tei2:tei2html($node/node()) }</h3>
case element(tei:lb) return
<br>{ tei2:tei2html($node/node()) }</br>
case element(tei:l) return
<l>{ tei2:tei2html($node/node()) }</l>
case element(tei:i) return
<i>{ tei2:tei2html($node/node()) }</i>
case element(tei:pb) return
<span style="color:lightgray">[end page {tei2:tei2html($node/@n)}]{ tei2:tei2html($node/node()) }</span>
case element(tei:footer) return
<hr>{ tei2:tei2html($node/node()) }</hr>
case element(tei:front) return
tei2:front($node)
case element(tei:rs) return
tei2:link($node)
case element(tei:quote) return
tei2:link($node)
case element(tei:note) return
tei2:note($node)
case element(tei:footnote) return
tei2:footnote($node)
case element(tei:p) return
<p xmlns="http://www.w3.org/1999/xhtml" id="{tei2:get-id($node)}">{ tei2:tei2html($node/node()) }</p> (: THIS IS WHERE THE ANCHORS ARE INSERTED! :)
case element(exist:match) return
<mark xmlns="http://www.w3.org/1999/xhtml">{ $node/node() }</mark>
case element() return
tei2:tei2html($node/node())
default return
$node/string() (: what would this catch? comment node in the xml? :)
};
declare function tei2:link($node as element()) {
if ($node/@link ne '' and $node/@link castable as xs:anyURI) then
<a href="{$node/@link}" data-toggle="tooltip" title="{$node/@title}">{
tei2:tei2html( $node/node() )
}</a>
else
tei2:tei2html( $node/node() )
};
declare function tei2:note($node as element()) {
<span style="color:black" href="{$node/@link}" data-toggle="tooltip" title="{$node/@title}"> {
tei2:tei2html ( $node/node() )
}</span>
};
-------------------------- cut
declare function tei2:front($front as element (tei:front)) {
let $titlePage := $front//tei:titlePage
let $titlePart := $front//tei:titlePart
let $epigraph := $front//tei:epigraph
let $note := $front//tei:note
let $argument := $front//tei:argument
let $quote := $front//tei:quote
let $bibl := $front//tei:bibl
let $author := $front//tei:author
return
<div xmlns="http://www.w3.org/1999/xhtml" class="main-text-frontmatter">
{
for $lb in $titlePage
return
$titlePage//tei:lb
}
{
console:log($epigraph),
for $cit in $epigraph
return
<blockquote>
{
<a href="{$quote/@link}" data-toggle="tooltip" title="{$quote/@title}">{$quote/tei:l}</a>
}<br/>
--
{
<a href="{$author/@link}" data-toggle="tooltip" title="{$author/@title}">{$author/text()}</a>
}
</blockquote>
}
</div>
};