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

Makros and if-conditionals #371

Open
TobiasNx opened this issue Jun 22, 2021 · 0 comments
Open

Makros and if-conditionals #371

TobiasNx opened this issue Jun 22, 2021 · 0 comments

Comments

@TobiasNx
Copy link
Contributor

At the moment you cannot use makros in if-conditionals but also you also cannot create an makro that is only the if-conditional.

In context of lobid ressources - ALMA we needed to check for duplicates and wanted to reuse a small marko that we do not need to write the if-conditional again and again:

  <macro name="ignoreLocalExtensions">
      <if>
        <none flushWith="$[dsource][01] " sameEntity="true">
          <data name="" source="$[dsource][01] .M" />
        </none>
      </if>
  </macro>

That did not work with:

    <entity name="" flushWith="100[01] " sameEntity="true">
      <call-macro name="ignoreLocalExtensions" field="100" />
    ... 
    </entity> 

We received:

Caused by: org.xml.sax.SAXParseException; systemId: file:/home/tobias/git/lobid-resources/src/main/resources/alma/macros.xml; lineNumber: 159; columnNumber: 11; cvc-complex-type.2.4.a: Invalid content was found starting with element 'if'. One of '{"http://www.culturegraph.org/metamorph":group, "http://www.culturegraph.org/metamorph":data, "http://www.culturegraph.org/metamorph":all, "http://www.culturegraph.org/metamorph":any, "http://www.culturegraph.org/metamorph":choose, "http://www.culturegraph.org/metamorph":combine, "http://www.culturegraph.org/metamorph":concat, "http://www.culturegraph.org/metamorph":none, "http://www.culturegraph.org/metamorph":square, "http://www.culturegraph.org/metamorph":tuples, "http://www.culturegraph.org/metamorph":range, "http://www.culturegraph.org/metamorph":equalsFilter, "http://www.culturegraph.org/metamorph":containsFilter, "http://www.culturegraph.org/metamorph":entity}' is expected.

Then we tried to create a makro for the condition of the if-conditional:

  <macro name="ignoreLocalExtensions">
        <none flushWith="$[dsource][01] " sameEntity="true">
          <data name="" source="$[dsource][01] .M" />
        </none>
  </macro>

That did not work with:

    <entity name="" flushWith="100[01] " sameEntity="true">
        <if>
          <call-macro name="ignoreLocalExtensions" field="100" />
       </if>
    ... 
    </entity> 

We received:

Caused by: org.xml.sax.SAXParseException; systemId: file:/home/tobias/git/lobid-resources/src/main/resources/alma/common/contribution.xml; lineNumber: 12; columnNumber: 64; cvc-complex-type.2.4.a: Invalid content was found starting with element 'call-macro'. One of '{"http://www.culturegraph.org/metamorph":group, "http://www.culturegraph.org/metamorph":data, "http://www.culturegraph.org/metamorph":all, "http://www.culturegraph.org/metamorph":any, "http://www.culturegraph.org/metamorph":choose, "http://www.culturegraph.org/metamorph":combine, "http://www.culturegraph.org/metamorph":concat, "http://www.culturegraph.org/metamorph":none, "http://www.culturegraph.org/metamorph":square, "http://www.culturegraph.org/metamorph":tuples, "http://www.culturegraph.org/metamorph":range, "http://www.culturegraph.org/metamorph":equalsFilter, "http://www.culturegraph.org/metamorph":containsFilter}' is expected.

We discussed how easily implement at least one form of combining if-conditionals and makros.
At the moment it seems that the option to allow makros in an if-conditional as we tried in our second attempt seems to be the easiest.

@github-project-automation github-project-automation bot moved this to Backlog in Metafacture Mar 27, 2023
@katauber katauber removed this from Metafacture Apr 24, 2023
blackwinter pushed a commit that referenced this issue Dec 13, 2024
The generated start script for Windows consists of a huge classpath.
This classpath was too long, resulting in an error when executing the start
script. Using wildcard to include libraries shortens the classpath so that now
error occurs when executing the start script.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant