Skip to content

Commit

Permalink
make function more robust
Browse files Browse the repository at this point in the history
in the Pintos there's a siglum encoded like
```xml
<add xml:id="x38284ce9-f2be-4ca6-a8cb-227d85357ae1" place="rightmar" type="siglum">
    <rend xml:id="x9bbd3666-54ac-4287-b7f7-1d19347c7e14" color="red">Classe III.
        <lb xml:id="x7e7c09da-9ed9-4ed4-9339-75a18868a860"/>Band
        <lb xml:id="xd18991b0-bc11-447b-881a-b732d8f3b3c4"/>V. No. <rend xml:id="x4904459c-a4c4-40a9-beb5-d9f3c21ddeca" rend="underline">80</rend>.</rend>
</add>
```
which features multiple text nodes causing the original function `source:getSiglum#1` to fail.
  • Loading branch information
peterstadler committed Jan 10, 2025
1 parent 6ce8986 commit 7d53c3c
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions add/data/xqm/source.xqm
Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,8 @@ declare function source:getSiglum($source as xs:string) as xs:string? {

let $doc := doc($source)
let $elems := $doc//mei:*[@type eq 'siglum']
let $siglum :=
if(exists($elems)) then
($elems[1]//text())
else
()

return $siglum
return
if(exists($elems))
then $elems[1] => normalize-space()
else ()
};

0 comments on commit 7d53c3c

Please sign in to comment.