Closed peterstadler closed 1 year ago
For a) I found a good candidate in eutil:getDoc
?!
When fixing please also add a shareable documentation how to fix this in older ediroms
When fixing please also add a shareable documentation how to fix this in older ediroms
What do you mean with "older ediroms"? The proposed fix #310 should work for any Edirom that is running on xquery version 3.
There seems to be a changed behavior with eXist versions > 6.0.1 that now
()/string(@foo)
returns an empty-sequence, not a string. Saxon also processes it that way so I believe it to be in alignment with the specs ;)Various functions in edition.xqm rely on the old buggy behavior, e.g. https://github.com/Edirom/Edirom-Online/blob/ab873e092af1aea89c68d2b1135b856448476f5b/add/data/xqm/edition.xqm#L93-L96
That is, when
doc($uri)//edirom:preferences
evaluates to the empty sequence, the whole expression will return an empty sequence which is not what the function return type says, hence an error will be raised.This happens in the Edirom when no resolvable
$uri
(= $uri equals the empty string) is passed to the function – which is another issue because Edirom relies on some buggy eXist behavior, see https://github.com/eXist-db/exist/issues/3898Since this affects a lot of functions and I do not have the needed overview, I can only suggest to a) wrap the
fn:doc
function in a custom function that checksdoc-available
first (and/or wraps it in a try/catch) b) replace occurrences ofsome/xpath/string(@someAttribute)
withsome/xpath/@someAttribute => string()