From d4bb2b656cdea3f31361df29f1e38aef5d9facad Mon Sep 17 00:00:00 2001 From: Peter Stadler <stadlerpeter@yahoo.fr> Date: Fri, 10 Jan 2025 09:31:28 +0100 Subject: [PATCH] make function more robust 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. --- add/data/xqm/source.xqm | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/add/data/xqm/source.xqm b/add/data/xqm/source.xqm index 00715f530..58744f45e 100644 --- a/add/data/xqm/source.xqm +++ b/add/data/xqm/source.xqm @@ -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 () }; -- GitLab