Skip to content
Permalink
6325e785b4
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
51 lines (47 sloc) 2.27 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 $title := $book//tei:titleStmt/tei:title[@type = 'main']/node()
let $chapter := $book//tei:text//tei:div[@type = 'chapter']
for $bit in $chapter
let $chaptertitle := $bit/tei:head/node()
let $chapterlanguage := xs:string($bit/@xml:lang)
let $chapterabstract := $bit/ab[@type='chapterabstract']
let $nonumber := $bit/@n
let $order := index-of($chapter, $bit)
let $resp := xs:string($bit/@resp)
let $resplist := tokenize($resp, " ")
order by $series, $number, $order
return
<pub>{
<title>{ $chaptertitle }</title>, <booktitle>{ $title }</booktitle>, <series>{ $series }</series>,
<number>{ $number }</number>, <order>{ $order }</order>, <chapterlanguage>{$chapterlanguage}</chapterlanguage>, <chapterabstract>{$chapterabstract}</chapterabstract>,<creators>{$resplist}</creators>,<numbered>{if ($nonumber = 'nonumber') then ("false") else ("true")}</numbered>,
<authors>
{
for $pp in $resplist
let $localname := xs:string($book/*//tei:respStmt[@xml:id = substring-after($pp, "#")]/tei:persName/@xml:lang)
let $inbookid := xs:string($book/*//tei:respStmt[@xml:id = substring-after($pp, "#")]/@xml:id)
let $firstname :=
$book/*//tei:respStmt[@xml:id = substring-after($pp, "#")]/tei:persName/tei:forename/node()
let $lastname :=
$book/*//tei:respStmt[@xml:id = substring-after($pp, "#")]/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>}
</pub>
}
</publications>