{book.libraryBranch := .} |
{let
$lines := for tumbling window $w in .//node()[self::text() or self::br]
start when true()
end $node when $node/self::br
return string-join($w),
$lines := if ( count($lines) = 4 and matches($lines[1], "\[.*\]") ) then
($lines[1] || $lines[2], $lines[3], $lines[4])
else
$lines,
$text := $lines[1],
$split := extract($text, "^\s*(\[([^\]]*)\])?\s*([^/]+)\s*(/\s*(.*))?", (2,3,5), "s")
return (
book.category := $split[1],
book.author := $split[3],
book.title := $split[2],
if (count($lines) > 1) then book.id := string-join(tail($lines), ":")
else ()
)
}
|
{book.status := inner-text(),
book.renewCount := extract($book.status, "([0-9]+) *Verlängerung", 1)
}
{book.statusId := "critical"}
|
{book.status := concat("vorgemerkt am ", inner-text()), book.statusId := "ordered"}
|
{
if ($mode = "lend") then (.//input!(book.extendid := encode-for-uri(@name)) )
else if ($mode = ("ordered", "requested", "provided","orderedMagazine")) then .//input!(book.cancelid := encode-for-uri(@name))
else (),
let $date := extract(., "(([0-9]{1,2}\.[0-9]{1,2}\.[0-9]{4}) *- *)?([0-9]{1,2}\.[0-9]{1,2}\.[0-9]{4})", (1,3))
where $date[2] and not($book.duedate)
return (
$book.duedate := parse-date($date[2]),
if ($date[1]) then $book.issuedate := parse-date($date[1]) else ()
)
} |