-
Notifications
You must be signed in to change notification settings - Fork 126
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
Conversation
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.)
There was a problem hiding this 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> |
There was a problem hiding this comment.
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 ) ) )"/>
There was a problem hiding this comment.
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?)
…RELAX NG pattern reduction code (which I wrote > 2 weeks ago).
Despite the GitHub build error at |
OK, can we merge this puppy, then? |
In my local machine, I was getting the same ID-generated error, so I updated the expected results. |
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.