Edirom-Online icon indicating copy to clipboard operation
Edirom-Online copied to clipboard

fails to load Source with linebreak in <title>

Open bwbohl opened this issue 8 years ago • 6 comments

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>

bwbohl avatar Feb 08 '17 14:02 bwbohl

As this issue is quite old, we should first try to reproduce it before we take further steps.

bwbohl avatar Sep 06 '24 10:09 bwbohl

cannot reproduce, closing probably it got fixed on the way

bwbohl avatar Sep 11 '24 07:09 bwbohl

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:

Image

<?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>

bwbohl avatar Sep 11 '24 08:09 bwbohl

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.

peterstadler avatar Sep 11 '24 08:09 peterstadler

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())

peterstadler avatar Sep 11 '24 08:09 peterstadler

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())

I'm not sure if this works, because mei:title can contain multiple nodes. I introduced a function doing this job in #426

riedde avatar Sep 11 '24 09:09 riedde