{
book := {"_mode": $mode},
if ($mode = "lend") then (book.extendid := encode-for-uri(input/@name), book._splitIndex := $splitIndex )
else if ($mode = ("ordered", "requested", "provided","orderedMagazine")) then book.cancelid := encode-for-uri(input/@name)
else (),
if ($mode = "provided") then book.statusId := "provided"
else ()
} |
{
if (contains(., "-")) then (book.issuedate := parse-date(substring-before(., "-"), "dd.mm.yyyy"), book.duedate := parse-date(substring-after(., "-"), "dd.mm.yyyy"))
else book.duedate := parse-date(., "dd.mm.yyyy")
} |
{
if (contains(., ".")) then book.duedate := parse-date(., "dd.mm.yyyy")
else ()}
|
{book.libraryBranch := .} |
{book.category := extract(text(), "^ *\[([^\]]*)\]", 1),
book.title := if (starts-with(text(), "[")) then extract(text(), "(\] )(.*)", 2) else text(),
if (contains($book.title, "/")) then (
$book.author := substring-after($book.title, "/"),
$book.title := substring-before($book.title, "/")
) else ()
}
{book.id := string-join(./br/following-sibling::text(), ":")}
|
{book.status := deep-text(" "),
book.renewCount := extract($book.status, "([0-9]+) *Verlängerung", 1)
}
{book.statusId := "critical"}
{book.statusId := "ordered"}
{book.status := concat("vorgemerkt am ", $book.status), book.statusId := "ordered"}
|