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

Invalid xslt generated in rare circumstances #499

Open
KCMertens opened this issue Mar 6, 2024 · 0 comments
Open

Invalid xslt generated in rare circumstances #499

KCMertens opened this issue Mar 6, 2024 · 0 comments
Assignees
Labels

Comments

@KCMertens
Copy link
Member

KCMertens commented Mar 6, 2024

As reported by @PrinsINT
Attached input format and resulting xslt attached.
The offending config is:

- name: word
  displayName: Word
  valuePath: if (./seg) then ./seg else .

Resulting in:

<xsl:template match="//TEI//text//w[not (ancestor::note)]">
    <span class="word">
        <xsl:attribute name="data-toggle" select="'tooltip'"/>
        <xsl:attribute name="data-lemma">
        <xsl:value-of select="@lemma"/>
        </xsl:attribute>
        <xsl:value-of select="if (./seg) then ./seg else "/>
    </span>
    <xsl:text> </xsl:text>
</xsl:template>

Caused by https://github.com/INL/BlackLab/blob/dev/wslib/src/main/java/nl/inl/blacklab/server/lib/results/XslGenerator.java#L53

Probably an easy fix to just simplify the joining of the xpaths, there's a comment

// split and explode into cartesian product...
// a|b c -> a/c | b/c
// because a/(b|c) is not valid xpath

But in a quick test, that no longer seems true with xslt and 2/3 and a/(b|c) is now perfectly valid.
xslt.txt
GalahadCobaltTEI.blf.yaml.txt

@KCMertens KCMertens added the bug label Mar 6, 2024
@KCMertens KCMertens self-assigned this Mar 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant