Edirom / Edirom-Online

Edirom Online is a tool for presenting historical-critical music editions in digital form.
GNU General Public License v3.0
20 stars 24 forks source link

fails to load Source with linebreak in <title> #103

Open bwbohl opened 7 years ago

bwbohl commented 7 years ago

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 commented 4 weeks ago

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

bwbohl commented 3 weeks ago

cannot reproduce, closing probably it got fixed on the way

bwbohl commented 3 weeks ago

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>
peterstadler commented 3 weeks ago

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 commented 3 weeks ago

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

riedde commented 3 weeks ago

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