{let $form := form(., {"": {"kind": "submit"}}) let $inputs := .//input let $backButton := ($inputs[@title = "Zurück zur vorherigen Seite" or @value = "Zur Übersicht"])[1] let $backButton := if ($backButton) then $backButton else ($inputs[contains(@title, 'zur vorherigen Seite')])[1] (:is this line needed? düsseldorf has the wrong umlaut on search:) return ( if ($mode = 'lend') then ( $extendFormPost := request-combine($form, (($inputs[@type = "submit" and contains(@value, "arkierte") and contains(@value, "ngern")])[1])), $extendFormPost.post := replace($extendFormPost.post, "[a-zA-Z0-9]+=on&", "") ) else ( $cancelFormPost := request-combine($form, ($inputs[@type = "submit" and contains(@value, "arkierte") and contains(@value, "schen")])[1]), $cancelFormPost.post := replace($cancelFormPost.post, "[a-zA-Z0-9]+=on&", "") ), if ($backButton/@name) then $goBackPage := request-combine($form, $backButton) else let $href := (//a[matches(., "(^Benutzerkonto$)|(Konto$)|(^Anmeldung$)")])[1]/@href return if ($href) then $goBackPage := ( if (starts-with($href, "javascript:")) then let $code := extract($href, "javascript:top\.htmlOnLink\(['""](.*)['""]\)", 1) return if ($code) then form($href/ancestor::form[1], "selected=ZTEXT "||$code) else vl:raise-internal("Der Link zum Ausleihkonto konnte nicht geöffnet werden: """ || . || """: " || $href ) else resolve-html($href) ) else vl:raise-internal("Kein Link von der Ausleihentabelle zurück zur vorherigen Seite gefunden" ) ), $default-book := map:merge(({"_mode": $mode}, switch ($mode) case "lend" return {"_splitIndex": $splitIndex} case 'ordered' case 'orderedMagazine' return {"statusId": "ordered"} case "provided" return {"statusId": "provided"} default return () )) }
? ? ? {book := $default-book}
Bibliothek|Ausgabeort|ZweigstelleTitel Hinweis|Bemerkungvorgemerkt am*
{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 () ) }
{form := .} {let $sublinks := //a[contains(., 'zeigen oder verlängern in:')] return ( nextSplitTable := ($sublinks/@href)[$splitIndex], splitCount := count($sublinks) ) }