Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Remove double code
  • Loading branch information
kthoden committed Sep 10, 2020
1 parent c2f21bc commit 37976c6
Showing 1 changed file with 0 additions and 59 deletions.
59 changes: 0 additions & 59 deletions res/xml/xquery/series.xq
@@ -1,65 +1,6 @@
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>
xquery version "3.1";


declare namespace tei = "http://www.tei-c.org/ns/1.0";


Expand Down

0 comments on commit 37976c6

Please sign in to comment.