eeditiones / tei-publisher-app

The main TEI Publisher app
https://teipublisher.com
GNU General Public License v3.0
68 stars 33 forks source link

ODD compilation error #55

Open StephanMa opened 3 years ago

StephanMa commented 3 years ago

To be able to better understand you problem, please add as much information as possible to this ticket. Always test your bugs against the latest stable release of exist. We cannot provide support for older versions here on GitHub. If the version of eXist that is experiencing the issue is more than 1 major version behind the most recent release, please consider posting a question on our mailing list.

Describe the bug I tried to migrate a TEI Publisher-App to eXist 5.3.0. This App does a certain amount of styling via ODD. When I try to recompile the ODD, I get an error that all files (print, epub, latex, web) couldn't be saved. When opening e.g. *-web.invalid.xql, I see that one function was added twice. Since eXist 5.3.0, duplication of functions raises an error.


(: generated template function for element spec: item :)
declare %private function model:template-item($config as map(*), $node as node()*, $params as map(*)) {
    <t xmlns=""><li onclick="goTo('{$config?apply-children($config, $node, $params?uri)}')">{$config?apply-children($config, $node, $params?content)}

                                    </li></t>/*
};

(: generated template function for element spec: item :)
declare %private function model:template-item($config as map(*), $node as node()*, $params as map(*)) {
    <t xmlns=""><li onclick="goTo('{$config?apply-children($config, $node, $params?uri)}')">{$config?apply-children($config, $node, $params?content)}

                                    </li></t>/*
};

Expected behavior I expect that recreating the functions from ODD Files works as it did on eXist 5.2.0.

To Reproduce

The best way is to provide an SSCCE (Short, Self Contained, Correct (Compilable), Example). One type of SSCCE could be a small test which reproduces the issue and can be run without dependencies. The XQSuite - Annotation-based Test Framework for XQuery makes it very easy for you to create tests. These tests can be executed from the eXide editor (XQuery - Run as Test)

<elementSpec ident="item" mode="change">
                            <model predicate="ancestor::div[@type='SVPListe']" behaviour="inline">
                                <param name="uri" value="substring(@corresp,2)"/>
                                <param name="name" value="concat('id_', @xml:id)"/>
                                <param name="content" value="."/>
                                <pb:template xmlns="" xml:space="preserve">
                                    <li onclick="goTo('[[uri]]')">[[content]]

                                    </li>
                                </pb:template>
                            </model>
                        </elementSpec>

If the above isn't working, please tell us the exact steps you took when you encountered the problem:

  1. using attached ODD
  2. regenerate files from ODD example.txt

Screenshots If applicable, add screenshots to help explain your problem. Bildschirmfoto 2021-06-28 um 13 52 23

Context (please always complete the following information): Mac M1 macOS Big Sur 11.4 JDK 15.0.2 eXist 5.3.0 TEI Publisher Lib 2.8.8 Open API Router 0.2.0

Additional context

tuurma commented 1 year ago

This is weird, because uploading the ODD and regenerating the transforms via the API or the button in TP ODD list fails, but opening the file with the ODD editor and saving from there works correctly.

nquenouille commented 1 year ago

Same here. When klicking on "Regenerate" for an ODD I have the same error message (on every ODD). And I cannot save it from the editor either.

OS: Windows 11 eXistDB: 6.2 JDK: TEI Publisher: 8.0 TEI Publisher Lib: 4.0

eXist was installed via .xar file, no custom changes in conf.xml or similar. Many thanks!

gillesbuelow commented 10 months ago

I have the same issue. Cannot generate the .xqls for any ODD.

eXistDB: 6.2.0 TEI Publisher: 8.1.0 TEI Publisher Lib: 4.0.0

Is there any solution known?

vpaillusson commented 9 months ago

I have the same issue here when training to learn how to use TEIPublisher. that's a shame.

When I create a new odd through web interface (here I called my new odd file "training") and when I apply it to a sample TEIPublisher project I get the error: exerr:ERROR source for module /db/apps/tei-publisher/transform/training-web-main.xql not found in database

In fact, when I check in eXide, I only have training-[web|latex|print|epub|fo].invalid.xql files I tried renaming them but didn't help. It only triggered different errors.

System and software versions : OS: Windows 10 eXist DB version: 6.2 TEI Publisher version: 9.0.0 installation of exist-db through .jar file and TEIPublisher with exist-db package manager. eXist-db by itself works fine with several other eXist-db projects. the sample data of TEIPublisher works pretty smoothly as well but TEIPublisher encounters errors when creating new odd.

Any help will be greatly appreciated.

thanks a lot

Borbico commented 6 months ago

Hello everyone, did anyone manage to solve this problem?

I'm having your same issues.

OS: Windows 10 eXist DB version: 6.2 TEI Publisher version: 9.0.0 Installed eXist-db through .jar file and then TEI Publisher from the package manager.

wolfgangmm commented 6 months ago

The workaround is to edit odd/configuration.xml (or resources/odd/configuration.xml in a generated app) and add the attribute skip-global="true" to the modules element: <modules skip-global="true">.

Borbico commented 6 months ago

Thank you so much for your answer! Unfortunately, the recompilation still doesn't work after setting the attribute in the modules element the way you suggest. I'm guessing there are some troubles with the authentication, because I have troubles saving the changes on the files from eXide, too.

feophan commented 4 months ago

I'm having the same issue on both of my machines. Adding skip-global="true" did not fix it. Did anyone find a solution?

OS: Windows 10 (desktop), Windows 11 (laptop) JDK: 21.0.3 (desktop), 21.0.4 (laptop) eXist DB: 6.2 TEI Publisher: 9.0.0 Similarly as above, installed eXist-db with .jar file and then TEI Publisher from the package manager.

The error just says "Compilation error on line :" without an indication which line.

feophan commented 4 months ago

If the desired effect of ODD is only a matter of adding some css to elements, the following cumbersome work-around did the trick:

  1. create X-web.xql, X-web-main.xql, X-web-module.xql
  2. paste content from the baseline files, change the naming of ODD to yours
  3. from this point applying your ODD should not throw an error anymore; but it also won't do anything
  4. create X.css, add the desired styling.

Let's say I had elements <add rend="red-ink"></add> that I want to render red as opposed to other additions in green. The app will convert it into <span class="tei-add red-ink"></span>. Then adding .red-ink { color: red; } into css did what I needed.

If automatic class is not present, or not enough, one can copy from X-web.invalid.xql into X-web.xql the ODD transformation:

case element(add) return
     if (@rend='red-ink') then
          html:inline($config, ., ("tei-add-red", css:map-rend-to-class(.)), .) => model:map($node, $trackIds)
     else
          html:inline($config, ., ("tei-add", css:map-rend-to-class(.)), .) => model:map($node, $trackIds)

and then add css for the new class as above.