{mode := if (matches(@class, "wo-com-(orders|reservations)")) then "orders" else "circulations"}
? ? ? ? ? ? ? ? ? * {$book := {}} +
{$book( if ($mode eq "orders") then "_cancelId" else "_renewId") := ./input/@value} {$book.id} {$book.author := join(br/preceding-sibling::text())}{$book.title} {$book.year} {$book.dueDate := parse-date(.)} {$book.status := switch (normalize-space()) case "0"return "" case "1" return "Eine Verlängerung" default return . || " Verlängerungen"} {$book.status := $book.status || " " || .} {$book.issueDate := parse-date(.), $book.statusId := "ordered"}