-
Notifications
You must be signed in to change notification settings - Fork 123
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
during ODD compilation, in attribute classes with mode="change", following siblings of attList are not copied #254
Comments
Oh, it's more general: everything apart from that |
If it's only the attlist you want to change, what happens when you put the @mode="change" on attList instead of on the spec? |
attList doesn't accept a |
Here you can see a somewhat analogous example: http://www.tei-c.org/release/doc/tei-p5-doc/en/html/USE.html#MDMDAL |
As far as I can see, att.global doesn't have a 'global' exemplum or remarks. Would you please try with att.internetMedia, att.typed, or anything analogous? I can't strip down a test case at this moment. It's the siblings of |
Ah, now I see it. OK, I confirm that this is a bug. Modifying the attribute list of an attribute class has the side effect of suppressing any following-sibling elements of the attList in that specification, notably any <remarkss> or a <listRef> . |
Simple test ODD for this bug:
The problem occurs in odd2odd processing (expanding the ODD). |
This is our first pass at a solution: a change to a template in odd2odd.xsl, at line 1145: <xsl:template match="tei:classSpec" mode="odd2odd-change">
<xsl:variable name="className" select="tei:uniqueName(.)"/>
<xsl:variable name="ORIGINAL" select="."/>
<xsl:copy>
<xsl:attribute name="rend">change</xsl:attribute>
<xsl:apply-templates mode="odd2odd-change" select="@*"/>
<!-- for each section of the class spec,
go through the sections one by one
and see if they are present in the change mode version -->
<xsl:for-each select="$ODD">
<xsl:for-each select="key('odd2odd-CHANGE',$className)">
<!-- context is now a classSpec in change mode in the ODD spec -->
<!-- description -->
<xsl:choose>
<xsl:when test="$stripped='true'"/>
<xsl:when test="tei:gloss">
<xsl:apply-templates mode="justcopy" select="tei:gloss"/>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates mode="justcopy" select="$ORIGINAL/tei:gloss"/>
</xsl:otherwise>
</xsl:choose>
<xsl:choose>
<xsl:when test="tei:altIdent">
<xsl:apply-templates mode="justcopy" select="tei:altIdent"/>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates mode="justcopy" select="$ORIGINAL/tei:altIdent"/>
</xsl:otherwise>
</xsl:choose>
<xsl:choose>
<xsl:when test="tei:equiv">
<xsl:apply-templates mode="justcopy" select="tei:equiv"/>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates mode="justcopy" select="$ORIGINAL/tei:equiv"/>
</xsl:otherwise>
</xsl:choose>
<xsl:choose>
<xsl:when test="$stripped='true'"/>
<xsl:when test="tei:desc">
<xsl:apply-templates mode="justcopy" select="tei:desc"/>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates mode="justcopy" select="$ORIGINAL/tei:desc"/>
</xsl:otherwise>
</xsl:choose>
<!-- classes -->
<classes xmlns="http://www.tei-c.org/ns/1.0">
<xsl:choose>
<xsl:when test="tei:classes[@mode eq 'change']">
<xsl:for-each select="tei:classes/tei:memberOf">
<xsl:choose>
<xsl:when test="@mode eq 'delete'"/>
<xsl:when test="@mode eq 'add' or not (@mode)">
<memberOf key="{@key}">
<xsl:copy-of select="@min|@max"/>
</memberOf>
</xsl:when>
</xsl:choose>
</xsl:for-each>
<xsl:for-each select="$ORIGINAL">
<xsl:for-each select="tei:classes/tei:memberOf">
<xsl:variable name="me">
<xsl:value-of select="@key"/>
</xsl:variable>
<xsl:variable name="metoo">
<xsl:value-of select="concat(../../@ident,@key)"/>
</xsl:variable>
<xsl:choose>
<xsl:when test="$ODD/key('odd2odd-DELETE',$me)"> </xsl:when>
<xsl:when test="$ODD/key('odd2odd-MEMBEROFDELETE',$metoo)"> </xsl:when>
<xsl:when test="$ODD/key('odd2odd-MEMBEROFADD',$metoo)"> </xsl:when>
<xsl:otherwise>
<memberOf key="{$me}"/>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</xsl:for-each>
</xsl:when>
<xsl:when test="tei:classes">
<xsl:for-each select="tei:classes/tei:memberOf">
<xsl:copy-of select="."/>
</xsl:for-each>
</xsl:when>
<xsl:otherwise>
<xsl:for-each select="$ORIGINAL">
<xsl:for-each select="tei:classes/tei:memberOf">
<xsl:variable name="me">
<xsl:value-of select="@key"/>
</xsl:variable>
<xsl:for-each select="$ODD">
<xsl:if test="not(key('odd2odd-DELETE',$me))">
<memberOf key="{$me}"/>
</xsl:if>
</xsl:for-each>
</xsl:for-each>
</xsl:for-each>
</xsl:otherwise>
</xsl:choose>
</classes>
<!-- constraints -->
<xsl:call-template name="odd2odd-processConstraints">
<xsl:with-param name="ORIGINAL" select="$ORIGINAL"/>
<xsl:with-param name="elementName" select="$className"/>
</xsl:call-template>
<!-- attList -->
<attList xmlns="http://www.tei-c.org/ns/1.0">
<xsl:call-template name="odd2odd-processAttributes">
<xsl:with-param name="ORIGINAL" select="$ORIGINAL"/>
<xsl:with-param name="objectName" select="$className"/>
</xsl:call-template>
</attList>
<xsl:choose>
<xsl:when test="$stripped='true'"/>
<xsl:when test="tei:exemplum">
<xsl:apply-templates mode="justcopy" select="tei:exemplum"/>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates mode="justcopy" select="$ORIGINAL/tei:exemplum"/>
</xsl:otherwise>
</xsl:choose>
<xsl:choose>
<xsl:when test="$stripped='true'"/>
<xsl:when test="tei:remarks">
<xsl:apply-templates mode="justcopy" select="tei:remarks"/>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates mode="justcopy" select="$ORIGINAL/tei:remarks"/>
</xsl:otherwise>
</xsl:choose>
<xsl:choose>
<xsl:when test="$stripped='true'"/>
<xsl:when test="tei:listRef">
<xsl:apply-templates mode="justcopy" select="tei:listRef"/>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates mode="justcopy" select="$ORIGINAL/tei:listRef"/>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</xsl:for-each>
</xsl:copy>
</xsl:template> This needs:
|
Implement change worked out on this morning on conference call to addrss #254
Assume an attribute class of the following skeletal form:
In your ODD, do:
I assume that this sentence from ch. 23 (paraphrased for classSpec) holds: "Note that the 'mode' attribute on the elementSpec now takes the value 'change' to indicate that those parts of the element specification not supplied are to be inherited from the standard definition." However, in the above case, the default value is changed as intended, but
<remarks>
are not inherited.The vanishing takes place at the stage of ODD compilation (I compared a compiled ODD without the
classSpec[@mode="change"]
with one containing that instruction).The text was updated successfully, but these errors were encountered: