-
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
Duplicate elementSpecs with the same @ident
may trigger a build error when creating documentation
#645
Comments
I can confirm this error: it's very annoying since the error message gives no hint as to what has caused it. In my case, I had a very large ODD containing many classSpec elements, modifying various attributes, using mode=change. This used to be perfectly legal: reconciling multiple declarations is part of the job of odd2odd. I am pretty sure I am not the only person to find that old ODDs have suddenly broken mysteriously. Why is something like the following suddenly a problem?
I disagree that multiple specifications for the same @Ident are necessarily an error! If it is the whole ODD modification mechanism is broken! |
@lb42, tl;dr this is a bug and not intentional. This has to do with existing strict checks about multiple |
I think overall @raffazizzi is correct, this is a pretty specific bug. That said, IIRC there are several parts of the Stylesheets that have problems with multiple *Spec elements in the same file with the same Anyway, looking again at the problematic test (with whitespace adjusted somewhat): <xsl:sequence
select="tei:gloss[ @xml:lang eq 'en']/@versionDate gt tei:gloss[ @xml:lang eq $lang ]/@versionDate
or tei:desc [ @xml:lang='en' and not( @type eq 'deprecationInfo')]/@versionDate
gt
tei:desc[ @xml:lang eq $lang and not( @type eq 'deprecationInfo')]/@versionDate
"/> The sequence being created establishes the boolean to be returned by tei:descOrGlossOutOfDate(). It is handed a single context node, and returns a single boolean. It is only testing I have said elsewhere that maybe that P.S. Not relevant to this issue, but comes up because it effects the same code: @joeytakeda recommended <xsl:function name="tei:descOrGlossOutOfDate" as="xs:boolean">
<xsl:param name="context"/>
<xsl:variable name="lang" select="tei:generateDocumentationLang(.)[1]"/>
<xsl:variable name="test_results" as="xs:boolean+">
<!-- first test <gloss> children without @type -->
<xsl:sequence select="$context/tei:gloss[ not(@type) ][ @xml:lang eq 'en' ]/@versionDate
gt $context/tei:gloss[ not(@type) ][ @xml:lang eq $lang ]/@versionDate"/>
<!-- second test <desc> children wwithout @type -->
<xsl:sequence select="$context/tei:desc[ not(@type) ][ @xml:lang eq 'en' ]/@versionDate
gt $context/tei:desc[ not(@type) ][ @xml:lang eq $lang ]/@versionDate"/>
<!-- next test <gloss> children with @type -->
<xsl:for-each select="distinct-values( $context/tei:gloss/@type )">
<xsl:sequence select="$context/tei:gloss[ @type eq . ][ @xml:lang eq 'en' ]/@versionDate
gt $context/tei:gloss[ @type eq . ][ @xml:lang eq $lang ]/@versionDate"/>
</xsl:for-each>
<!-- last teset <desc> children with @type -->
<xsl:for-each select="distinct-values( $context/tei:desc/@type )">
<xsl:sequence select="$context/tei:desc[ @type eq . ][ @xml:lang eq 'en' ]/@versionDate
gt $context/tei:desc[ @type eq . ][ @xml:lang eq $lang ]/@versionDate"/>
</xsl:for-each>
</xsl:variable>
<!-- if any one of the above is true, then something is amiss, return true. -->
<xsl:sequence select="$test_results = true()"/>
</xsl:function> (Untested.) As a side effect, while that does make the function longer, each individual I am also really curious about whether the |
I don't know whether it should be an error to have multiple *Spec elements with the same I think it's important to clarify that there is a distinction between a *Spec element in a customization ODD which is being applied as a modification to a *Spec element in a source ODD upstream in the ODD chain, and an instance of a *Spec element with the same |
Interesting thought experiment: its not hard to imagine a use case for making an odd in which each element has multiple descs for the same lang. Suppose your downstream app will choose between them depending on whether you are generating the student intro doc or the professional technical manual. Does that mean these have to use different values for @xml:lang to avoid falling foul of this prohibition? Also when you say "same file" you mean (i hope) "same document" |
I agree, though it depends on Essentially we need to be able to support this (note the multiple <attDef ident="calendar" usage="opt" validUntil="2024-11-11">
<desc type="deprecationInfo" versionDate="2023-05-11" xml:lang="en">The <att>calendar</att> attribute will be removed from this element
as it will only be allowed on elements that represent dates with their content. This is because the <att>calendar</att> attribute
(unlike <att>datingMethod</att> defined in
<ident type="class">att.datable.custom</ident>) defines the calendar system of the date
in the original material defined by the parent element, <emph>not</emph> the calendar to
which the date is normalized.</desc>
<desc versionDate="2021-04-26" xml:lang="en">indicates one or more systems or calendars to which the
date represented by the content of this element belongs.</desc>
<!-- .... -->
</attDef> But either our test is imprecise, or there's something going on when compiling ODDs that's triggering the condition. |
Surely not -- there are three things you want to do:
In all of those cases, you only need to have a single element with that The only exception is the deprecationInfo desc, which is a special case (and perhaps we should have done that with a |
Seconded on using |
Well, we can change the expression of deprecation information from |
You could also use note which is globally available. And semantically more appropriate methinks. |
I've just been hit by this error again, this time in an ODD which doesn't have any duplicated elementSpecs. Can't figure out what's causing it this time. |
Care to post (or send to me separately) the ODD? |
That's the file. Transforming with ODD-to-rng in Oxygen (with the bleeding-edge plugin) gives me a duplicate
This was working fine until the last few weeks. I haven't had a chance to dig very deeply into it. |
I just tried the I will check this in as a branch. Do we want a PR already, or do we want to test it on known problematic cases, first? |
@sydb Presumably you mean |
Wow. Never occurred to me this (what LOI.odd does — 2
In all cases the invalidity is duplicate attributess of So it is quite clear to me that these are two entirely separate problems, and that #654 fixes the build failure due to multiple |
I didn't realize that ODD had duplicate elementSpecs. It's had a long history and lots of editors. My mistake there, although it's not invalid and there'll be lots more out there like it. |
I came across a build error when building documentation from an ODD file which happened to have two
<elementSpec>
s with the same@ident
-- I had done this by accident, but I have seen it done on purpose as a way of organizing an ODD. The error is:triggered by this:
Personally I think we should make it an error to have to
<*Spec>
elements with the same@ident
, but if not, this error will have to be worked around.The text was updated successfully, but these errors were encountered: