Skip to content

Commit af111a4

Browse files
Gracefully handle empty ROR response in extract-ror-matches (#38)
Fixes xslt failure in elifesciences/publish-reviewed-preprints-issues#5183
1 parent 25cc386 commit af111a4

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/webapp/api-clients.xqm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -266,8 +266,8 @@ declare function api:introduce-rors($xml as item()) {
266266
return $new-xml
267267
};
268268

269-
declare function api:extract-ror-matches($response as item()) as element()* {
270-
if (number($response//*:number__of__results) = 0) then ()
269+
declare function api:extract-ror-matches($response as item()?) as element()* {
270+
if (empty($response) or number($response//*:number__of__results) = 0) then ()
271271
else if ($response//*:items/_[*:chosen='true']) then $response//*:items/_[*:chosen='true']
272272
(: Assumes the ROR 'query' param is used :)
273273
else if (number($response//*:number__of__results) = 1 and $response//*:items/_[not(*:score)])

0 commit comments

Comments
 (0)