Changeset 4187


Ignore:
Timestamp:
12/13/13 16:33:02 (10 years ago)
Author:
larlam
Message:

imdi2clarin: Not all resources have a handle, so we have to check for handle-less nodes.

File:
1 edited

Legend:

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

    r4137 r4187  
    137137        <Resources>
    138138            <ResourceProxyList>
     139              <!-- A landing page can only be created when either 1)
     140              the file has an MPI handle or 2) $uri-base is
     141              defined. Note especially that files are not required to
     142              have a handle at all. That is not an error condition;
     143              simply skip landing page creation. -->
     144              <xsl:if test="(@ArchiveHandle and MPI:is_MPI_handle(@ArchiveHandle)) or not(normalize-space($uri-base)='')">
    139145                <ResourceProxy id="{generate-id()}">
    140                     <ResourceType><xsl:text>LandingPage</xsl:text></ResourceType>                       
    141                     <xsl:choose>
    142                         <!-- ArchiveHandle attribute has MPI handle prefix? If so, generate a LandingPage resource to the original IMDI -->
    143                         <xsl:when
    144                             test="MPI:is_MPI_handle(@ArchiveHandle)">
    145                             <xsl:choose>
    146                                 <xsl:when
    147                                     test="ends-with($MdSelfLink,'@format=cmdi')">
    148                                     <ResourceRef><xsl:value-of
    149                                         select="concat(substring-before($MdSelfLink,'@format=cmdi'),'@view')"/></ResourceRef>
    150                                 </xsl:when>
    151                                 <xsl:otherwise>
    152                                     <ResourceRef><xsl:value-of
    153                                         select="concat($MdSelfLink,'@view')"/></ResourceRef>
    154 <!--                                    <ResourceRef><xsl:value-of
    155                                         select="MPI:URL_to_view_in_IMDI_Browser_by_handle(@ArchiveHandle)"/></ResourceRef> -->
    156                                 </xsl:otherwise>
    157                             </xsl:choose>                               
    158                         </xsl:when>
    159                         <!-- When ArchiveHandle is not an MPI handle, it is necessarily a (non-MPI) handle. Use $uri-base as LandingPage, because the IMDI Browser cannot show external resources. -->
    160                         <xsl:when test="not(MPI:is_MPI_handle(@ArchiveHandle)) and not(normalize-space($uri-base)='')">
    161                             <ResourceRef><xsl:value-of
    162                                 select="MPI:URL_to_view_in_IMDI_Browser_by_path($uri-base)"/></ResourceRef>
     146                  <ResourceType><xsl:text>LandingPage</xsl:text></ResourceType>                       
     147                  <xsl:choose>
     148                    <!-- Does ArchiveHandle attribute *exist* and does
     149                         it have an MPI handle prefix? Then generate a
     150                         LandingPage resource to the original IMDI -->
     151                    <xsl:when test="@ArchiveHandle and MPI:is_MPI_handle(@ArchiveHandle)">
     152                      <xsl:choose>
     153                        <xsl:when test="ends-with($MdSelfLink,'@format=cmdi')">
     154                          <ResourceRef><xsl:value-of
     155                                          select="concat(substring-before($MdSelfLink,'@format=cmdi'),'@view')"/></ResourceRef>
    163156                        </xsl:when>
    164157                        <xsl:otherwise>
    165                             <xsl:message
    166                                 terminate="yes">
    167                             <xsl:text>ERROR: @ArchiveHandle is not an MPI handle, but $uri-base is empty. </xsl:text><xsl:value-of select="name()"/>
    168                         </xsl:message></xsl:otherwise>
    169                     </xsl:choose>     
     158                          <ResourceRef><xsl:value-of select="concat($MdSelfLink,'@view')"/></ResourceRef>
     159                        </xsl:otherwise>
     160                      </xsl:choose>                               
     161                    </xsl:when>
     162                    <!-- Either there is no handle or it is not an MPI
     163                         one; however $uri-base is available. Use it
     164                         as LandingPage, because the IMDI Browser
     165                         cannot show external resources.-->
     166                    <xsl:otherwise>
     167                      <ResourceRef><xsl:value-of
     168                                      select="MPI:URL_to_view_in_IMDI_Browser_by_path($uri-base)"/></ResourceRef>
     169                    </xsl:otherwise>
     170                  </xsl:choose>     
    170171                </ResourceProxy>
    171                
     172              </xsl:if>
     173
    172174                <xsl:apply-templates
    173175                    select="//Resources"
     
    212214                    <!-- MPI handle prefix? Use handle + @format=cmdi suffix -->
    213215                    <xsl:when
    214                         test="MPI:is_MPI_handle(@ArchiveHandle)">
     216                        test="@ArchiveHandle and MPI:is_MPI_handle(@ArchiveHandle)">
    215217                        <xsl:call-template
    216218                            name="METATRANSCRIPT_rec">
Note: See TracChangeset for help on using the changeset viewer.