Skip to content

Commit

Permalink
Merge pull request #545 from TEIC/issue-541
Browse files Browse the repository at this point in the history
Issue 541: fix bug when processing <constraintSpec>
  • Loading branch information
martinascholger authored Jul 22, 2022
2 parents 4349ef4 + 632f274 commit 287079a
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 21 deletions.
26 changes: 13 additions & 13 deletions Test/expected-results/test.xml.odt.listing
Original file line number Diff line number Diff line change
@@ -1,31 +1,25 @@
Archive: actual-results/test.xml.odt
No errors detected in compressed data of actual-results/test.xml.odt.
testing: Configurations2/accelerator/current.xml OK
testing: Configurations2/ OK
testing: Configurations2/accelerator/ OK
testing: Configurations2/accelerator/current.xml OK
testing: Configurations2/floater/ OK
testing: Configurations2/images/Bitmaps/ OK
testing: Configurations2/images/ OK
testing: Configurations2/images/Bitmaps/ OK
testing: Configurations2/menubar/ OK
testing: Configurations2/ OK
testing: Configurations2/popupmenu/ OK
testing: Configurations2/progressbar/ OK
testing: Configurations2/statusbar/ OK
testing: Configurations2/toolbar/ OK
testing: Configurations2/toolpanel/ OK
testing: content.xml OK
testing: manifest.rdf OK
testing: META-INF/manifest.xml OK
testing: META-INF/ OK
testing: meta.xml OK
testing: mimetype OK
testing: META-INF/manifest.xml OK
testing: Pictures/ OK
testing: Pictures/pageimage1.jpg OK
testing: Pictures/resource1.jpg OK
testing: Pictures/resource10.jpg OK
testing: Pictures/resource11.jpg OK
testing: Pictures/resource12.jpg OK
testing: Pictures/resource13.jpg OK
testing: Pictures/resource14.jpg OK
testing: Pictures/resource1.jpg OK
testing: Pictures/resource2.jpg OK
testing: Pictures/resource3.jpg OK
testing: Pictures/resource4.jpg OK
Expand All @@ -34,7 +28,13 @@ No errors detected in compressed data of actual-results/test.xml.odt.
testing: Pictures/resource7.jpg OK
testing: Pictures/resource8.jpg OK
testing: Pictures/resource9.jpg OK
testing: settings.xml OK
testing: styles.xml OK
testing: Thumbnails/ OK
testing: Thumbnails/thumbnail.png OK
testing: content.xml OK
testing: manifest.rdf OK
testing: meta.xml OK
testing: mimetype OK
testing: settings.xml OK
testing: styles.xml OK
Archive: actual-results/test.xml.odt
No errors detected in compressed data of actual-results/test.xml.odt.
20 changes: 12 additions & 8 deletions odds/odd2odd.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,14 @@ of this software, even if advised of the possibility of such damage.
whereas <exemplum> elements in ODD customization file are
copied through. -->
<xsl:param name="suppressTEIexamples">false</xsl:param>
<!-- 2022-02-15: values of constraintSpec/@ident are unique (see TEI issue 2223) thus constraintSpec keys
can just contain the value of @ident-->
<xsl:key name="odd2odd-CHANGEATT" match="tei:attDef[@mode eq 'change']" use="concat(../../@ident,'_',@ident)"/>
<xsl:key name="odd2odd-CHANGECONSTRAINT" match="tei:constraintSpec[@mode eq 'change']" use="concat(../@ident,'_',@ident)"/>
<xsl:key name="odd2odd-CHANGECONSTRAINT" match="tei:constraintSpec[@mode eq 'change']" use="@ident"/>
<xsl:key name="odd2odd-CLASS_MEMBERED" use="tei:classes/tei:memberOf/@key" match="tei:classSpec"/>
<xsl:key name="odd2odd-DELETEATT" match="tei:attDef[@mode eq 'delete']" use="concat(ancestor::tei:classSpec/@ident,'_',@ident)"/>
<xsl:key name="odd2odd-DELETEATT" match="tei:attDef[@mode eq 'delete']" use="concat(ancestor::tei:elementSpec/@ident,'_',@ident)"/>
<xsl:key name="odd2odd-DELETECONSTRAINT" match="tei:constraintSpec[@mode eq 'delete']" use="concat(../@ident,'_',@ident)"/>
<xsl:key name="odd2odd-DELETECONSTRAINT" match="tei:constraintSpec[@mode eq 'delete']" use="@ident"/>
<xsl:key name="odd2odd-ELEMENT_MEMBERED" use="tei:classes/tei:memberOf/@key" match="tei:elementSpec"/>
<xsl:key name="odd2odd-IDENTS" match="tei:dataSpec" use="@ident"/>
<xsl:key name="odd2odd-IDENTS" match="tei:macroSpec" use="@ident"/>
Expand Down Expand Up @@ -104,7 +106,7 @@ of this software, even if advised of the possibility of such damage.
<xsl:key name="odd2odd-REFOBJECTS" use="@key" match="tei:schemaSpec/tei:macroRef[not(ancestor::tei:content)]"/>
<xsl:key name="odd2odd-REFOBJECTS" use="@key" match="tei:schemaSpec/tei:classRef[not(ancestor::tei:content)]"/>
<xsl:key name="odd2odd-REFOBJECTS" use="@key" match="tei:schemaSpec/tei:elementRef[not(ancestor::tei:content)]"/>
<xsl:key name="odd2odd-REPLACECONSTRAINT" match="tei:constraintSpec[@mode eq 'replace']" use="concat(../@ident,'_',@ident)"/>
<xsl:key name="odd2odd-REPLACECONSTRAINT" match="tei:constraintSpec[@mode eq 'replace']" use="@ident"/>
<xsl:key name="odd2odd-SCHEMASPECS" match="tei:schemaSpec" use="@ident"/>
<xsl:key match="tei:moduleSpec" name="odd2odd-MODULES" use="@ident"/>

Expand Down Expand Up @@ -2021,16 +2023,18 @@ of this software, even if advised of the possibility of such damage.
<xsl:apply-templates mode="justcopy" select="tei:constraintSpec[@mode eq 'change']"/>
<xsl:for-each select="$ORIGINAL">
<!-- original source context -->
<xsl:for-each select="tei:constraintSpec">
<xsl:for-each select="descendant::tei:constraintSpec">
<!-- 2022-01-28: added descendant axis to process all descendant <constraintSpec> elements
(e.g. elementSpec/attList/constraintSpec) -->
<xsl:variable name="CONSTRAINT" select="."/>
<xsl:variable name="lookingAt">
<xsl:value-of select="concat(../@ident,'_',@ident)"/>
<xsl:value-of select="@ident"/>
</xsl:variable>
<xsl:for-each select="$ODD">
<xsl:choose>
<xsl:when test="key('odd2odd-DELETECONSTRAINT',$lookingAt)"/>
<xsl:when test="key('odd2odd-REPLACECONSTRAINT',$lookingAt)"/>
<xsl:when test="key('odd2odd-CHANGECONSTRAINT',$lookingAt)"/>
<xsl:when test="key('odd2odd-DELETECONSTRAINT',$lookingAt)"/>
<xsl:when test="key('odd2odd-REPLACECONSTRAINT',$lookingAt)"/>
<xsl:when test="key('odd2odd-CHANGECONSTRAINT',$lookingAt)"/>
<xsl:otherwise>
<xsl:copy-of select="$CONSTRAINT"/>
</xsl:otherwise>
Expand Down

0 comments on commit 287079a

Please sign in to comment.