|
{book := {"title": ., "_detailId": extract(@href, "dnn.*btn.*Value"), "_page": $current-page}}
{book.title := x"{$book.title}: {.}"}?
for $span in .//span
let $idlbl := $span/extract(@id, "_Lbl(.*)$", 1)[.]
where exists($idlbl) and not(ends-with($idlbl, "Value"))
let $primary-key := exists($search-reverse-keys($idlbl))
let $key := if ($primary-key) then $search-reverse-keys($idlbl)
else $span || "!"
let $value := join($span!following-sibling::node()!(
if (self::a and not($primary-key)) then (. || (if (contains(@href, "http")) then x" ( {@href} )" else ""))
else .
))
where $value
return $book($key) := $value
|