Skip to content
Permalink
37976c6faa
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
59 lines (55 sloc) 2.7 KB
xquery version "3.1";
declare namespace tei = "http://www.tei-c.org/ns/1.0";
<publications>
{
for $book in collection('/db/xml_files/publications')
let $series := $book//tei:seriesStmt/tei:title/text()
let $number := xs:int($book//tei:seriesStmt/tei:idno/text())
let $maintitle := $book//tei:titleStmt/tei:title[@type = 'main']/node()
let $subtitle := $book//tei:titleStmt/tei:title[@type = 'sub']/node()
let $mainlanguage := xs:string($book//tei:profileDesc/tei:langUsage/tei:language/@ident)
let $coverimage := $book//tei:text/tei:front/tei:figure[@type = 'cover']/tei:graphic/@url
let $date := xs:date($book//tei:publicationStmt/tei:date/@when)
let $abstract := $book//tei:profileDesc/tei:abstract[@n = 'brief']/tei:p
let $authororeditor := $book//tei:fileDesc/tei:titleStmt/(tei:editor[@role = 'volumeeditor'] | tei:author)[1]/name()
order by $series, $number
return
<pub>
<coverpath>{ concat("/", lower-case($series), "/", $number, "/", $coverimage) }</coverpath>
<mainlanguage>{ $mainlanguage }
</mainlanguage>
<series>{ $series }</series>
<number>{ $number }
</number>
<authors type="{ $authororeditor }">
{
let $pehere := $book//tei:fileDesc/tei:titleStmt/(tei:editor[@role = 'volumeeditor'] | tei:author)
for $pp in $pehere
let $localname := xs:string($book/*//tei:respStmt[@xml:id = substring-after($pp/@ref, "#")]/tei:persName/@xml:lang)
let $localid := xs:string($pp/@key)
let $inbookid := xs:string($book/*//tei:respStmt[@xml:id = substring-after($pp/@ref, "#")]/@xml:id)
let $firstname :=
$book/*//tei:respStmt[@xml:id = substring-after($pp/@ref, "#")]/tei:persName/tei:forename/node()
let $lastname :=
$book/*//tei:respStmt[@xml:id = substring-after($pp/@ref, "#")]/tei:persName/tei:surname/node()
return
<author><fullname>{
if ($localname = "zh") then
(concat($lastname, ' ', $firstname))
else
(concat($firstname, ' ', $lastname))
}</fullname>
<firstname>{ $firstname }</firstname>
<lastname>{ $lastname }</lastname>
<inbookid>{ $inbookid }</inbookid>
</author>
}
</authors>
<title>{ $maintitle }</title>
<subtitle>{ normalize-space($subtitle) }</subtitle>
<date>{ $date }</date>
<abstract>{ $abstract }
</abstract>
</pub>
}
</publications>