Changeset 3378


Ignore:
Timestamp:
08/14/13 09:25:31 (11 years ago)
Author:
twagoo
Message:

Added @format=cmdi to metadata resource refs in our archive. Also added construction of a comment containing the non-handle link.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • metadata/trunk/toolkit/xslt/imdi2clarin.xsl

    r3371 r3378  
    148148        <xsl:for-each select="CorpusLink">
    149149            <ResourceProxy id="{generate-id()}">
     150                <!-- Do we have both archive handle and link (text content)? -->
     151                <xsl:if test="not(normalize-space(./@ArchiveHandle)='' or normalize-space(.)='')">
     152                    <!-- Archive handle is kept, but original link is lost in CDMI. Keep content in a comment. -->
     153                    <xsl:comment>
     154                        <xsl:value-of select="."/>
     155                    </xsl:comment>
     156                </xsl:if>
    150157                <ResourceType>Metadata</ResourceType>
    151158                <ResourceRef>
    152159                    <xsl:choose>
    153                         <xsl:when test="not(normalize-space(./@ArchiveHandle)='')"
    154                                 ><xsl:value-of select="./@ArchiveHandle"/></xsl:when>
     160                        <!-- Check for archive handle attribute -->
     161                        <xsl:when test="not(normalize-space(./@ArchiveHandle)='')">
     162                            <xsl:choose>
     163                                <!-- MPI handle prefix? Use handle + @format=cmdi suffix -->
     164                                <xsl:when test="starts-with(normalize-space(@ArchiveHandle), 'hdl:1839/')"><xsl:value-of select="@ArchiveHandle"/>@format=cmdi</xsl:when>
     165                                <!-- Other handle prefix? Use handle (e.g. Lund) -->
     166                                <xsl:otherwise><xsl:value-of select="@ArchiveHandle"/></xsl:otherwise>
     167                            </xsl:choose>
     168                        </xsl:when>
     169                        <!-- Is link a handle? -->
    155170                        <xsl:when test="starts-with(., 'hdl:')">
    156171                            <xsl:value-of select="."/>
    157172                        </xsl:when>
     173                        <!-- Fallback: use original link, append .cmdi. Resolve from base URI if available. -->
    158174                        <xsl:when test="$uri-base=''"><xsl:value-of select="."/>.cmdi</xsl:when>
    159175                        <xsl:otherwise>
Note: See TracChangeset for help on using the changeset viewer.