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

Separate pattern for every instance of <anyElement> — fixes #631 (I hope) #632

Merged
merged 7 commits into from
Nov 9, 2023

Conversation

sydb
Copy link
Member

@sydb sydb commented Oct 7, 2023

Generate a different RELAX NG pattern (and reference to it) for every occurence of an anyElement element, and update tests to match. (Previously we were trying to generate one for every content model in which an anyElement occurred, but were generation one for every content model in which an anyElement element occurred only once.)

This is high priority because it is making hard to work on #627.

Generate a different RELAX NG pattern (and reference to it) for every occurence of an anyElement element, and update tests to match. (Previously we were trying to generate one for every content model in which an anyElement occurred, but were generation one for every content model in which an anyElement element occurred only once.)
@sydb sydb added type: bug A bug report. priority: high Relatively urgent; Council should revisit routinely. labels Oct 7, 2023
@sydb sydb added this to the Release 7.56.0 milestone Oct 7, 2023
@sydb sydb marked this pull request as ready for review October 8, 2023 00:16
@sydb sydb requested review from joeytakeda and removed request for trishaoconnor October 8, 2023 00:16
@sydb sydb removed the priority: high Relatively urgent; Council should revisit routinely. label Oct 9, 2023
Copy link
Contributor

@joeytakeda joeytakeda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me — one small editorial suggestion for the disambiguator, but otherwise looks good to me (and passes both test1 and 2 on my machine)

<xsl:variable name="anyElement_disambiguator_format" as="xs:string">
<!-- A string used as the xsl:number/@format to append to pattern names for <anyElement>s (thus to disambiguate them) -->
<xsl:variable name="zeroes" as="xs:string+">
<xsl:for-each select="1 to ( count( //tei:anyElement ) => xs:string() => string-length() )">0</xsl:for-each>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you may be able to simplify this a bit and just use format-integer and set the count as the $picture to format 0:

<xsl:variable name="zeroes" as="xs:string"
 select="format-integer(0, xs:string( count( //tei:anyElement ) ) )"/>

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. But format-integer() is an XPath 3 function, and this is an XSLT 2 program. I will not be at all surprised if Saxon will process it correctly even in this XSLT 2 context. But I am not sure if we should rely in that.
On the other hand, why are we still using XSLT 2 programs? Any reason not to just change them to XSLT 3? (What, if anything, would break?)

odds/odd2relax.xsl Outdated Show resolved Hide resolved
…RELAX NG pattern reduction code (which I wrote > 2 weeks ago).
@raffazizzi
Copy link
Contributor

Despite the GitHub build error at Test / test2 (pull_request), it all builds correctly on my local machine.

@sydb
Copy link
Member Author

sydb commented Oct 27, 2023

OK, can we merge this puppy, then?

@HelenaSabel
Copy link
Member

In my local machine, I was getting the same ID-generated error, so I updated the expected results.
I think it’s ready to be merged!

@raffazizzi raffazizzi merged commit a495b3c into dev Nov 9, 2023
4 checks passed
@raffazizzi raffazizzi added this to the Release 7.56.0 milestone Nov 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug A bug report.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants