kitodo / kitodo-production

Kitodo.Production is a workflow management tool for mass digitization and is part of the Kitodo Digital Library Suite.
http://www.kitodo.org/software/kitodoproduction/
GNU General Public License v3.0
62 stars 62 forks source link

Missing attributes in the <mdWrap>-elements #3544

Closed andre-hohmann closed 4 years ago

andre-hohmann commented 4 years ago

Problem

in the <mdWrap>-elements, the METS-attributes are missing.

Solution

The following attributes must be applied to the <mdWrap>-elements:

<dmdSec">: <mdWrap> -> <mdWrap MDTYPE="MODS">

<amdSec">/<rightsMD>: <mdWrap> -> <mdWrap MDTYPE="OTHER" MIMETYPE="text/xml" OTHERMDTYPE="DVRIGHTS" >

<amdSec">/<digiprovMD>: <mdWrap> -> <mdWrap MDTYPE="OTHER" MIMETYPE="text/xml" OTHERMDTYPE="DVLINKS" >

Examples

Examples of the current state:

matthias-ronge commented 4 years ago

You would have to set these attributes with the XSLT. Just like the conversion from <kitodo:metadata> to <mods:*> also the announcement that it is MDTYPE="MODS" (or something else).

andre-hohmann commented 4 years ago

It seems possible with the following transformations. I will remove the label "blocking" from this issue.

However, it must be determined and communicated, which elements are created by Kitodo.Production and which elements have to be transformed by XSLT. Now it is not consistent and could lead to irritations by the users, when they expect completely correct METS-files without XSLT adjustments. Therefore, i will add the label "question" and "documentation". @Kathrin-Huber

See comment https://github.com/kitodo/kitodo-production/issues/3544#issuecomment-655691672 for a probably better solution

Click to show the original suggestion. ```xml ``` ```xml ``` ```xml ```
andre-hohmann commented 4 years ago

See comment https://github.com/kitodo/kitodo-production/issues/3544#issuecomment-655691672 for a probably better solution.

It seems that the following configuration works better:

Click to show the original suggestion. ```xml ```
stefanCCS commented 4 years ago

I have checked it out with the files attached, and with a software version 3.2-build 19.06.2020. Unfortunately, it has not worked. My impression is, that the kitodo software only processes the part which is only (but of course, I may be wrong). Maybe you can find the error in the xsl-file attached (which is just a copy of the ruleset_default plus the mdwrap part for "MDTYPE=MODS" mentioned here above). (I have renamed the files from .xml to .txt to put it hier) meta.txt

ruleset_CCS_min.txt

andre-hohmann commented 4 years ago

If you add xmlns:mets="http://www.loc.gov/METS/" in the stylesheet version, it should work:

<xsl:stylesheet version="2.0"
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                xmlns:kitodo="http://meta.kitodo.org/v1/"
                xmlns:mets="http://www.loc.gov/METS/" 
                >
stefanCCS commented 4 years ago

Many thanks, work fine! (for all 3 mentioned data in 'dmdsec, 2xamdsec)

Addtionally, similar issue needs to be solved for the entry

<mets:structMap TYPE="PHYSICAL">
<mets:div ID="uuid-57fedc25-61bc-479a-8ea3-18445cc2e767" TYPE="physSequence">

The TYPE="physSequence" also is not written automatically. I have created another template in the xslt with the same logic:

    <xsl:template match="mets:structMap/mets:div/mets:div">
       <xsl:attribute name="TYPE">
            <xsl:value-of select="'physSequence'"/>
        </xsl:attribute>
       <xsl:copy>
            <xsl:apply-templates select="@* | node()"/>
        </xsl:copy>
    </xsl:template>

Problem is, that this 'match' matches to both

--> this means, I need to set in xsl the 'match' to match also for the attribute TYPE of 'structMap' to be "PHYSICAL" --> can you help me please to create this search-string?
stefanCCS commented 4 years ago

With the help of Google and a bit of playing around, it looks like, I have found a solution:

    <xsl:template match="mets:structMap[@TYPE='PHYSICAL']/mets:div/mets:div">
       <xsl:attribute name="TYPE">
            <xsl:value-of select="'physSequence'"/>
        </xsl:attribute>
       <xsl:copy>
            <xsl:apply-templates select="@* | node()"/>
        </xsl:copy>
    </xsl:template>

Anyway, I would be glad if you check this, please.

andre-hohmann commented 4 years ago

Thanks for hint regarding mets:structMap[@TYPE='PHYSICAL']. This is really important. Your suggestion did not work for me, but it let me think about it again and i might have found another way. Thus, probably this is a better solution for all METS-sections:

<xsl:template match="mets:dmdSec/mets:mdWrap">
    <xsl:copy>
        <xsl:attribute name="MDTYPE">MODS</xsl:attribute>
        <xsl:apply-templates select="@* | node()"/>
    </xsl:copy>
</xsl:template>

<xsl:template match="mets:amdSec/mets:rightsMD/mets:mdWrap">
    <xsl:copy>
        <xsl:attribute name="MDTYPE">OTHER</xsl:attribute>
        <xsl:attribute name="MIMETYPE">text/xml</xsl:attribute>
        <xsl:attribute name="OTHERMDTYPE">DVRIGHTS</xsl:attribute>
        <xsl:apply-templates select="@* | node()"/>
    </xsl:copy>
</xsl:template>

<xsl:template match="mets:amdSec/mets:digiprovMD/mets:mdWrap">
    <xsl:copy>
        <xsl:attribute name="MDTYPE">OTHER</xsl:attribute>
        <xsl:attribute name="MIMETYPE">text/xml</xsl:attribute>
        <xsl:attribute name="OTHERMDTYPE">DVLINKS</xsl:attribute>
        <xsl:apply-templates select="@* | node()"/>
    </xsl:copy>
</xsl:template>

<xsl:template match="mets:structMap[@TYPE='PHYSICAL']/mets:div">
    <xsl:copy>
        <xsl:attribute name="TYPE">physSequence</xsl:attribute>
        <xsl:apply-templates select="@* | node()"/>
    </xsl:copy>
</xsl:template>
stefanCCS commented 4 years ago

Very nice! Works fine, and is much better than the solution before. Many thanks. I would propose to add the "documentation" label.