Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
bwbohl opened this issue Feb 8, 2017 · 6 comments
Open

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

bwbohl opened this issue Feb 8, 2017 · 6 comments

Comments

@bwbohl
Copy link
Member

bwbohl commented Feb 8, 2017

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 bwbohl self-assigned this Feb 8, 2021
@bwbohl bwbohl added this to the labels, titles, lang milestone Feb 9, 2022
@krHERO krHERO removed this from the labels, titles, lang milestone Jul 4, 2024
@bwbohl
Copy link
Member Author

bwbohl commented Sep 6, 2024

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

@bwbohl bwbohl added this to the 1.0.0 milestone Sep 6, 2024
@bwbohl
Copy link
Member Author

bwbohl commented Sep 11, 2024

cannot reproduce, closing
probably it got fixed on the way

@bwbohl bwbohl closed this as completed Sep 11, 2024
@bwbohl bwbohl reopened this Sep 11, 2024
@bwbohl
Copy link
Member Author

bwbohl commented Sep 11, 2024

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 #103 (comment) 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
Copy link
Member

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
Copy link
Member

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
Copy link
Contributor

riedde commented Sep 11, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: In Progress
Development

No branches or pull requests

4 participants