Commit fef93f52 authored by sendler's avatar sendler 🐢
Browse files

move transformation of table into dedicated function

parent a03c2ccf
......@@ -379,10 +379,10 @@ return
<span id="page{string($node/@n)}" class="pb" facs="{ string($node/@facs) }">{ string($node/@n) }</span>
case element ( tei:fw ) return
if (string($node/@place) = 'top-right') then (
<div class="tei-fw" style="text-align:left"><span class="fw {string($node/@place)}">{ string($node) }</span></div>
<div class="tei-fw" style="text-align:left"><span class="fw {string($node/@place)}">{ local:magic($node/node()) }</span></div>
)
else (
<div class="tei-fw" style="text-align:left"><span class="fw {string($node/@place)}">{ string($node) }</span></div>
<div class="tei-fw" style="text-align:left"><span class="fw {string($node/@place)}">{ local:magic($node/node()) }</span></div>
)
case element ( tei:choice ) return
if (string('') = string('')) then (
......@@ -558,6 +558,9 @@ return
)
else (local:magic($node/node()))
case element ( tei:table ) return
local:parse-table($node)
default return
local:magic($node/node())}
......@@ -568,3 +571,25 @@ return
}
}
};
declare function local:parse-table($table as element(tei:table)) as element(xhtml:table) {
let $head := $table/tei:head
let $rows := $table/tei:row
let $content := for $row in $rows
let $cells := $row/tei:cell
return
element tr {
for $cell in $cells return
element td {local:magic($cell/node())}
}
let $foot := $table/tei:trailer
return
element table {
if ($head != "") then element thead {$head} else (),
element tbody {
$content
},
if ($foot != "") then element tfoot {$foot} else ()
}
};
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment