mets / METS-board

Documents and wiki pages relevant to the business of the METS Editorial Board
14 stars 6 forks source link

Add xlink:type to mets:div element #30

Open aelkiss opened 5 years ago

aelkiss commented 5 years ago

The METS div element allows xlink:label, but the XLink spec does require xlink:type in this case (https://www.w3.org/TR/xlink11/#xlinkattusagepat). It seems like the purpose of having the xlink:label on the div is to allow reference from smLink elements, so I think this is a "resource"-type element (https://www.w3.org/TR/xlink11/#local-resource) and we could include the "resourceLink" attribute group from the XLink schema.

This could cause problems if adding that attribute group causes validation to fail for existing documents, so we should verify behavior.

aelkiss commented 5 years ago

The following minimal example (example A) is valid with the schema version 1.12:

<?xml version="1.0"?>
<mets xmlns="http://www.loc.gov/METS/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/terms/"
  xsi:schemaLocation="http://www.loc.gov/METS/ http://www.loc.gov/standards/mets/mets.xsd
                      http://www.w3.org/1999/xlink http://www.loc.gov/standards/xlink/xlink.xsd">
  <metsHdr /> 
  <structMap>
    <div xlink:label="something"/>
  </structMap>
</mets>

Because the current schema does not permit xlink:type, the following is not:

<?xml version="1.0"?>
<mets xmlns="http://www.loc.gov/METS/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/terms/"
  xsi:schemaLocation="http://www.loc.gov/METS/ http://www.loc.gov/standards/mets/mets.xsd
                      http://www.w3.org/1999/xlink http://www.loc.gov/standards/xlink/xlink.xsd">
  <metsHdr /> 
  <structMap>
    <div xlink:label="something" xlink:type="resource"/>
  </structMap>
</mets>

If we make the following change to mets.xsd, both examples (with xlink:label only and with xlink:type) validate (at least for me with oXygen)

--- mets.xsd    2018-07-25 18:43:19.000000000 -0400
+++ mets-div-xlink-type.xsd 2018-11-29 10:31:46.862927254 -0500
@@ -776,11 +776,7 @@
                </xsd:documentation>
            </xsd:annotation>
        </xsd:attribute>
-       <xsd:attribute ref="xlink:label">
-           <xsd:annotation>
-               <xsd:documentation xml:lang="en">xlink:label - an xlink label to be referred to by an smLink element</xsd:documentation>
-           </xsd:annotation>
-       </xsd:attribute>
+       <xsd:attributeGroup ref="xlink:resourceLink"/>
    </xsd:complexType>
    <xsd:complexType name="parType">
        <xsd:annotation>
aelkiss commented 5 years ago

If we are unable to reproduce any validation problems with the issue reported in #19, I think this should be OK, but if we do get an example with an error there it might also be an issue with this proposed change.

aelkiss commented 5 years ago

Specific question we need to answer - would adding the resourceLink attribute group (from http://www.loc.gov/standards/xlink/xlink.xsd) to mets:div cause any backwards compatibility issues?