{$singleMode:=false()}
{$search-result-count}
{$search-result-count}
{$search-result-count := extract(.,"[0-9.,]+",0,"*")[position() le 3]}
Keine Ergebnisse$search-result-count:=0
No results$search-result-count:=0
{$search-result-count := extract(join(//script/node()[contains(., "piwik")]), "trackSiteSearch.*?, *([0-9]+)", 1, "s")}
{
singleMode := true(),
singleModeRecordId:=substring-after($url, "/Record/"),
$new-books := ()
}
vl:raise(.)
{$search-result-count := max( $search-result-count ! translate(.,".,","")[.] ! xs:integer(.) ),
$new-books := .//div[starts-with(@id, 'result')]/(
let $linkurls := .//a/@href
let $records := $linkurls[matches(., "/Record/[^/]+$")]/parent::a[normalize-space()[.]]
let $title := normalize-space($records[1])
let $author := join($linkurls[matches(., "/Author/.*author=([^&]+)|Results[?].*lookfor=([^&]+).*type=Author")]/parent::a)
let $year := (.//span[@property="publicationDate"], .//text()/extract(., "(,|published|Veröffentlicht|^)\s*\[?((ca\.\s*)?[1-3][0-9]{3})",2)[.])[1]
let $internalIds := distinct-values($records/@href)
let $splitBook := count($internalIds) > 1
let $cover := resolve-html((.//img[contains(@src, "cover")])[1])
for $internalId in $internalIds
return {"_recordId": substring-after($internalId, "/Record/"),
"title": if ($splitBook) then x"{$title} ({$records[@href eq $internalId][last()]})" else $title,
"author": $author,
"year": $year,
"image-url": $cover}
)}