Skip to main content
ExLibris
  • Subscribe by RSS
  • Ex Libris Knowledge Center

    Files delivered using IIIF Universal Viewer are not ordered according to Logical Structure Map of delivered Representation

    • Product: Rosetta
    • Product Version: 7.2

    Symptoms

    Files delivered using IIIF Universal Viewer are not ordered according to Logical structure of delivered Representation.

    Causes

    An issue with "Out of the box" deployed IIIF Manifest XSL (for either version 2 or 3).

    Defect Status

    The issue is under review by Development team.

    Workaround

    In general, IIIF Manifest XSL can be modified from Rosetta Data Management module → Deposits → Delivery XSL Files →

    • For IIIF Manifest version 3 - Click on "Edit" for "mets2manifest_V3.xsl"
    • For IIIF Manifest version 2 - Click on "Edit" for "mets2manifest.xsl"


    For example, the XSL files below allow the order for the delivered Files to be dictated by the following priority:

    1. 'LOGICAL' Stracture Map.
    2. 'PHYSICAL' Stracture Map.
    3. Ascending order of File found under 'mets:fileGrp' section of METS.
      (not relevant for 'Derivative Copy' Representation)

    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:mets="http://www.loc.gov/METS/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:dnx="http://www.exlibrisgroup.com/dps/dnx" version="2.0">
       <xsl:output method="html" omit-xml-declaration="yes"/>
       <xsl:param name="isDownloadFile"/>
       <xsl:param name="MDFields"/>
       <xsl:variable name="PID" select="/mets:mets/mets:amdSec[@ID=$IE_AMD_ID]/mets:techMD/mets:mdWrap/mets:xmlData/dnx:dnx/dnx:section[@id=&apos;internalIdentifier&apos;]/dnx:record[dnx:key[@id=&apos;internalIdentifierType&apos;]=&apos;PID&apos;]/dnx:key[@id=&apos;internalIdentifierValue&apos;]"/>
       <xsl:variable name="CONTEXT">&quot;@context&quot; : &quot;http://iiif.io/api/presentation/3/context.json&quot;</xsl:variable>
       <xsl:variable name="SERVICE_CONTEXT">&quot;@context&quot; : &quot;http://iiif.io/api/image/3/context.json&quot;</xsl:variable>
       <xsl:variable name="ID">&quot;id&quot; : &quot;</xsl:variable>
       <xsl:variable name="TYPE">&quot;type&quot; : &quot;</xsl:variable>
       <xsl:variable name="ON">&quot;on&quot; : &quot;</xsl:variable>
       <xsl:variable name="DELIVERY_BASE_URL">baseURLPlaceHolderdelivery/</xsl:variable>
       <xsl:variable name="DOWNLOAD_FUNC">downloadFileFunc</xsl:variable>
       <xsl:variable name="THUMBNAIL_FUNC">thumbnailFileFunc</xsl:variable>
       <xsl:variable name="IMAGE_SERVER_BASE_URL">imageServerBaseURLPlaceHolder</xsl:variable>
       <xsl:variable name="UI_CUSTOMIZATION">UIcustomizatioIDplaceHolder</xsl:variable>
       <xsl:variable name="CONSOTRIUM_ID">UIconsortiumIDplaceHolder</xsl:variable>
       <xsl:variable name="URI_PREFIX">iiif/presentation/3/</xsl:variable>
       <xsl:variable name="IMAGE_SERVER_PREFIX">cantaloupe/iiif/2/</xsl:variable>
       <xsl:variable name="DVS">DVSplaceHolder</xsl:variable>
       <xsl:variable name="OBJECT_TYPE_IE">IE</xsl:variable>
       <xsl:variable name="OBJECT_TYPE_REPRESENTATION">REP</xsl:variable>
       <xsl:variable name="OBJECT_TYPE_FILE">FILE</xsl:variable>
       <xsl:variable name="LABEL">&quot;label&quot; : &quot;</xsl:variable>
       <xsl:variable name="VALUE">&quot;value&quot; : &quot;</xsl:variable>
       <xsl:variable name="IE_AMD_ID">ie-amd</xsl:variable>
       <xsl:variable name="IE_DMD_ID">ie-dmd</xsl:variable>
       <xsl:variable name="DESCRIPTION">&quot;description&quot;: &quot;</xsl:variable>
       <xsl:variable name="ATTRIBUTION">&quot;Attribution&quot;</xsl:variable>
       <xsl:variable name="METADATA">&quot;metadata&quot;: [</xsl:variable>
       <xsl:variable name="LOGO">&quot;logo&quot;: &quot;</xsl:variable>
       <xsl:variable name="LICENSE">&quot;license&quot;: &quot;</xsl:variable>
       <xsl:variable name="THUMBNAIL">&quot;thumbnail&quot;: &quot;</xsl:variable>
       <xsl:variable name="MOTIVATION">&quot;motivation&quot;: &quot;sc:painting&quot;,</xsl:variable>
       <xsl:variable name="VIEWING_DIRECTION">&quot;viewingDirection&quot;: </xsl:variable>
       <xsl:variable name="VIEWING_HINT">&quot;behavior&quot;: </xsl:variable>
       <xsl:variable name="WIDTH">&quot;width&quot;: </xsl:variable>
       <xsl:variable name="HEIGHT">&quot;height&quot;: </xsl:variable>
       <xsl:variable name="WIDTH_PLACE_HOLDER">&quot;widthPlaceholder</xsl:variable>
       <xsl:variable name="HEIGHT_PLACE_HOLDER">&quot;heightPlaceholder</xsl:variable>
       <xsl:variable name="INFO_JSON">/info.json</xsl:variable>
       <xsl:variable name="FILE_FORMAT">&quot;format&quot;: &quot;</xsl:variable>
       <xsl:variable name="PROFILE">&quot;profile&quot;: &quot;http://iiif.io/api/image/3/level1.json&quot; </xsl:variable>
       <xsl:variable name="DURATION">&quot;duration&quot;: </xsl:variable>
       <xsl:variable name="DURATION_PLACE_HOLDER">durationPlaceHolder</xsl:variable>
       <xsl:template match="/">{                <xsl:call-template name="MANIFEST"/>
          <xsl:call-template name="SEQUENCES"/>
          <xsl:call-template name="RANGES"/>}        </xsl:template>
       <xsl:template name="IE_PROPERTY">
          <xsl:param name="DC_FIELD_NAME"/>
          <xsl:param name="DCTERMS_FIELD_NAME"/>
          <xsl:choose>
             <xsl:when test="/mets:mets/mets:dmdSec[@ID=$IE_DMD_ID]/mets:mdWrap/mets:xmlData/dc:record/*[name()=$DC_FIELD_NAME]">
                <xsl:value-of select="/mets:mets/mets:dmdSec[@ID=$IE_DMD_ID]/mets:mdWrap/mets:xmlData/dc:record/*[name()=$DC_FIELD_NAME]"/>
             </xsl:when>
             <xsl:when test="(//mets:dmdSec[@ID=$IE_DMD_ID]/mets:mdWrap/mets:xmlData/dc:record/*[name()=$DCTERMS_FIELD_NAME])[1]">
                <xsl:value-of select="(//mets:dmdSec[@ID=$IE_DMD_ID]/mets:mdWrap/mets:xmlData/dc:record/*[name()=$DCTERMS_FIELD_NAME])[1]"/>
             </xsl:when>
             <xsl:otherwise/>
          </xsl:choose>
       </xsl:template>
       <xsl:template name="IE_PROPERTY_LABEL">
          <xsl:param name="DC_FIELD_NAME"/>
          <xsl:param name="DCTERMS_FIELD_NAME"/>
          <xsl:param name="DCTERMS_FIELD_NAME_2"/>
          <xsl:choose>
             <xsl:when test="/mets:mets/mets:dmdSec[@ID=$IE_DMD_ID]/mets:mdWrap/mets:xmlData/dc:record/*[name()=$DC_FIELD_NAME]">
                <xsl:value-of select="/mets:mets/mets:dmdSec[@ID=$IE_DMD_ID]/mets:mdWrap/mets:xmlData/dc:record/*[name()=$DC_FIELD_NAME]"/>
             </xsl:when>
             <xsl:when test="(//mets:dmdSec[@ID=$IE_DMD_ID]/mets:mdWrap/mets:xmlData/dc:record/*[name()=$DCTERMS_FIELD_NAME])[1]">
                <xsl:value-of select="(//mets:dmdSec[@ID=$IE_DMD_ID]/mets:mdWrap/mets:xmlData/dc:record/*[name()=$DCTERMS_FIELD_NAME])[1]"/>
             </xsl:when>
             <xsl:when test="(//mets:dmdSec[@ID=$IE_DMD_ID]/mets:mdWrap/mets:xmlData/dc:record/*[name()=$DCTERMS_FIELD_NAME_2])[1]">
                <xsl:value-of select="(//mets:dmdSec[@ID=$IE_DMD_ID]/mets:mdWrap/mets:xmlData/dc:record/*[name()=$DCTERMS_FIELD_NAME_2])[1]"/>
             </xsl:when>
             <xsl:otherwise>no title</xsl:otherwise>
          </xsl:choose>
       </xsl:template>
       <xsl:template name="IE_METADATA">
          <xsl:for-each select="/mets:mets/mets:dmdSec[@ID=$IE_DMD_ID]/mets:mdWrap/mets:xmlData/dc:record/dc:creator |                                       /mets:mets/mets:dmdSec[@ID=$IE_DMD_ID]/mets:mdWrap/mets:xmlData/dc:record/dcterms:creator ">                        {<xsl:value-of select="$LABEL"/>Author&quot;, <xsl:value-of select="$VALUE"/>
             <xsl:value-of select="."/>&quot;}            <xsl:if test="position()!=last() or count(//dc:subject) &gt; 0 or count(//dcterms:subject) &gt; 0">, </xsl:if>
          </xsl:for-each>
          <xsl:for-each select="/mets:mets/mets:dmdSec[@ID=$IE_DMD_ID]/mets:mdWrap/mets:xmlData/dc:record/dc:subject |                                       /mets:mets/mets:dmdSec[@ID=$IE_DMD_ID]/mets:mdWrap/mets:xmlData/dc:record/dcterms:subject">                        {<xsl:value-of select="$LABEL"/>Subject&quot;, <xsl:value-of select="$VALUE"/>
             <xsl:value-of select="."/>&quot;}         <xsl:if test="position()!=last()">, </xsl:if>
          </xsl:for-each>                ]        </xsl:template>
       <xsl:template name="MANIFEST">
          <xsl:value-of select="$CONTEXT"/>,                <xsl:value-of select="$ID"/>
          <xsl:value-of select="$DELIVERY_BASE_URL"/>
          <xsl:value-of select="$URI_PREFIX"/>
          <xsl:value-of select="$PID"/>/manifest&quot;,                <xsl:value-of select="$TYPE"/>Manifest&quot;, &quot;label&quot;: { &quot;none&quot;: [ &quot;<xsl:call-template name="IE_PROPERTY_LABEL">
             <xsl:with-param name="DC_FIELD_NAME" select="&quot;dc:title&quot;"/>
             <xsl:with-param name="DCTERMS_FIELD_NAME" select="&quot;dcterms:title&quot;"/>
             <xsl:with-param name="DCTERMS_FIELD_NAME_2" select="&quot;dcterms:alternative&quot;"/>
          </xsl:call-template>&quot;] }, &quot;summary&quot;: { &quot;none&quot;: [ &quot;<xsl:call-template name="IE_PROPERTY">
             <xsl:with-param name="DC_FIELD_NAME" select="&quot;dc:description&quot;"/>
             <xsl:with-param name="DCTERMS_FIELD_NAME" select="&quot;dcterms:description&quot;"/>
          </xsl:call-template>&quot;                 ] },         &quot;requiredStatement&quot;: {                        &quot;label&quot;: { &quot;none&quot;: [ <xsl:value-of select="$ATTRIBUTION"/> ] },                        &quot;value&quot;: { &quot;none&quot;: [ &quot;<xsl:call-template name="IE_PROPERTY">
             <xsl:with-param name="DC_FIELD_NAME" select="&quot;dc:rights&quot;"/>
             <xsl:with-param name="DCTERMS_FIELD_NAME" select="&quot;dcterms:rights&quot;"/>
          </xsl:call-template>&quot; ] }                },                &quot;metadata&quot;: [                        <xsl:value-of select="//metadataFields/IE_LEVEL"/>                        ],<xsl:choose>
             <xsl:when test="/mets:mets/mets:amdSec[@ID=&apos;ie-amd&apos;]/mets:techMD[@ID=&apos;ie-amd-tech&apos;]/mets:mdWrap/mets:xmlData/dnx:dnx/dnx:section[@id=&apos;objectCharacteristics&apos;]/dnx:record/dnx:key[@id=&apos;owner&apos;]">        &quot;logo&quot;: [ {                &quot;id&quot;: &quot;<xsl:value-of select="$DELIVERY_BASE_URL"/>images/<xsl:value-of select="$UI_CUSTOMIZATION"/>/logo-main.png&quot;,                &quot;type&quot;: &quot;Image&quot;        } ],        &quot;provider&quot;: [ {                &quot;id&quot;: &quot;https://example.org/about&quot;,                &quot;type&quot;: &quot;Agent&quot;,        &quot;label&quot;: { &quot;none&quot;: [ &quot;<xsl:value-of select="$CONSOTRIUM_ID"/>&quot; ] },        &quot;logo&quot;: [ {                &quot;id&quot;:&quot;<xsl:value-of select="$DELIVERY_BASE_URL"/>images/<xsl:value-of select="$UI_CUSTOMIZATION"/>/logo-main.png&quot;,                &quot;type&quot;: &quot;Image&quot;                } ]         } ],        &quot;rights&quot;: &quot;&quot;,        </xsl:when>
             <xsl:otherwise>        &quot;logo&quot;: [ {                &quot;id&quot;: &quot;<xsl:value-of select="$DELIVERY_BASE_URL"/>images/1/logo-main.png&quot;,                &quot;type&quot;: &quot;Image&quot;        } ],        &quot;provider&quot;: [ {                &quot;id&quot;: &quot;https://example.org/about&quot;,                &quot;type&quot;: &quot;Agent&quot;,                &quot;label&quot;: { &quot;none&quot;: [ &quot;<xsl:value-of select="$CONSOTRIUM_ID"/>&quot; ] },                &quot;logo&quot;: [ {                        &quot;id&quot;: &quot;<xsl:value-of select="$DELIVERY_BASE_URL"/>images/1/logo-main.png&quot;,                        &quot;type&quot;: &quot;Image&quot;                        } ]                 } ],                &quot;rights&quot;: &quot;&quot;,                </xsl:otherwise>
          </xsl:choose>                &quot;thumbnail&quot;: [ { &quot;id&quot;: &quot;<xsl:value-of select="$DELIVERY_BASE_URL"/>DeliveryManagerServlet?dps_pid=<xsl:value-of select="$PID"/>
          <xsl:value-of select="$THUMBNAIL_FUNC"/>&quot;,                                                 &quot;type&quot;: &quot;Image&quot;                 }],                <xsl:variable name="VIEWING_DIRECTION_VALUE">
             <xsl:choose>
                <xsl:when test="/mets:mets/mets:dmdSec[@ID=&apos;ie-dmd&apos;]/mets:mdWrap/mets:xmlData/dc:record/dc:language=&apos;heb&apos;">                                        &quot;right-to-left&quot;                                </xsl:when>
                <xsl:when test="/mets:mets/mets:dmdSec[@ID=&apos;ie-dmd&apos;]/mets:mdWrap/mets:xmlData/dc:record/dc:language=&apos;ara&apos;">                                        &quot;right-to-left&quot;                                </xsl:when>
                <xsl:when test="/mets:mets/mets:dmdSec[@ID=&apos;ie-dmd&apos;]/mets:mdWrap/mets:xmlData/dc:record/dc:language=&apos;chi&apos;">                                        &quot;top-to-bottom&quot;                                </xsl:when>
                <xsl:otherwise>                                        &quot;left-to-right&quot;                                </xsl:otherwise>
             </xsl:choose>
          </xsl:variable>
          <xsl:value-of select="$VIEWING_DIRECTION"/>
          <xsl:value-of select="$VIEWING_DIRECTION_VALUE"/>,                        <xsl:variable name="VIEWING_HINT_VALUE">
             <xsl:choose>
                <xsl:when test="/mets:mets/mets:amdSec[@ID=&apos;ie-amd&apos;]/mets:techMD[@ID=&apos;ie-amd-tech&apos;]/mets:mdWrap/mets:xmlData/dnx:dnx/dnx:section[@id=&apos;generalIECharacteristics&apos;]/dnx:record/dnx:key[@id=&apos;IEEntityType&apos;]=&apos;Book&apos;">                                        &quot;paged&quot;,                                </xsl:when>
                <xsl:otherwise>                                        &quot;individuals&quot;,                                </xsl:otherwise>
             </xsl:choose>
          </xsl:variable>
          <xsl:value-of select="$VIEWING_HINT"/>
          <xsl:value-of select="$VIEWING_HINT_VALUE"/>
       </xsl:template>
       <xsl:template name="SEQUENCES">&quot;items&quot;: [        <xsl:variable name="HAS_PHYSICAL_SM" select="count(/mets:mets/mets:structMap[upper-case(@TYPE)=&apos;PHYSICAL&apos;]) &gt; 0"/>
       <xsl:variable name="HAS_LOGICAL_SM" select="count(/mets:mets/mets:structMap[upper-case(@TYPE)=&apos;LOGICAL&apos;]) &gt; 0"/>
          <xsl:choose>
             <xsl:when test="$HAS_LOGICAL_SM = true()">
                <xsl:for-each select="//mets:structMap[upper-case(@TYPE)=&apos;LOGICAL&apos;]/mets:div/mets:div/mets:div[@TYPE=&apos;FILE&apos;]">
                   <xsl:variable name="FILEID" select="./mets:fptr/@FILEID"/>
                   <!-- <xsl:variable name="FILE_LABEL_LABEL" select="/mets:mets/mets:amdSec[@ID=concat($FILEID,&apos;-amd&apos;)]/mets:techMD[@ID=concat($FILEID,&apos;-amd-tech&apos;)]/mets:mdWrap/mets:xmlData/dnx:dnx/dnx:section[@id=&apos;generalFileCharacteristics&apos;]/dnx:record/dnx:key[@id=&apos;label&apos;]/text()"/> -->
                   <xsl:variable name="FILE_LABEL_LABEL" select="./@LABEL"/>
                   <!-- <xsl:variable name="FILE_LABEL_NAME" select="(/mets:mets/mets:amdSec[@ID=concat($FILEID,&apos;-amd&apos;)]/mets:techMD[@ID=concat($FILEID,&apos;-amd-tech&apos;)]/mets:mdWrap/mets:xmlData/dnx:dnx/dnx:section[@id=&apos;generalFileCharacteristics&apos;]/dnx:record/dnx:key[@id=&apos;fileOriginalName&apos;])[1]/text()"/> -->
                   <xsl:variable name="FILE_LABEL_NAME" select="./@LABEL"/>
                   <xsl:variable name="FILE_SM_LABEL" select="//mets:div/@LABEL[./mets:fptr/@FILEID=$FILEID]"/>
                   <xsl:call-template name="CANVAS">
                      <xsl:with-param name="FILE_ID" select="$FILEID"/>
                      <xsl:with-param name="FILE_LABEL">
                         <xsl:choose>
                            <xsl:when test="$FILE_SM_LABEL">
                               <xsl:value-of select="$FILE_SM_LABEL"/>
                            </xsl:when>
                            <xsl:when test="$FILE_LABEL_LABEL">
                               <xsl:value-of select="$FILE_LABEL_LABEL"/>
                            </xsl:when>
                            <xsl:when test="$FILE_LABEL_NAME">
                               <xsl:value-of select="$FILE_LABEL_NAME"/>
                            </xsl:when>
                            <xsl:otherwise/>
                         </xsl:choose>
                      </xsl:with-param>
                   </xsl:call-template>
                </xsl:for-each>
             </xsl:when>
             <xsl:when test="$HAS_PHYSICAL_SM = true()">
                <xsl:for-each select="//mets:structMap[upper-case(@TYPE)=&apos;PHYSICAL&apos;]/mets:div/mets:div/mets:div[@TYPE=&apos;FILE&apos;]">
                   <xsl:variable name="FILEID" select="./mets:fptr/@FILEID"/>
                   <xsl:variable name="FILE_LABEL_LABEL" select="/mets:mets/mets:amdSec[@ID=concat($FILEID,&apos;-amd&apos;)]/mets:techMD[@ID=concat($FILEID,&apos;-amd-tech&apos;)]/mets:mdWrap/mets:xmlData/dnx:dnx/dnx:section[@id=&apos;generalFileCharacteristics&apos;]/dnx:record/dnx:key[@id=&apos;label&apos;]/text()"/>
                   <xsl:variable name="FILE_LABEL_NAME" select="(/mets:mets/mets:amdSec[@ID=concat($FILEID,&apos;-amd&apos;)]/mets:techMD[@ID=concat($FILEID,&apos;-amd-tech&apos;)]/mets:mdWrap/mets:xmlData/dnx:dnx/dnx:section[@id=&apos;generalFileCharacteristics&apos;]/dnx:record/dnx:key[@id=&apos;fileOriginalName&apos;])[1]/text()"/>
                   <xsl:variable name="FILE_SM_LABEL" select="//mets:div/@LABEL[./mets:fptr/@FILEID=$FILEID]"/>
                   <xsl:call-template name="CANVAS">
                      <xsl:with-param name="FILE_ID" select="$FILEID"/>
                      <xsl:with-param name="FILE_LABEL">
                         <xsl:choose>
                            <xsl:when test="$FILE_SM_LABEL">
                               <xsl:value-of select="$FILE_SM_LABEL"/>
                            </xsl:when>
                            <xsl:when test="$FILE_LABEL_LABEL">
                               <xsl:value-of select="$FILE_LABEL_LABEL"/>
                            </xsl:when>
                            <xsl:when test="$FILE_LABEL_NAME">
                               <xsl:value-of select="$FILE_LABEL_NAME"/>
                            </xsl:when>
                            <xsl:otherwise/>
                         </xsl:choose>
                      </xsl:with-param>
                   </xsl:call-template>
                </xsl:for-each>
             </xsl:when>
             <xsl:otherwise>
                <xsl:for-each select="//mets:fileGrp/mets:file">
                   <xsl:variable name="FILEID" select="./@ID"/>
                   <xsl:variable name="FILE_LABEL_LABEL" select="/mets:mets/mets:amdSec[@ID=concat($FILEID,&apos;-amd&apos;)]/mets:techMD[@ID=concat($FILEID,&apos;-amd-tech&apos;)]/mets:mdWrap/mets:xmlData/dnx:dnx/dnx:section[@id=&apos;generalFileCharacteristics&apos;]/dnx:record/dnx:key[@id=&apos;label&apos;]/text()"/>
                   <xsl:variable name="FILE_LABEL_NAME" select="(/mets:mets/mets:amdSec[@ID=concat($FILEID,&apos;-amd&apos;)]/mets:techMD[@ID=concat($FILEID,&apos;-amd-tech&apos;)]/mets:mdWrap/mets:xmlData/dnx:dnx/dnx:section[@id=&apos;generalFileCharacteristics&apos;]/dnx:record/dnx:key[@id=&apos;fileOriginalName&apos;])[1]/text()"/>
                   <xsl:call-template name="CANVAS">
                      <xsl:with-param name="FILE_ID" select="$FILEID"/>
                      <xsl:with-param name="FILE_LABEL">
                         <xsl:choose>
                            <xsl:when test="$FILE_LABEL_LABEL">
                               <xsl:value-of select="$FILE_LABEL_LABEL"/>
                            </xsl:when>
                            <xsl:when test="$FILE_LABEL_NAME">
                               <xsl:value-of select="$FILE_LABEL_NAME"/>
                            </xsl:when>
                            <xsl:otherwise/>
                         </xsl:choose>
                      </xsl:with-param>
                   </xsl:call-template>
                </xsl:for-each>
             </xsl:otherwise>
          </xsl:choose>        ],        </xsl:template>
       <xsl:template name="CANVAS">
          <xsl:param name="FILE_ID"/>
          <xsl:param name="FILE_LABEL"/>
          <xsl:variable name="HEIGHT_VALUE" select="/mets:mets/mets:amdSec[@ID=concat($FILE_ID,&apos;-amd&apos;)]/mets:techMD[@ID=concat($FILE_ID,&apos;-amd-tech&apos;)]/mets:mdWrap/mets:xmlData/dnx:dnx/dnx:section/dnx:record[dnx:key[@id=&apos;significantPropertiesType&apos;]=&apos;nisoImage.imageLength&apos;]/dnx:key[@id=&apos;significantPropertiesValue&apos;]"/>
          <xsl:variable name="WIDTH_VALUE" select="/mets:mets/mets:amdSec[@ID=concat($FILE_ID,&apos;-amd&apos;)]/mets:techMD[@ID=concat($FILE_ID,&apos;-amd-tech&apos;)]/mets:mdWrap/mets:xmlData/dnx:dnx/dnx:section/dnx:record[dnx:key[@id=&apos;significantPropertiesType&apos;]=&apos;nisoImage.imageWidth&apos;]/dnx:key[@id=&apos;significantPropertiesValue&apos;]"/>
          <xsl:variable name="FILE_EXTENSION" select="/mets:mets/mets:amdSec[@ID=concat($FILE_ID,&apos;-amd&apos;)]/mets:techMD[@ID=concat($FILE_ID,&apos;-amd-tech&apos;)]/mets:mdWrap/mets:xmlData/dnx:dnx/dnx:section[@id=&apos;generalFileCharacteristics&apos;]/dnx:record/dnx:key[@id=&apos;fileExtension&apos;]"/>
          <xsl:variable name="FILE_FORMAT_VALUE" select="/mets:mets/mets:amdSec[@ID=concat($FILE_ID,&apos;-amd&apos;)]/mets:techMD[@ID=concat($FILE_ID,&apos;-amd-tech&apos;)]/mets:mdWrap/mets:xmlData/dnx:dnx/dnx:section[@id=&apos;generalFileCharacteristics&apos;]/dnx:record/dnx:key[@id=&apos;fileMIMEType&apos;]"/>
          <xsl:variable name="FILE_SIZE_VALUE" select="/mets:mets/mets:amdSec[@ID=concat($FILE_ID,&apos;-amd&apos;)]/mets:techMD[@ID=concat($FILE_ID,&apos;-amd-tech&apos;)]/mets:mdWrap/mets:xmlData/dnx:dnx/dnx:section[@id=&apos;generalFileCharacteristics&apos;]/dnx:record/dnx:key[@id=&apos;fileSizeBytes&apos;]"/>
          <xsl:variable name="DURATION_VALUE" select="/mets:mets/mets:amdSec[@ID=concat($FILE_ID,&apos;-amd&apos;)]/mets:techMD[@ID=concat($FILE_ID,&apos;-amd-tech&apos;)]/mets:mdWrap/mets:xmlData/dnx:dnx/dnx:section/dnx:record[dnx:key[@id=&apos;significantPropertiesType&apos;]=&apos;audio.durationTotalMilliSeconds&apos;]/dnx:key[@id=&apos;significantPropertiesValue&apos;]"/>
          <xsl:variable name="FILE_TYPE">
             <xsl:choose>
                <xsl:when test="contains($FILE_FORMAT_VALUE, &apos;video&apos;)">Video</xsl:when>
                <xsl:when test="contains($FILE_FORMAT_VALUE, &apos;audio&apos;)">Sound</xsl:when>
                <xsl:when test="contains($FILE_FORMAT_VALUE, &apos;pdf&apos;)">Text</xsl:when>
                <xsl:otherwise>Image</xsl:otherwise>
             </xsl:choose>
          </xsl:variable>                {                <xsl:value-of select="$ID"/>
          <xsl:value-of select="$DELIVERY_BASE_URL"/>
          <xsl:value-of select="$URI_PREFIX"/>
          <xsl:value-of select="$PID"/>/canvas/<xsl:value-of select="$FILE_ID"/>&quot;,                <xsl:value-of select="$TYPE"/>Canvas&quot;,                &quot;label&quot;: { &quot;none&quot;: [ &quot;<xsl:value-of select="$FILE_LABEL"/>&quot; ] },                &quot;metadata&quot;: [                        <xsl:value-of select="//metadataFields/FILE_LEVEL/FILE_MD[@id=$FILE_ID]"/>                                ],                <xsl:if test="$isDownloadFile = true()">                        &quot;rendering&quot;: [{                                <xsl:value-of select="$ID"/>
             <xsl:value-of select="$DELIVERY_BASE_URL"/>DeliveryManagerServlet?dps_pid=<xsl:value-of select="$FILE_ID"/>
             <xsl:value-of select="$DOWNLOAD_FUNC"/>&quot;,                                <xsl:value-of select="$FILE_FORMAT"/>
             <xsl:value-of select="$FILE_FORMAT_VALUE"/>&quot;,                                <xsl:value-of select="$LABEL"/>Original file -<xsl:value-of select="format-number($FILE_SIZE_VALUE div 1024 div 1024,&apos;###,###,##0.00&apos;)"/>MB&quot;                        }],                </xsl:if>
          <xsl:choose>
             <xsl:when test="$HEIGHT_VALUE!=&apos;&apos; and $WIDTH_VALUE!=&apos;&apos;">
                <xsl:value-of select="$HEIGHT"/>
                <xsl:value-of select="$HEIGHT_VALUE"/>,                                <xsl:value-of select="$WIDTH"/>
                <xsl:value-of select="$WIDTH_VALUE"/>,                        </xsl:when>
          </xsl:choose>
          <xsl:if test="$FILE_TYPE=&apos;Sound&apos; or $FILE_TYPE=&apos;Video&apos;">
             <xsl:value-of select="$DURATION"/>
             <xsl:choose>
                <xsl:when test="$DURATION_VALUE">
                   <xsl:value-of select="$DURATION_VALUE div 1000"/>
                </xsl:when>
                <xsl:otherwise>
                   <xsl:value-of select="$DURATION_PLACE_HOLDER"/>
                   <xsl:value-of select="$FILE_ID"/>
                </xsl:otherwise>
             </xsl:choose>,                </xsl:if>                 &quot;items&quot;: [{                        &quot;id&quot;:&quot;<xsl:value-of select="$DELIVERY_BASE_URL"/>
          <xsl:value-of select="$URI_PREFIX"/>
          <xsl:value-of select="$PID"/>/annopage/<xsl:value-of select="$FILE_ID"/>&quot;,                        &quot;type&quot;: &quot;AnnotationPage&quot;,                        &quot;items&quot;: [ {                                &quot;id&quot;:&quot;<xsl:value-of select="$DELIVERY_BASE_URL"/>
          <xsl:value-of select="$URI_PREFIX"/>
          <xsl:value-of select="$PID"/>/annotation/<xsl:value-of select="$FILE_ID"/>&quot;,                                &quot;type&quot;: &quot;Annotation&quot;,                                &quot;motivation&quot;: &quot;painting&quot;,                                &quot;target&quot;: &quot;<xsl:value-of select="$DELIVERY_BASE_URL"/>
          <xsl:value-of select="$URI_PREFIX"/>
          <xsl:value-of select="$PID"/>/canvas/<xsl:value-of select="$FILE_ID"/>&quot;,                                &quot;body&quot;: {                                        <xsl:value-of select="$ID"/>
          <xsl:choose>
             <xsl:when test="$FILE_TYPE=&apos;Image&apos;">
                <xsl:value-of select="$IMAGE_SERVER_BASE_URL"/>
                <xsl:value-of select="$IMAGE_SERVER_PREFIX"/>
                <xsl:value-of select="$PID"/>:<xsl:value-of select="$FILE_ID"/>.<xsl:value-of select="$FILE_EXTENSION"/>/full/max/0/default.jpg&quot;,                                                </xsl:when>
             <xsl:otherwise>
                <xsl:value-of select="$DELIVERY_BASE_URL"/>stream/<xsl:value-of select="$FILE_ID"/>&quot;,                                                </xsl:otherwise>
          </xsl:choose>
          <xsl:value-of select="$TYPE"/>
          <xsl:value-of select="$FILE_TYPE"/>&quot;,                                        <xsl:value-of select="$FILE_FORMAT"/>
          <xsl:value-of select="$FILE_FORMAT_VALUE"/>&quot;                                        <xsl:choose>
             <xsl:when test="$HEIGHT_VALUE!=&apos;&apos; and $WIDTH_VALUE!=&apos;&apos;">                                                        ,                                                        <xsl:value-of select="$HEIGHT"/>
                <xsl:value-of select="$HEIGHT_VALUE"/>,                                                        <xsl:value-of select="$WIDTH"/>
                <xsl:value-of select="$WIDTH_VALUE"/>
             </xsl:when>
          </xsl:choose>
          <xsl:if test="$FILE_TYPE=&apos;Sound&apos; or $FILE_TYPE=&apos;Video&apos;">,                                                <xsl:value-of select="$DURATION"/>
             <xsl:choose>
                <xsl:when test="$DURATION_VALUE">
                   <xsl:value-of select="$DURATION_VALUE div 1000"/>
                </xsl:when>
                <xsl:otherwise>
                   <xsl:value-of select="$DURATION_PLACE_HOLDER"/>
                   <xsl:value-of select="$FILE_ID"/>
                </xsl:otherwise>
             </xsl:choose>
          </xsl:if>
          <xsl:choose>
             <xsl:when test="$FILE_TYPE=&apos;Image&apos;">                                                ,                                                &quot;service&quot;: [{                                                        <xsl:value-of select="$SERVICE_CONTEXT"/>,                                                        <xsl:value-of select="$ID"/>
                <xsl:value-of select="$IMAGE_SERVER_BASE_URL"/>
                <xsl:value-of select="$IMAGE_SERVER_PREFIX"/>
                <xsl:value-of select="$PID"/>:<xsl:value-of select="$FILE_ID"/>.<xsl:value-of select="$FILE_EXTENSION"/>&quot;,                                                        <xsl:value-of select="$PROFILE"/>                                                }]                                                </xsl:when>
          </xsl:choose>                                        }                                }]                         }]                         ,                         &quot;thumbnail&quot;:[{                                <xsl:value-of select="$ID"/>
          <xsl:value-of select="$DELIVERY_BASE_URL"/>DeliveryManagerServlet?dps_pid=<xsl:value-of select="$FILE_ID"/>
          <xsl:value-of select="$THUMBNAIL_FUNC"/>&quot;            }]                }<xsl:if test="position()!=last()">,</xsl:if>
       </xsl:template>
       <xsl:template name="RANGES">                &quot;structures&quot;: [                <xsl:for-each select="/mets:mets/mets:structMap[upper-case(@TYPE)=&apos;LOGICAL&apos;]/mets:div/mets:div">
             <xsl:choose>
                <xsl:when test="not(./@TYPE=&apos;FILE&apos;)">
                   <xsl:call-template name="RANGE">
                      <xsl:with-param name="RANGE_ID" select="/mets:mets/mets:fileSec/mets:fileGrp/@ID"/>
                   </xsl:call-template>
                </xsl:when>
                <xsl:otherwise>                         {<xsl:value-of select="$ID"/>
                   <xsl:value-of select="$DELIVERY_BASE_URL"/>
                   <xsl:value-of select="$URI_PREFIX"/>
                   <xsl:value-of select="$PID"/>/canvas/<xsl:value-of select="./mets:fptr/@FILEID"/>&quot;,                                <xsl:value-of select="$TYPE"/>Canvas&quot;,                          <xsl:value-of select="$LABEL"/>
                   <xsl:value-of select="@LABEL"/>&quot;                        </xsl:otherwise>
             </xsl:choose>}                                        <xsl:if test="position()!=last()">,     </xsl:if>
          </xsl:for-each>                ]        </xsl:template>
       <xsl:template name="RANGE">
          <xsl:param name="RANGE_ID"/>                {<xsl:value-of select="$ID"/>
          <xsl:value-of select="$DELIVERY_BASE_URL"/>
          <xsl:value-of select="$URI_PREFIX"/>
          <xsl:value-of select="$PID"/>/range/<xsl:value-of select="$RANGE_ID"/>&quot;,                <xsl:value-of select="$TYPE"/>Range&quot;,                <xsl:value-of select="$LABEL"/>
          <xsl:value-of select="./@LABEL"/>&quot;,                <xsl:choose>
             <xsl:when test="./mets:div/@TYPE=&apos;FILE&apos;">                                &quot;items&quot;: [                                <xsl:for-each select="./mets:div">                                        &quot;<xsl:value-of select="$DELIVERY_BASE_URL"/>
                   <xsl:value-of select="$URI_PREFIX"/>
                   <xsl:value-of select="$PID"/>/canvas/<xsl:value-of select="./mets:fptr/@FILEID"/>&quot;                                        <xsl:if test="position()!=last()">, </xsl:if>
                </xsl:for-each>                                ],                                &quot;items&quot;: [                                <xsl:for-each select="./mets:div">                                        {                                        <xsl:value-of select="$ID"/>
                   <xsl:value-of select="$DELIVERY_BASE_URL"/>
                   <xsl:value-of select="$URI_PREFIX"/>
                   <xsl:value-of select="$PID"/>/canvas/<xsl:value-of select="./mets:fptr/@FILEID"/>&quot;,                                        <xsl:value-of select="$TYPE"/>Canvas&quot;,                                        <xsl:value-of select="$LABEL"/>
                   <xsl:value-of select="@LABEL"/>&quot;}                                        <xsl:if test="position()!=last()">,     </xsl:if>
                </xsl:for-each>                                ]                        </xsl:when>
             <xsl:otherwise>                                &quot;items&quot;: [                                <xsl:for-each select="./mets:div">                                &quot;<xsl:value-of select="$DELIVERY_BASE_URL"/>
                   <xsl:value-of select="$URI_PREFIX"/>
                   <xsl:value-of select="$PID"/>/range/<xsl:value-of select="concat($RANGE_ID,&apos;-&apos;,position())"/>&quot;                                        <xsl:if test="position()!=last()">,     </xsl:if>
                </xsl:for-each>                                ],                                &quot;items&quot;: [                                <xsl:for-each select="./mets:div">                                        {                                        <xsl:value-of select="$ID"/>
                   <xsl:value-of select="$DELIVERY_BASE_URL"/>
                   <xsl:value-of select="$URI_PREFIX"/>
                   <xsl:value-of select="$PID"/>/range/<xsl:value-of select="concat($RANGE_ID,&apos;-&apos;,position())"/>&quot;,                                        <xsl:value-of select="$TYPE"/>Range&quot;,                                        <xsl:value-of select="$LABEL"/>
                   <xsl:value-of select="@LABEL"/>&quot;}                                        <xsl:if test="position()!=last()">,     </xsl:if>
                </xsl:for-each>                                ]                                <xsl:for-each select="./mets:div">                                          } ,<xsl:call-template name="RANGE">
                      <xsl:with-param name="RANGE_ID" select="concat($RANGE_ID,&apos;-&apos;,position())"/>
                   </xsl:call-template>
                </xsl:for-each>
             </xsl:otherwise>
          </xsl:choose>
       </xsl:template>
    </xsl:stylesheet>

    <?xml version="1.0" encoding="ISO-8859-1"?>
    <xsl:stylesheet version="2.0"
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns:mets="http://www.loc.gov/METS/"
        xmlns:dc="http://purl.org/dc/elements/1.1/"
        xmlns:dcterms="http://purl.org/dc/terms/"
        xmlns:dnx="http://www.exlibrisgroup.com/dps/dnx">
        <xsl:output method="html" omit-xml-declaration="yes"/>
        <xsl:param name="isDownloadFile" />
        <xsl:variable name="PID"
            select="/mets:mets/mets:amdSec[@ID=$IE_AMD_ID]/mets:techMD/mets:mdWrap/mets:xmlData/dnx:dnx/dnx:section[@id='internalIdentifier']/dnx:record[dnx:key[@id='internalIdentifierType']='PID']/dnx:key[@id='internalIdentifierValue']" />
        <xsl:variable name="CONTEXT">"@context" : "http://iiif.io/api/presentation/2/context.json"</xsl:variable>
        <xsl:variable name="SERVICE_CONTEXT">"@context" : "http://iiif.io/api/image/2/context.json"</xsl:variable>
        <xsl:variable name="ID">"@id" : "</xsl:variable>
        <xsl:variable name="TYPE">"@type" : "</xsl:variable>
        <xsl:variable name="ON">"on" : "</xsl:variable>
        <xsl:variable name="DELIVERY_BASE_URL">baseURLPlaceHolderdelivery/</xsl:variable>
        <xsl:variable name="DOWNLOAD_FUNC">downloadFileFunc</xsl:variable>
        <xsl:variable name="IMAGE_SERVER_BASE_URL">imageServerBaseURLPlaceHolder</xsl:variable>
        <xsl:variable name="UI_CUSTOMIZATION">UIcustomizatioIDplaceHolder</xsl:variable>
        <xsl:variable name="URI_PREFIX">iiif/presentation/2.1/</xsl:variable>
        <xsl:variable name="IMAGE_SERVER_PREFIX">cantaloupe/iiif/2/</xsl:variable>
        <xsl:variable name="DVS">DVSplaceHolder</xsl:variable>
        <xsl:variable name="OBJECT_TYPE_IE">IE</xsl:variable>
        <xsl:variable name="OBJECT_TYPE_REPRESENTATION">REP</xsl:variable>
        <xsl:variable name="OBJECT_TYPE_FILE">FILE</xsl:variable>
        <xsl:variable name="LABEL">"label" : "</xsl:variable>
        <xsl:variable name="VALUE">"value" : "</xsl:variable>
        <xsl:variable name="IE_AMD_ID">ie-amd</xsl:variable>
        <xsl:variable name="IE_DMD_ID">ie-dmd</xsl:variable>
        <xsl:variable name="DESCRIPTION">"description": "</xsl:variable>
        <xsl:variable name="ATTRIBUTION">"attribution": "</xsl:variable>
        <xsl:variable name="METADATA">"metadata": [</xsl:variable>
        <xsl:variable name="LOGO">"logo": "</xsl:variable>
        <xsl:variable name="LICENSE">"license": "</xsl:variable>
        <xsl:variable name="THUMBNAIL">"thumbnail": "</xsl:variable>
        <xsl:variable name="MOTIVATION">"motivation": "sc:painting",</xsl:variable>
        <xsl:variable name="VIEWING_DIRECTION">"viewingDirection": </xsl:variable>
        <xsl:variable name="VIEWING_HINT">"viewingHint": </xsl:variable>
        <xsl:variable name="WIDTH">"width": </xsl:variable>
        <xsl:variable name="HEIGHT">"height": </xsl:variable>
        <xsl:variable name="WIDTH_PLACE_HOLDER">"widthPlaceholder</xsl:variable>
        <xsl:variable name="HEIGHT_PLACE_HOLDER">"heightPlaceholder</xsl:variable>
        <xsl:variable name="INFO_JSON">/info.json</xsl:variable>
        <xsl:variable name="FILE_FORMAT">"format": "</xsl:variable>
        <xsl:variable name="PROFILE">"profile": "http://iiif.io/api/image/2/level1.json" }</xsl:variable>

        <xsl:template match="/">
            {
            <xsl:call-template name="MANIFEST" />
            <xsl:call-template name="SEQUENCES" />
            <xsl:call-template name="RANGES" />
            }
        </xsl:template>

        <xsl:template name="IE_PROPERTY">
            <xsl:param name="DC_FIELD_NAME" />
            <xsl:param name="DCTERMS_FIELD_NAME" />
            <xsl:choose>
                <xsl:when test="/mets:mets/mets:dmdSec[@ID=$IE_DMD_ID]/mets:mdWrap/mets:xmlData/dc:record/*[name()=$DC_FIELD_NAME]">
                    <xsl:value-of select="/mets:mets/mets:dmdSec[@ID=$IE_DMD_ID]/mets:mdWrap/mets:xmlData/dc:record/*[name()=$DC_FIELD_NAME]" />
                </xsl:when>
                <xsl:when test="(//mets:dmdSec[@ID=$IE_DMD_ID]/mets:mdWrap/mets:xmlData/dc:record/*[name()=$DCTERMS_FIELD_NAME])[1]">
                    <xsl:value-of select="(//mets:dmdSec[@ID=$IE_DMD_ID]/mets:mdWrap/mets:xmlData/dc:record/*[name()=$DCTERMS_FIELD_NAME])[1]" />
                </xsl:when>
                <xsl:otherwise></xsl:otherwise>
            </xsl:choose>
        </xsl:template>

        <xsl:template name="IE_METADATA">
            <xsl:for-each select="/mets:mets/mets:dmdSec[@ID=$IE_DMD_ID]/mets:mdWrap/mets:xmlData/dc:record/dc:creator |
                                  /mets:mets/mets:dmdSec[@ID=$IE_DMD_ID]/mets:mdWrap/mets:xmlData/dc:record/dcterms:creator ">
                {<xsl:value-of select="$LABEL" />Author", <xsl:value-of select="$VALUE" />
                <xsl:value-of select="." />"}
                <xsl:if test="position()!=last() or count(//dc:subject) > 0 or count(//dcterms:subject) > 0">, </xsl:if>
            </xsl:for-each>
            <xsl:for-each select="/mets:mets/mets:dmdSec[@ID=$IE_DMD_ID]/mets:mdWrap/mets:xmlData/dc:record/dc:subject |
                                  /mets:mets/mets:dmdSec[@ID=$IE_DMD_ID]/mets:mdWrap/mets:xmlData/dc:record/dcterms:subject">
                {<xsl:value-of select="$LABEL" />Subject", <xsl:value-of select="$VALUE" />
             <xsl:value-of select="." />"}
             <xsl:if test="position()!=last()">, </xsl:if>
            </xsl:for-each>
            ]
        </xsl:template>

        <xsl:template name="MANIFEST">
            <xsl:value-of select="$CONTEXT" />,
            <xsl:value-of select="$ID" /><xsl:value-of select="$DELIVERY_BASE_URL" /><xsl:value-of select="$URI_PREFIX" /><xsl:value-of select="$PID" />/manifest",
            <xsl:value-of select="$TYPE" />sc:Manifest",
            <xsl:value-of select="$LABEL" />
            <xsl:call-template name="IE_PROPERTY">
                <xsl:with-param name="DC_FIELD_NAME" select='"dc:title"' />
                <xsl:with-param name="DCTERMS_FIELD_NAME" select='"dcterms:title"' />
            </xsl:call-template>",
            <xsl:value-of select="$DESCRIPTION" />
            <xsl:call-template name="IE_PROPERTY">
                <xsl:with-param name="DC_FIELD_NAME" select='"dc:description"' />
                <xsl:with-param name="DCTERMS_FIELD_NAME" select='"dcterms:description"' />
            </xsl:call-template>",
            <xsl:value-of select="$ATTRIBUTION" />
            <xsl:call-template name="IE_PROPERTY">
                <xsl:with-param name="DC_FIELD_NAME" select='"dc:rights"' />
                <xsl:with-param name="DCTERMS_FIELD_NAME" select='"dcterms:rights"' />
            </xsl:call-template>",
            <xsl:value-of select="$METADATA" />
            <xsl:call-template name="IE_METADATA" />,

            <xsl:choose>
                <xsl:when
                    test="/mets:mets/mets:amdSec[@ID='ie-amd']/mets:techMD[@ID='ie-amd-tech']/mets:mdWrap/mets:xmlData/dnx:dnx/dnx:section[@id='objectCharacteristics']/dnx:record/dnx:key[@id='owner']">
                    <xsl:value-of select="$LOGO" /><xsl:value-of select="$DELIVERY_BASE_URL" />images/<xsl:value-of select="$UI_CUSTOMIZATION" />/logo-main.png",
                    <xsl:value-of select="$LICENSE" /><xsl:value-of select="$DELIVERY_BASE_URL" />general/termsofuse.jsp?dps_dvs=DVSplaceHolder",
                </xsl:when>
                <xsl:otherwise>
                    <xsl:value-of select="$LOGO" /><xsl:value-of select="$DELIVERY_BASE_URL" />images/1/logo-main.png",
                    <xsl:value-of select="$LICENSE" /><xsl:value-of select="$DELIVERY_BASE_URL" />general/termsofuse.jsp",
                </xsl:otherwise>
            </xsl:choose>

            <xsl:value-of select="$THUMBNAIL" /><xsl:value-of select="$DELIVERY_BASE_URL" />DeliveryManagerServlet?dps_pid=<xsl:value-of select="$PID" />&amp;dps_func=thumbnail",
        </xsl:template>

        <xsl:template name="SEQUENCES">
            "sequences": [{
            <xsl:variable name="REP_ID">
                <xsl:value-of select="/mets:mets/mets:fileSec/mets:fileGrp/@ID" />
            </xsl:variable>
            <xsl:variable name="HAS_PHYSICAL_SM" select="count(/mets:mets/mets:structMap[upper-case(@TYPE)='PHYSICAL']) > 0" />
            <xsl:variable name="HAS_LOGICAL_SM" select="count(/mets:mets/mets:structMap[upper-case(@TYPE)='LOGICAL']) > 0" />
            <xsl:variable name="VIEWING_DIRECTION_VALUE">
                <xsl:choose>
                    <xsl:when test="/mets:mets/mets:dmdSec[@ID='ie-dmd']/mets:mdWrap/mets:xmlData/dc:record/dc:language='heb'">
                        "right-to-left"
                    </xsl:when>
                    <xsl:when test="/mets:mets/mets:dmdSec[@ID='ie-dmd']/mets:mdWrap/mets:xmlData/dc:record/dc:language='ara'">
                        "right-to-left"
                    </xsl:when>
                    <xsl:when test="/mets:mets/mets:dmdSec[@ID='ie-dmd']/mets:mdWrap/mets:xmlData/dc:record/dc:language='chi'">
                        "top-to-bottom"
                    </xsl:when>
                    <xsl:otherwise>
                        "left-to-right"
                    </xsl:otherwise>
                </xsl:choose>
            </xsl:variable>
            <xsl:variable name="VIEWING_HINT_VALUE">
                <xsl:choose>
                    <xsl:when
                        test="/mets:mets/mets:amdSec[@ID='ie-amd']/mets:techMD[@ID='ie-amd-tech']/mets:mdWrap/mets:xmlData/dnx:dnx/dnx:section[@id='generalIECharacteristics']/dnx:record/dnx:key[@id='IEEntityType']='Book'">
                        "paged",
                    </xsl:when>
                    <xsl:otherwise>
                        "individuals",
                    </xsl:otherwise>
                </xsl:choose>
            </xsl:variable>
            <xsl:value-of select="$ID" /><xsl:value-of select="$DELIVERY_BASE_URL" /><xsl:value-of select="$URI_PREFIX" /><xsl:value-of select="$PID" />/sequence/<xsl:value-of select="$REP_ID" />",
            <xsl:value-of select="$TYPE" />sc:Sequence",
            <xsl:value-of select="$LABEL" />
            <xsl:choose>
                <xsl:when test="$HAS_LOGICAL_SM = true()">
                    <xsl:value-of select="/mets:mets/mets:structMap[upper-case(@TYPE)='LOGICAL']/mets:div/mets:div/@LABEL" />",
                </xsl:when>
                <xsl:when test="$HAS_PHYSICAL_SM = true()">
                    <xsl:value-of select="/mets:mets/mets:structMap[upper-case(@TYPE)='PHYSICAL']/mets:div/mets:div/@LABEL" />",
                </xsl:when>
                <xsl:otherwise>
                    <xsl:value-of
                        select="/mets:mets/mets:amdSec[@ID=concat($REP_ID,'-amd')]/mets:techMD[@ID=concat($REP_ID,'-amd-tech')]/mets:mdWrap/mets:xmlData/dnx:dnx/dnx:section[@id='generalRepCharacteristics']/dnx:record/dnx:key[@id='label']" />",
                </xsl:otherwise>
            </xsl:choose>
            <xsl:value-of select="$VIEWING_DIRECTION" /><xsl:value-of select="$VIEWING_DIRECTION_VALUE" />,
            <xsl:value-of select="$VIEWING_HINT" /><xsl:value-of select="$VIEWING_HINT_VALUE" />
            "canvases": [
            <xsl:choose>
                <xsl:when test="$HAS_LOGICAL_SM = true()">
                    <xsl:for-each select="//mets:structMap[upper-case(@TYPE)='LOGICAL']/mets:div/mets:div/mets:div[@TYPE='FILE']">
                        {
                        <xsl:variable name="FILEID" select="./mets:fptr/@FILEID" />
                        <!-- <xsl:variable name="FILE_LABEL_LABEL" select="/mets:mets/mets:amdSec[@ID=concat($FILEID,'-amd')]/mets:techMD[@ID=concat($FILEID,'-amd-tech')]/mets:mdWrap/mets:xmlData/dnx:dnx/dnx:section[@id='generalFileCharacteristics']/dnx:record/dnx:key[@id='label']/text()" /> -->
                        <!-- <xsl:variable name="FILE_LABEL_NAME" select="(/mets:mets/mets:amdSec[@ID=concat($FILEID,'-amd')]/mets:techMD[@ID=concat($FILEID,'-amd-tech')]/mets:mdWrap/mets:xmlData/dnx:dnx/dnx:section[@id='generalFileCharacteristics']/dnx:record/dnx:key[@id='fileOriginalName'])[1]/text()" /> -->
                        <xsl:variable name="FILE_LABEL_LABEL" select="./@LABEL"/>
                        <xsl:variable name="FILE_LABEL_NAME" select="./@LABEL"/>
                        <xsl:variable name="FILE_SM_LABEL" select="//mets:div/@LABEL[./mets:fptr/@FILEID=$FILEID]" />
                        <xsl:call-template name="CANVAS">
                            <xsl:with-param name="FILE_ID" select="$FILEID" />
                            <xsl:with-param name="FILE_LABEL">
                                <xsl:choose>
                                    <xsl:when test="$FILE_SM_LABEL">
                                        <xsl:value-of select="$FILE_SM_LABEL" />
                                    </xsl:when>
                                    <xsl:when test="$FILE_LABEL_LABEL">
                                        <xsl:value-of select="$FILE_LABEL_LABEL" />
                                    </xsl:when>
                                    <xsl:when test="$FILE_LABEL_NAME">
                                        <xsl:value-of select="$FILE_LABEL_NAME" />
                                    </xsl:when>
                                    <xsl:otherwise></xsl:otherwise>
                                </xsl:choose>
                            </xsl:with-param>
                        </xsl:call-template>
                    </xsl:for-each>
                </xsl:when>
                <xsl:when test="$HAS_PHYSICAL_SM = true()">
                    <xsl:for-each select="//mets:structMap[upper-case(@TYPE)='PHYSICAL']/mets:div/mets:div/mets:div[@TYPE='FILE']">
                        {
                        <xsl:variable name="FILEID" select="./mets:fptr/@FILEID" />
                        <xsl:variable name="FILE_LABEL_LABEL"
                            select="/mets:mets/mets:amdSec[@ID=concat($FILEID,'-amd')]/mets:techMD[@ID=concat($FILEID,'-amd-tech')]/mets:mdWrap/mets:xmlData/dnx:dnx/dnx:section[@id='generalFileCharacteristics']/dnx:record/dnx:key[@id='label']/text()" />
                        <xsl:variable name="FILE_LABEL_NAME"
                            select="(/mets:mets/mets:amdSec[@ID=concat($FILEID,'-amd')]/mets:techMD[@ID=concat($FILEID,'-amd-tech')]/mets:mdWrap/mets:xmlData/dnx:dnx/dnx:section[@id='generalFileCharacteristics']/dnx:record/dnx:key[@id='fileOriginalName'])[1]/text()" />
                        <xsl:variable name="FILE_SM_LABEL" select="//mets:div/@LABEL[./mets:fptr/@FILEID=$FILEID]" />
                        <xsl:call-template name="CANVAS">
                            <xsl:with-param name="FILE_ID" select="$FILEID" />
                            <xsl:with-param name="FILE_LABEL">
                                <xsl:choose>
                                    <xsl:when test="$FILE_SM_LABEL">
                                        <xsl:value-of select="$FILE_SM_LABEL" />
                                    </xsl:when>
                                    <xsl:when test="$FILE_LABEL_LABEL">
                                        <xsl:value-of select="$FILE_LABEL_LABEL" />
                                    </xsl:when>
                                    <xsl:when test="$FILE_LABEL_NAME">
                                        <xsl:value-of select="$FILE_LABEL_NAME" />
                                    </xsl:when>
                                    <xsl:otherwise></xsl:otherwise>
                                </xsl:choose>
                            </xsl:with-param>
                        </xsl:call-template>
                    </xsl:for-each>
                </xsl:when>
                <xsl:otherwise>
                    <xsl:for-each select="//mets:fileGrp/mets:file">
                        {
                        <xsl:variable name="FILEID" select="./@ID" />
                        <xsl:variable name="FILE_LABEL_LABEL"
                            select="/mets:mets/mets:amdSec[@ID=concat($FILEID,'-amd')]/mets:techMD[@ID=concat($FILEID,'-amd-tech')]/mets:mdWrap/mets:xmlData/dnx:dnx/dnx:section[@id='generalFileCharacteristics']/dnx:record/dnx:key[@id='label']/text()" />
                        <xsl:variable name="FILE_LABEL_NAME"
                            select="(/mets:mets/mets:amdSec[@ID=concat($FILEID,'-amd')]/mets:techMD[@ID=concat($FILEID,'-amd-tech')]/mets:mdWrap/mets:xmlData/dnx:dnx/dnx:section[@id='generalFileCharacteristics']/dnx:record/dnx:key[@id='fileOriginalName'])[1]/text()" />
                        <xsl:call-template name="CANVAS">
                            <xsl:with-param name="FILE_ID" select="$FILEID" />
                            <xsl:with-param name="FILE_LABEL">
                                <xsl:choose>
                                    <xsl:when test="$FILE_LABEL_LABEL">
                                        <xsl:value-of select="$FILE_LABEL_LABEL" />
                                    </xsl:when>
                                    <xsl:when test="$FILE_LABEL_NAME">
                                        <xsl:value-of select="$FILE_LABEL_NAME" />
                                    </xsl:when>
                                    <xsl:otherwise></xsl:otherwise>
                                </xsl:choose>
                            </xsl:with-param>
                        </xsl:call-template>
                    </xsl:for-each>
                </xsl:otherwise>
            </xsl:choose>
        </xsl:template>

        <xsl:template name="CANVAS">
            <xsl:param name="FILE_ID" />
            <xsl:param name="FILE_LABEL" />
            <xsl:variable name="HEIGHT_VALUE"
                select="/mets:mets/mets:amdSec[@ID=concat($FILE_ID,'-amd')]/mets:techMD[@ID=concat($FILE_ID,'-amd-tech')]/mets:mdWrap/mets:xmlData/dnx:dnx/dnx:section/dnx:record[dnx:key[@id='significantPropertiesType']='nisoImage.imageLength']/dnx:key[@id='significantPropertiesValue']" />
            <xsl:variable name="WIDTH_VALUE"
                select="/mets:mets/mets:amdSec[@ID=concat($FILE_ID,'-amd')]/mets:techMD[@ID=concat($FILE_ID,'-amd-tech')]/mets:mdWrap/mets:xmlData/dnx:dnx/dnx:section/dnx:record[dnx:key[@id='significantPropertiesType']='nisoImage.imageWidth']/dnx:key[@id='significantPropertiesValue']" />
            <xsl:variable name="FILE_EXTANSION"
                select="/mets:mets/mets:amdSec[@ID=concat($FILE_ID,'-amd')]/mets:techMD[@ID=concat($FILE_ID,'-amd-tech')]/mets:mdWrap/mets:xmlData/dnx:dnx/dnx:section[@id='generalFileCharacteristics']/dnx:record/dnx:key[@id='fileExtension']" />
            <xsl:variable name="FILE_FORMAT_VALUE"
                select="/mets:mets/mets:amdSec[@ID=concat($FILE_ID,'-amd')]/mets:techMD[@ID=concat($FILE_ID,'-amd-tech')]/mets:mdWrap/mets:xmlData/dnx:dnx/dnx:section[@id='generalFileCharacteristics']/dnx:record/dnx:key[@id='fileMIMEType']" />
            <xsl:variable name="FILE_SIZE_VALUE"
                select="/mets:mets/mets:amdSec[@ID=concat($FILE_ID,'-amd')]/mets:techMD[@ID=concat($FILE_ID,'-amd-tech')]/mets:mdWrap/mets:xmlData/dnx:dnx/dnx:section[@id='generalFileCharacteristics']/dnx:record/dnx:key[@id='fileSizeBytes']" />
            <xsl:value-of select="$CONTEXT" />,
            <xsl:value-of select="$ID" /><xsl:value-of select="$DELIVERY_BASE_URL" /><xsl:value-of select="$URI_PREFIX" /><xsl:value-of select="$PID" />/canvas/<xsl:value-of select="$FILE_ID" />",
            <xsl:value-of select="$TYPE" />sc:Canvas",
            <xsl:value-of select="$LABEL" /><xsl:value-of select="$FILE_LABEL" />",
            <xsl:if test="$isDownloadFile = true()">
                "rendering": [{
                    <xsl:value-of select="$ID" /><xsl:value-of select="$DELIVERY_BASE_URL" />DeliveryManagerServlet?dps_pid=<xsl:value-of select="$FILE_ID" /><xsl:value-of select="$DOWNLOAD_FUNC" />",
                    <xsl:value-of select="$FILE_FORMAT" /><xsl:value-of select="$FILE_FORMAT_VALUE" />",
                    <xsl:value-of select="$LABEL" />Original file -     <xsl:value-of select="format-number($FILE_SIZE_VALUE div 1024 div 1024,'###,###,##0.00')"/>MB"
                }],
            </xsl:if>
            <xsl:value-of select="$THUMBNAIL" /><xsl:value-of select="$DELIVERY_BASE_URL" />DeliveryManagerServlet?dps_pid=<xsl:value-of select="$FILE_ID" />&amp;dps_func=thumbnail",
            <xsl:value-of select="$HEIGHT" />
    <xsl:choose>
      <xsl:when test="$HEIGHT_VALUE">
        <xsl:value-of select="$HEIGHT_VALUE" />,
          </xsl:when>
          <xsl:otherwise>
           <xsl:value-of select="$HEIGHT_PLACE_HOLDER" /><xsl:value-of select="$IMAGE_SERVER_BASE_URL" /><xsl:value-of select="$IMAGE_SERVER_PREFIX" /><xsl:value-of select="$PID" />:<xsl:value-of select="$FILE_ID" />.<xsl:value-of select="$FILE_EXTANSION" /><xsl:value-of select="$INFO_JSON" />",
          </xsl:otherwise>
    </xsl:choose>

    <xsl:value-of select="$WIDTH" />
    <xsl:choose>
      <xsl:when test="$WIDTH_VALUE">
        <xsl:value-of select="$WIDTH_VALUE" />,
          </xsl:when>
          <xsl:otherwise>
           <xsl:value-of select="$WIDTH_PLACE_HOLDER" /><xsl:value-of select="$IMAGE_SERVER_BASE_URL" /><xsl:value-of select="$IMAGE_SERVER_PREFIX" /><xsl:value-of select="$PID" />:<xsl:value-of select="$FILE_ID" />.<xsl:value-of select="$FILE_EXTANSION" /><xsl:value-of select="$INFO_JSON" />",
          </xsl:otherwise>
    </xsl:choose>
            "images": [{
            <xsl:value-of select="$CONTEXT" />,
            <xsl:value-of select="$ID" /><xsl:value-of select="$DELIVERY_BASE_URL" /><xsl:value-of select="$URI_PREFIX" /><xsl:value-of select="$PID" />/annotation/<xsl:value-of select="$FILE_ID" />",
            <xsl:value-of select="$TYPE" />oa:Annotation",
            <xsl:value-of select="$MOTIVATION" />
            "resource": {
            <xsl:value-of select="$ID" /><xsl:value-of select="$DELIVERY_BASE_URL" /><xsl:value-of select="$URI_PREFIX" /><xsl:value-of select="$PID" />/res/<xsl:value-of select="$FILE_ID" />.<xsl:value-of select="$FILE_EXTANSION" />",
            <xsl:value-of select="$TYPE" />dctypes:Image",
            <xsl:value-of select="$FILE_FORMAT" /><xsl:value-of select="$FILE_FORMAT_VALUE" />",
            "service": {
            <xsl:value-of select="$SERVICE_CONTEXT" />,
            <xsl:value-of select="$ID" /><xsl:value-of select="$IMAGE_SERVER_BASE_URL" /><xsl:value-of select="$IMAGE_SERVER_PREFIX" /><xsl:value-of select="$DVS" />:<xsl:value-of select="$FILE_ID" />.<xsl:value-of select="$FILE_EXTANSION" />",
            <xsl:value-of select="$PROFILE" />,
            <xsl:value-of select="$HEIGHT" />
    <xsl:choose>
      <xsl:when test="$HEIGHT_VALUE">
        <xsl:value-of select="$HEIGHT_VALUE" />,
          </xsl:when>
          <xsl:otherwise>
           <xsl:value-of select="$HEIGHT_PLACE_HOLDER" /><xsl:value-of select="$IMAGE_SERVER_BASE_URL" /><xsl:value-of select="$IMAGE_SERVER_PREFIX" /><xsl:value-of select="$PID" />:<xsl:value-of select="$FILE_ID" />.<xsl:value-of select="$FILE_EXTANSION" /><xsl:value-of select="$INFO_JSON" />",
          </xsl:otherwise>
    </xsl:choose>

    <xsl:value-of select="$WIDTH" />
    <xsl:choose>
      <xsl:when test="$WIDTH_VALUE">
        <xsl:value-of select="$WIDTH_VALUE" />
          </xsl:when>
          <xsl:otherwise>
           <xsl:value-of select="$WIDTH_PLACE_HOLDER" /><xsl:value-of select="$IMAGE_SERVER_BASE_URL" /><xsl:value-of select="$IMAGE_SERVER_PREFIX" /><xsl:value-of select="$PID" />:<xsl:value-of select="$FILE_ID" />.<xsl:value-of select="$FILE_EXTANSION" /><xsl:value-of select="$INFO_JSON" />"
          </xsl:otherwise>
    </xsl:choose>
                   },
             <xsl:value-of select="$ON" /><xsl:value-of select="$DELIVERY_BASE_URL" /><xsl:value-of select="$URI_PREFIX" /><xsl:value-of select="$PID" />/canvas/<xsl:value-of select="$FILE_ID" />"
                 }
              ]
             }
            <xsl:if test="position()!=last()">,
            </xsl:if>
        </xsl:template>
        <xsl:template name="RANGES">
               ]
              }
            ],
            "structures": [
            <xsl:for-each select="/mets:mets/mets:structMap[@TYPE='LOGICAL']/mets:div/mets:div">
                <xsl:choose>
                <xsl:when test="not(./@TYPE='FILE')">
                <xsl:call-template name="RANGE">
                    <xsl:with-param name="RANGE_ID" select="/mets:mets/mets:fileSec/mets:fileGrp/@ID" />
                </xsl:call-template>
                </xsl:when>
                <xsl:otherwise>
                 {<xsl:value-of select="$ID" /><xsl:value-of select="$DELIVERY_BASE_URL" /><xsl:value-of select="$URI_PREFIX" /><xsl:value-of select="$PID" />/canvas/<xsl:value-of select="./mets:fptr/@FILEID" />",
                    <xsl:value-of select="$TYPE" />sc:Canvas",
                  <xsl:value-of select="$LABEL" /><xsl:value-of select="@LABEL" />"
                </xsl:otherwise>
                </xsl:choose>}
                        <xsl:if test="position()!=last()">,    </xsl:if>
            </xsl:for-each>
            ]
        </xsl:template>

        <xsl:template name="RANGE">
            <xsl:param name="RANGE_ID" />
            {<xsl:value-of select="$ID" /><xsl:value-of select="$DELIVERY_BASE_URL" /><xsl:value-of select="$URI_PREFIX" /><xsl:value-of select="$PID" />/range/<xsl:value-of select="$RANGE_ID" />",
            <xsl:value-of select="$TYPE" />sc:Range",
            <xsl:value-of select="$LABEL" /><xsl:value-of select="./@LABEL" />",
            <xsl:choose>
                <xsl:when test="./mets:div/@TYPE='FILE'">
                    "canvases": [
                    <xsl:for-each select="./mets:div">
                        "<xsl:value-of select="$DELIVERY_BASE_URL" /><xsl:value-of select="$URI_PREFIX" /><xsl:value-of select="$PID" />/canvas/<xsl:value-of select="./mets:fptr/@FILEID" />"
                        <xsl:if test="position()!=last()">, </xsl:if>
                    </xsl:for-each>
                    ],
                    "members": [
                    <xsl:for-each select="./mets:div">
                        {
                        <xsl:value-of select="$ID" /><xsl:value-of select="$DELIVERY_BASE_URL" /><xsl:value-of select="$URI_PREFIX" /><xsl:value-of select="$PID" />/canvas/<xsl:value-of select="./mets:fptr/@FILEID" />",
                        <xsl:value-of select="$TYPE" />sc:Canvas",
                        <xsl:value-of select="$LABEL" /><xsl:value-of select="@LABEL" />"}
                        <xsl:if test="position()!=last()">,    </xsl:if>
                    </xsl:for-each>
                    ]
                </xsl:when>
                <xsl:otherwise>
                    "ranges": [
                    <xsl:for-each select="./mets:div">
                        "<xsl:value-of select="$DELIVERY_BASE_URL" /><xsl:value-of select="$URI_PREFIX" /><xsl:value-of select="$PID" />/range/<xsl:value-of select="concat($RANGE_ID,'-',position())" />"
                        <xsl:if test="position()!=last()">,    </xsl:if>
                    </xsl:for-each>
                    ],
                    "members": [
                    <xsl:for-each select="./mets:div">
                        {
                        <xsl:value-of select="$ID" /><xsl:value-of select="$DELIVERY_BASE_URL" /><xsl:value-of select="$URI_PREFIX" /><xsl:value-of select="$PID" />/range/<xsl:value-of select="concat($RANGE_ID,'-',position())" />",
                        <xsl:value-of select="$TYPE" />sc:Range",
                        <xsl:value-of select="$LABEL" /><xsl:value-of select="@LABEL" />"}
                        <xsl:if test="position()!=last()">,    </xsl:if>
                    </xsl:for-each>
                    ]
                    <xsl:for-each select="./mets:div">
                          } ,<xsl:call-template name="RANGE">
                            <xsl:with-param name="RANGE_ID" select="concat($RANGE_ID,'-',position())" />
                        </xsl:call-template>
                    </xsl:for-each>
                </xsl:otherwise>
            </xsl:choose>
        </xsl:template>

    </xsl:stylesheet>

     


    • Article last edited: 18-Apr-2022