Menu

#181 XSLT2 error in squarebrackets regex

9.2
done
xslt (28)
9(high)
2021-05-18
2021-03-21
No

The stylesheet htm-tpl-sqbrackets.xsl is causing stacktrace errors in Saxon, and therefore not running. This line of code:

<xsl:variable name="regex" select="concat('([^\]])[',string-join($closingadjacentbrackettypes//text()),']([',string-join($ignorableThingsBetweenAdjacentBrackets//text()),']*)[',string-join($openingadjacentbrackettypes//text()),']([^\[])')"/>

is what causes the problem. The error in the stacktrace was that string-join() expects two arguments, and in the code above it is only getting one argument. Apparently string-join() can only take less than two arguments in XSLT 3.0. Unless someone is willing to try to fix this line ASAP, I suggest we revert this change (from Aug 2020) until we have time to diagnose the problem properly.

Discussion

  • Hugh A. Cayless

    Hugh A. Cayless - 2021-03-21

    If I remember correctly, https://github.com/EpiDoc/Stylesheets/pull/10 contains a fix for this.

     

    Last edit: BODARD Gabriel 2021-03-21
  • BODARD Gabriel

    BODARD Gabriel - 2021-03-21

    Excellent! Should we arrange a small group to look over this some time, devise some tests (including on the IOSPE process, which this broke, and perhaps EFES?) so that we can accept the PR as soon as possible?

     
    • Hugh A. Cayless

      Hugh A. Cayless - 2021-03-21

      If you’re saying we should have tests, then I 100% agree. Even something as minimal as running a transform using the stylesheets without checking the results would have caught this. If you’re saying we need tests as a prerequisite for accepting the PR, then I think that will merely ensure it takes months to fix. I think we should treat the two concerns separately.

       

      Last edit: BODARD Gabriel 2021-03-22
      • BODARD Gabriel

        BODARD Gabriel - 2021-03-22

        I think I'm just saying let's run the stylesheets in a couple of different environments (IOSPE, USEP, EFES) and check there are no fatal exceptions, then consider it good. Any smaller bugs ("unintended consequences") we can fix later as they're noticed. I agree that we shouldn't wait months to accept this PR.

         
  • Elli Mylonas

    Elli Mylonas - 2021-03-21

    Yes, this is an issue because most of us aren't using XSLT 3.0. We ran into it when we upgraded USEP recently and solved the problem by kludging string-join() to add a null second argument. It's a stopgap, but formats just fine.

     
  • Hugh A. Cayless

    Hugh A. Cayless - 2021-05-18
    • assigned_to: Hugh A. Cayless
     
  • Hugh A. Cayless

    Hugh A. Cayless - 2021-05-18

    This should be fixed. I have cherry-picked the commits from the DCLP pull request.

     
  • Hugh A. Cayless

    Hugh A. Cayless - 2021-05-18
    • status: unread --> done
     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.