fails to load Source with linebreak in <title>
e.g.
<titleStmt><?prüfen?>
<title type="abbreviated">
<identifier>P1-PA<rend rend="sup">1</rend>
</identifier> – Autographe Partitur</title>
<title type="main">Autographe Partitur</title>
<title type="sub">Manifestation</title>
</titleStmt>
As this issue is quite old, we should first try to reproduce it before we take further steps.
cannot reproduce, closing probably it got fixed on the way
As mentioned in #337 this had to do with the text not being normalised. Currently it works for source objects but fails for , e.g.text objects.
@riedde Just paste https://github.com/Edirom/Edirom-Online/issues/103#issue-206211166 as titleStmt in a TEI file and you get a HTTP 4000 Bad Request, the content window in the Edirom stays blank:
<?xml version="1.0" ?><exception><path>/db/apps/Edirom-Online/data/xql/getLinkTarget.xql</path><message>exerr:ERROR The actual return type does not match the sequence type declared in the function's signature: eutil:getLocalizedTitle(node(), xs:string?) xs:string. Expected cardinality: exactly one, got 2. [at line 105, column 41, source: /db/apps/Edirom-Online/data/xql/getLinkTarget.xql]
In function:
eutil:getLocalizedTitle(node(), xs:string?) [181:10:/db/apps/Edirom-Online/data/xqm/util.xqm]
local:getWindowTitle(node()+, xs:string) [311:18:/db/apps/Edirom-Online/data/xql/getLinkTarget.xql]</message></exception>
Yes, there's a lot of problematic text() in eutil:getLocalizedTitle#2.
text() will return text nodes, i.e. for an element like
$foo := <foo>text1<!-- comment --> text2 </foo>
$foo/text() will return two nodes.
So, $foo => normalize-space() is always a good option or at least $foo => string.
That said, eutil:getLocalizedTitle#2 could definitely be refactored.
E.g., ($node/mei:title[@xml:lang = $lang]//text() => string-join() => normalize-space()) could be simplified to ($node/mei:title[@xml:lang = $lang] => normalize-space())
That said,
eutil:getLocalizedTitle#2could definitely be refactored.E.g.,
($node/mei:title[@xml:lang = $lang]//text() => string-join() => normalize-space())could be simplified to($node/mei:title[@xml:lang = $lang] => normalize-space())
I'm not sure if this works, because mei:title can contain multiple nodes. I introduced a function doing this job in #426