| 
      
            Lines 5-18
          
      
      
        Link Here
      
     | 
  
        
          | 5 | 
            xmlns:marc="http://www.loc.gov/MARC21/slim"  | 
          5 | 
            xmlns:marc="http://www.loc.gov/MARC21/slim"  | 
        
        
          | 6 | 
            xmlns:items="http://www.koha-community.org/items"  | 
          6 | 
            xmlns:items="http://www.koha-community.org/items"  | 
        
        
          | 7 | 
            xmlns:xsl="http://www.w3.org/1999/XSL/Transform"  | 
          7 | 
            xmlns:xsl="http://www.w3.org/1999/XSL/Transform"  | 
        
            
               | 
               | 
              8 | 
                xmlns:exsl="http://exslt.org/common"  | 
            
        
          | 8 | 
            xmlns:str="http://exslt.org/strings"  | 
          9 | 
            xmlns:str="http://exslt.org/strings"  | 
        
          
            
              | 9 | 
                exclude-result-prefixes="marc items str">  | 
              10 | 
                exclude-result-prefixes="marc items str" extension-element-prefixes="exsl">  | 
            
        
          | 10 | 
              <xsl:import href="MARC21slimUtils.xsl"/>  | 
          11 | 
              <xsl:import href="MARC21slimUtils.xsl"/>  | 
        
        
          | 11 | 
              <xsl:output method = "html" indent="yes" omit-xml-declaration = "yes" encoding="UTF-8"/>  | 
          12 | 
              <xsl:output method = "html" indent="yes" omit-xml-declaration = "yes" encoding="UTF-8"/>  | 
        
            
               | 
               | 
              13 | 
               | 
            
        
          | 12 | 
              <xsl:key name="item-by-status" match="items:item" use="items:status"/>  | 
          14 | 
              <xsl:key name="item-by-status" match="items:item" use="items:status"/>  | 
        
            
              | 13 | 
                  <xsl:key name="item-by-status-and-branch-home" match="items:item" use="concat(items:status, ' ', items:homebranch)"/>  | 
               | 
               | 
            
            
              | 14 | 
                  <xsl:key name="item-by-status-and-branch-holding" match="items:item" use="concat(items:status, ' ', items:holdingbranch)"/>  | 
            
            
              | 15 | 
                  <xsl:key name="item-by-substatus-and-branch" match="items:item" use="concat(items:substatus, ' ', items:homebranch)"/>  | 
            
        
          | 16 | 
           | 
          15 | 
           | 
        
        
          | 17 | 
              <xsl:template match="/">  | 
          16 | 
              <xsl:template match="/">  | 
        
        
          | 18 | 
                      <xsl:apply-templates/>  | 
          17 | 
                      <xsl:apply-templates/>  | 
        
  
    | 
      
            Lines 24-29
          
      
      
        Link Here
      
     | 
  
        
          | 24 | 
                  <!-- Option: Display Alternate Graphic Representation (MARC 880)  -->  | 
          23 | 
                  <!-- Option: Display Alternate Graphic Representation (MARC 880)  -->  | 
        
        
          | 25 | 
                  <xsl:variable name="display880" select="boolean(marc:datafield[@tag=880])"/>  | 
          24 | 
                  <xsl:variable name="display880" select="boolean(marc:datafield[@tag=880])"/>  | 
        
        
          | 26 | 
           | 
          25 | 
           | 
        
            
               | 
               | 
              26 | 
                  <xsl:variable name="resultsMaxItems" select="number(marc:sysprefs/marc:syspref[@name='resultsMaxItems']+0)"/>  | 
            
            
              | 27 | 
                  <xsl:variable name="resultsMaxItemsUnavailable" select="number(marc:sysprefs/marc:syspref[@name='resultsMaxItemsUnavailable']+0)"/>  | 
            
        
          | 27 | 
              <xsl:variable name="UseControlNumber" select="marc:sysprefs/marc:syspref[@name='UseControlNumber']"/>  | 
          28 | 
              <xsl:variable name="UseControlNumber" select="marc:sysprefs/marc:syspref[@name='UseControlNumber']"/>  | 
        
        
          | 28 | 
              <xsl:variable name="UseAuthoritiesForTracings" select="marc:sysprefs/marc:syspref[@name='UseAuthoritiesForTracings']"/>  | 
          29 | 
              <xsl:variable name="UseAuthoritiesForTracings" select="marc:sysprefs/marc:syspref[@name='UseAuthoritiesForTracings']"/>  | 
        
        
          | 29 | 
              <xsl:variable name="OPACResultsLibrary" select="marc:sysprefs/marc:syspref[@name='OPACResultsLibrary']"/>  | 
          30 | 
              <xsl:variable name="OPACResultsLibrary" select="marc:sysprefs/marc:syspref[@name='OPACResultsLibrary']"/>  | 
        
  
    | 
      
            Lines 36-42
          
      
      
        Link Here
      
     | 
  
        
          | 36 | 
              <xsl:variable name="AlternateHoldingsSubfields" select="substring(marc:sysprefs/marc:syspref[@name='AlternateHoldingsField'], 4)"/>  | 
          37 | 
              <xsl:variable name="AlternateHoldingsSubfields" select="substring(marc:sysprefs/marc:syspref[@name='AlternateHoldingsField'], 4)"/>  | 
        
        
          | 37 | 
              <xsl:variable name="AlternateHoldingsSeparator" select="marc:sysprefs/marc:syspref[@name='AlternateHoldingsSeparator']"/>  | 
          38 | 
              <xsl:variable name="AlternateHoldingsSeparator" select="marc:sysprefs/marc:syspref[@name='AlternateHoldingsSeparator']"/>  | 
        
        
          | 38 | 
              <xsl:variable name="OPACItemLocation" select="marc:sysprefs/marc:syspref[@name='OPACItemLocation']"/>  | 
          39 | 
              <xsl:variable name="OPACItemLocation" select="marc:sysprefs/marc:syspref[@name='OPACItemLocation']"/>  | 
        
            
              | 39 | 
                  <xsl:variable name="singleBranchMode" select="marc:sysprefs/marc:syspref[@name='singleBranchMode']"/>  | 
               | 
               | 
            
        
          | 40 | 
              <xsl:variable name="OPACTrackClicks" select="marc:sysprefs/marc:syspref[@name='TrackClicks']"/>  | 
          40 | 
              <xsl:variable name="OPACTrackClicks" select="marc:sysprefs/marc:syspref[@name='TrackClicks']"/>  | 
        
        
          | 41 | 
              <xsl:variable name="BiblioDefaultView" select="marc:sysprefs/marc:syspref[@name='BiblioDefaultView']"/>  | 
          41 | 
              <xsl:variable name="BiblioDefaultView" select="marc:sysprefs/marc:syspref[@name='BiblioDefaultView']"/>  | 
        
        
          | 42 | 
                  <xsl:variable name="leader" select="marc:leader"/>  | 
          42 | 
                  <xsl:variable name="leader" select="marc:leader"/>  | 
        
  
    | 
      
            Lines 1250-1507
          
      
      
        Link Here
      
     | 
  
        
          | 1250 | 
                  <!-- Availability line -->  | 
          1250 | 
                  <!-- Availability line -->  | 
        
        
          | 1251 | 
                  <span class="results_summary availability">  | 
          1251 | 
                  <span class="results_summary availability">  | 
        
        
          | 1252 | 
                      <span class="label">Availability: </span>  | 
          1252 | 
                      <span class="label">Availability: </span>  | 
        
            
              | 1253 | 
                          <xsl:variable name="sumAv" select="count(key('item-by-status', 'available'))"/> | 
               | 
               | 
            
            
              | 1254 | 
                          <xsl:variable name="sumRef" select="count(key('item-by-status', 'reference'))"/> | 
            
        
          | 1255 | 
           | 
          1253 | 
           | 
        
        
          | 1256 | 
                      <xsl:choose>  | 
          1254 | 
                      <xsl:choose>  | 
        
            
               | 
               | 
              1255 | 
                              <!-- When there are no items, try alternate holdings -->  | 
            
        
          | 1257 | 
                          <xsl:when test="$itemcount=0">  | 
          1256 | 
                          <xsl:when test="$itemcount=0">  | 
        
          
            
              | 1258 | 
                                      <xsl:choose>  | 
              1257 | 
                                  <xsl:choose>  | 
            
            
              | 1259 | 
                                          <xsl:when test="string-length($AlternateHoldingsField)=3 and marc:datafield[@tag=$AlternateHoldingsField]">  | 
              1258 | 
                                      <xsl:when test="string-length($AlternateHoldingsField)=3 and marc:datafield[@tag=$AlternateHoldingsField]">  | 
            
            
              | 1260 | 
                                          <xsl:variable name="AlternateHoldingsCount" select="count(marc:datafield[@tag=$AlternateHoldingsField])"/>  | 
              1259 | 
                                      <xsl:variable name="AlternateHoldingsCount" select="count(marc:datafield[@tag=$AlternateHoldingsField])"/>  | 
            
            
              | 1261 | 
                                          <xsl:for-each select="marc:datafield[@tag=$AlternateHoldingsField][1]">  | 
              1260 | 
                                      <xsl:for-each select="marc:datafield[@tag=$AlternateHoldingsField][1]">  | 
            
            
              | 1262 | 
                                              <xsl:call-template name="subfieldSelect">  | 
              1261 | 
                                          <xsl:call-template name="subfieldSelect">  | 
            
            
              | 1263 | 
                                                  <xsl:with-param name="codes"><xsl:value-of select="$AlternateHoldingsSubfields"/></xsl:with-param>  | 
              1262 | 
                                              <xsl:with-param name="codes"><xsl:value-of select="$AlternateHoldingsSubfields"/></xsl:with-param>  | 
            
            
              | 1264 | 
                                                  <xsl:with-param name="delimeter"><xsl:value-of select="$AlternateHoldingsSeparator"/></xsl:with-param>  | 
              1263 | 
                                              <xsl:with-param name="delimeter"><xsl:value-of select="$AlternateHoldingsSeparator"/></xsl:with-param>  | 
            
            
              | 1265 | 
                                              </xsl:call-template>  | 
              1264 | 
                                          </xsl:call-template>  | 
            
            
              | 1266 | 
                                          </xsl:for-each>  | 
               | 
               | 
            
            
              | 1267 | 
                                          (<xsl:value-of select="$AlternateHoldingsCount"/>)  | 
            
            
              | 1268 | 
                                          </xsl:when>  | 
            
            
              | 1269 | 
                                          <xsl:otherwise><span class="noitems">No items available.</span> </xsl:otherwise>  | 
            
            
              | 1270 | 
                                      </xsl:choose>  | 
            
            
              | 1271 | 
                              </xsl:when>  | 
            
            
              | 1272 | 
                              <xsl:when test="$sumAv>0">  | 
            
            
              | 1273 | 
                                 <span class="available reallyavailable">  | 
            
            
              | 1274 | 
                                     <span class="AvailabilityLabel"><strong><xsl:text>Items available for loan: </xsl:text></strong></span>  | 
            
            
              | 1275 | 
                                     <xsl:variable name="available_items"  | 
            
            
              | 1276 | 
                                         select="key('item-by-status', 'available')"/> | 
            
            
              | 1277 | 
                                 <xsl:choose>  | 
            
            
              | 1278 | 
                                 <xsl:when test="$singleBranchMode=1">  | 
            
            
              | 1279 | 
                                      <xsl:for-each select="$available_items[generate-id() = generate-id(key('item-by-status-and-branch-home', concat(items:status, ' ', items:homebranch))[1])]"> | 
            
            
              | 1280 | 
                                         <span class="ItemSummary">  | 
            
            
              | 1281 | 
                                             <xsl:value-of select="count(key('item-by-status-and-branch-home', concat(items:status, ' ', items:homebranch)))"/><xsl:text> </xsl:text> | 
            
            
              | 1282 | 
                                             <xsl:if test="items:itemcallnumber != '' and items:itemcallnumber and $OPACItemLocation='callnum'">  | 
            
            
              | 1283 | 
                                                 <span class="CallNumberAndLabel">  | 
            
            
              | 1284 | 
                                                      <span class="LabelCallNumber">Call number: </span>  | 
            
            
              | 1285 | 
                                                      <span class="CallNumber"><xsl:value-of select="items:itemcallnumber"/><xsl:if test="count(key('item-by-status-and-branch-home', concat(items:status, ' ', items:homebranch)))>1"><xsl:text>, ..</xsl:text></xsl:if></span> | 
            
            
              | 1286 | 
                                                 </span>  | 
            
            
              | 1287 | 
                                             </xsl:if>  | 
            
            
              | 1288 | 
                                             <xsl:choose>  | 
            
            
              | 1289 | 
                                                 <xsl:when test="position()=last()"><xsl:text>. </xsl:text></xsl:when>  | 
            
            
              | 1290 | 
                                                 <xsl:otherwise><xsl:text>, </xsl:text></xsl:otherwise>  | 
            
            
              | 1291 | 
                                             </xsl:choose>  | 
            
            
              | 1292 | 
                                          </span>  | 
            
        
          | 1293 | 
                                  </xsl:for-each>  | 
          1265 | 
                                  </xsl:for-each>  | 
        
          
            
              | 1294 | 
                                 </xsl:when>  | 
              1266 | 
                                      (<xsl:value-of select="$AlternateHoldingsCount"/>)  | 
            
            
              | 1295 | 
                                 <xsl:otherwise>  | 
              1267 | 
                                      </xsl:when>  | 
            
            
              | 1296 | 
                                     <xsl:choose>  | 
              1268 | 
                                      <xsl:otherwise><span class="noitems">No items available.</span> </xsl:otherwise>  | 
            
            
              | 1297 | 
                                          <xsl:when test="$OPACResultsLibrary='homebranch'">  | 
              1269 | 
                                  </xsl:choose>  | 
            
            
              | 1298 | 
                                             <xsl:for-each select="$available_items[generate-id() = generate-id(key('item-by-status-and-branch-home', concat(items:status, ' ', items:homebranch))[1])]"> | 
               | 
               | 
            
            
              | 1299 | 
                                                 <span class="ItemSummary">  | 
            
            
              | 1300 | 
                                                     <span class="ItemBranch"><xsl:value-of select="items:homebranch"/> </span>  | 
            
            
              | 1301 | 
                                                     <xsl:text> (</xsl:text>  | 
            
            
              | 1302 | 
                                                         <xsl:value-of select="count(key('item-by-status-and-branch-home', concat(items:status, ' ', items:homebranch)))"/> | 
            
            
              | 1303 | 
                                                     <xsl:text>) </xsl:text>  | 
            
            
              | 1304 | 
                                                     <xsl:if test="items:itemcallnumber != '' and items:itemcallnumber and $OPACItemLocation='callnum'">  | 
            
            
              | 1305 | 
                                                         <span class="CallNumberAndLabel">  | 
            
            
              | 1306 | 
                                                              <span class="LabelCallNumber">Call number: </span>  | 
            
            
              | 1307 | 
                                                              <span class="CallNumber"><xsl:value-of select="items:itemcallnumber"/><xsl:if test="count(key('item-by-status-and-branch-holding', concat(items:status, ' ', items:holdingbranch)))>1"><xsl:text>, ..</xsl:text></xsl:if></span> | 
            
            
              | 1308 | 
                                                         </span>  | 
            
            
              | 1309 | 
                                                     </xsl:if>  | 
            
            
              | 1310 | 
                                                     <xsl:choose>  | 
            
            
              | 1311 | 
                                                         <xsl:when test="position()=last()"><xsl:text>. </xsl:text></xsl:when>  | 
            
            
              | 1312 | 
                                                         <xsl:otherwise><xsl:text>, </xsl:text></xsl:otherwise>  | 
            
            
              | 1313 | 
                                                     </xsl:choose>  | 
            
            
              | 1314 | 
                                                 </span>  | 
            
            
              | 1315 | 
                                             </xsl:for-each>  | 
            
            
              | 1316 | 
                                          </xsl:when>  | 
            
            
              | 1317 | 
                                          <xsl:otherwise>  | 
            
            
              | 1318 | 
                                             <xsl:for-each select="$available_items[generate-id() = generate-id(key('item-by-status-and-branch-holding', concat(items:status, ' ', items:holdingbranch))[1])]"> | 
            
            
              | 1319 | 
                                                 <span class="ItemSummary">  | 
            
            
              | 1320 | 
                                                     <span class="ItemBranch"><xsl:value-of select="items:holdingbranch"/> </span>  | 
            
            
              | 1321 | 
                                                     <xsl:text> (</xsl:text>  | 
            
            
              | 1322 | 
                                                         <xsl:value-of select="count(key('item-by-status-and-branch-holding', concat(items:status, ' ', items:holdingbranch)))"/> | 
            
            
              | 1323 | 
                                                     <xsl:text>) </xsl:text>  | 
            
            
              | 1324 | 
                                                     <xsl:if test="items:itemcallnumber != '' and items:itemcallnumber and $OPACItemLocation='callnum'">  | 
            
            
              | 1325 | 
                                                         <span class="CallNumberAndLabel">  | 
            
            
              | 1326 | 
                                                              <span class="LabelCallNumber">Call number: </span>  | 
            
            
              | 1327 | 
                                                              <span class="CallNumber"><xsl:value-of select="items:itemcallnumber"/><xsl:if test="count(key('item-by-status-and-branch-home', concat(items:status, ' ', items:homebranch)))>1"><xsl:text>, ..</xsl:text></xsl:if></span> | 
            
            
              | 1328 | 
                                                         </span>  | 
            
            
              | 1329 | 
                                                     </xsl:if>  | 
            
            
              | 1330 | 
                                                     <xsl:choose>  | 
            
            
              | 1331 | 
                                                         <xsl:when test="position()=last()"><xsl:text>. </xsl:text></xsl:when>  | 
            
            
              | 1332 | 
                                                         <xsl:otherwise><xsl:text>, </xsl:text></xsl:otherwise>  | 
            
            
              | 1333 | 
                                                     </xsl:choose>  | 
            
            
              | 1334 | 
                                                 </span>  | 
            
            
              | 1335 | 
                                             </xsl:for-each>  | 
            
            
              | 1336 | 
                                          </xsl:otherwise>  | 
            
            
              | 1337 | 
                                      </xsl:choose>  | 
            
            
              | 1338 | 
                                  </xsl:otherwise>  | 
            
            
              | 1339 | 
                              </xsl:choose>  | 
            
            
              | 1340 | 
                              </span>  | 
            
        
          | 1341 | 
                          </xsl:when>  | 
          1270 | 
                          </xsl:when>  | 
        
            
              | 1342 | 
                          </xsl:choose>  | 
               | 
               | 
            
        
          | 1343 | 
           | 
          1271 | 
           | 
        
          
            
              | 1344 | 
                          <xsl:choose>  | 
              1272 | 
                              <xsl:otherwise>  | 
            
            
              | 1345 | 
                              <xsl:when test="$sumRef>0">  | 
              1273 | 
                                  <xsl:variable name="sumAv" select="count(key('item-by-status', 'available'))"/> | 
            
            
              | 1346 | 
                                  <span class="available reference">  | 
              1274 | 
                                  <xsl:variable name="sumRef" select="count(key('item-by-status', 'reference'))"/> | 
            
            
              | 1347 | 
                                     <span class="AvailabilityLabel"><strong><xsl:text>Items available for reference: </xsl:text></strong></span>  | 
              1275 | 
               | 
            
            
              | 1348 | 
                                      <xsl:variable name="reference_items" select="key('item-by-status', 'reference')"/> | 
              1276 | 
                                  <!-- Availability part 1: ITEMS FOR LOAN -->  | 
            
            
              | 1349 | 
                                      <xsl:for-each select="$reference_items[generate-id() = generate-id(key('item-by-substatus-and-branch', concat(items:substatus, ' ', items:homebranch))[1])]"> | 
              1277 | 
                                  <xsl:if test="$sumAv>0"><span class="available reallyavailable">  | 
            
            
              | 1350 | 
                                          <span>  | 
              1278 | 
                                      <span class="AvailabilityLabel"><strong><xsl:text>Items available for loan: </xsl:text></strong></span>  | 
            
            
              | 1351 | 
                                              <xsl:attribute name="class">  | 
              1279 | 
                                      <xsl:variable name="available_items" select="key('item-by-status', 'available')"/> | 
            
            
              | 1352 | 
                                                  ItemSummary  | 
              1280 | 
                                      <!-- group by branch, see also pref OPACResultsLibrary -->  | 
            
            
              | 1353 | 
                                                  <xsl:value-of select="translate(items:substatus,' ','_')"/>  | 
              1281 | 
                                      <xsl:for-each select="$available_items[not(items:resultbranch=preceding-sibling::*[items:status='available']/items:resultbranch)]">  | 
            
            
              | 1354 | 
                                              </xsl:attribute>  | 
              1282 | 
                                          <xsl:sort select="items:resultbranch"/>  | 
            
            
              | 1355 | 
                                              <xsl:if test="$singleBranchMode=0">  | 
              1283 | 
                                          <xsl:variable name="currentbranch" select="items:resultbranch"/>  | 
            
            
              | 1356 | 
                                                  <span class="ItemBranch"><xsl:value-of select="items:homebranch"/><xsl:text> </xsl:text></span>  | 
              1284 | 
                                          <span class="ItemSummary">  | 
            
            
              | 1357 | 
                                              </xsl:if>  | 
              1285 | 
                                          <xsl:call-template name="listCallNumbers">  | 
            
            
              | 1358 | 
                                              <span class='notforloandesc'><xsl:value-of select="items:substatus"/></span>  | 
              1286 | 
                                              <xsl:with-param name="items" select="$available_items[items:resultbranch=$currentbranch]"/>  | 
            
            
              | 1359 | 
                                              <xsl:text> (</xsl:text>  | 
              1287 | 
                                              <xsl:with-param name="max" select="$resultsMaxItems"/>  | 
            
            
              | 1360 | 
                                              <xsl:value-of select="count(key('item-by-substatus-and-branch', concat(items:substatus, ' ', items:homebranch)))"/> | 
              1288 | 
                                              <xsl:with-param name="status_text" select="$currentbranch"/>  | 
            
            
              | 1361 | 
                                              <xsl:text>) </xsl:text>  | 
              1289 | 
                                              <xsl:with-param name="class_status" select="ItemBranch"/>  | 
            
            
              | 1362 | 
                                              <xsl:if test="items:itemcallnumber != '' and items:itemcallnumber and $OPACItemLocation='callnum'">  | 
              1290 | 
                                              <xsl:with-param name="OPACItemLocation" select="$OPACItemLocation"/>  | 
            
            
              | 1363 | 
                                                  <span class="CallNumberAndLabel">  | 
              1291 | 
                                          </xsl:call-template>  | 
            
            
              | 1364 | 
                                                      <span class="LabelCallNumber">Call number: </span>  | 
               | 
               | 
            
            
              | 1365 | 
                                                      <span class="CallNumber"><xsl:value-of select="items:itemcallnumber"/><xsl:if test="count(key('item-by-substatus-and-branch', concat(items:substatus, ' ', items:homebranch)))>1"><xsl:text>, ..</xsl:text></xsl:if></span> | 
            
            
              | 1366 | 
                                                  </span>  | 
            
            
              | 1367 | 
                                              </xsl:if>  | 
            
            
              | 1368 | 
                                              <xsl:choose><xsl:when test="position()=last()"><xsl:text>. </xsl:text></xsl:when><xsl:otherwise><xsl:text>, </xsl:text></xsl:otherwise></xsl:choose>  | 
            
        
          | 1369 | 
                                      </span>  | 
          1292 | 
                                      </span>  | 
        
        
          | 1370 | 
                                  </xsl:for-each>  | 
          1293 | 
                                  </xsl:for-each>  | 
        
          
            
              | 1371 | 
                                  </span>  | 
              1294 | 
                                  </span></xsl:if>  | 
            
            
              | 1372 | 
                              </xsl:when>  | 
               | 
               | 
            
            
              | 1373 | 
                          </xsl:choose>  | 
            
        
          | 1374 | 
           | 
          1295 | 
           | 
        
          
            
              | 1375 | 
                          <xsl:choose>  | 
              1296 | 
                                  <!-- Availability part 2: ITEMS FOR REFERENCE (see also pref Reference_NFL_Statuses) -->  | 
            
            
              | 1376 | 
                              <xsl:when test="number($sumAv+$sumRef) < number($itemcount)">  | 
              1297 | 
                                  <xsl:if test="$sumRef>0"><span class="available reference">  | 
            
            
              | 1377 | 
                                  <span class="unavailable">  | 
              1298 | 
                                      <span class="AvailabilityLabel"><strong><xsl:text>Items available for reference: </xsl:text></strong></span>  | 
            
            
              | 1378 | 
                                      <span class="AvailabilityLabel"><strong><xsl:text>Not available: </xsl:text></strong></span>  | 
              1299 | 
                                      <xsl:variable name="reference_items" select="key('item-by-status', 'reference')"/> | 
            
            
               | 
               | 
              1300 | 
                                      <!-- group by branch, then by substatus -->  | 
            
            
              | 1301 | 
                                      <xsl:for-each select="$reference_items[not(items:resultbranch=preceding-sibling::*[items:status='reference']/items:resultbranch)]">  | 
            
            
              | 1302 | 
                                          <xsl:sort select="items:resultbranch"/>  | 
            
            
              | 1303 | 
                                          <xsl:variable name="currentbranch" select="items:resultbranch"/>  | 
            
            
              | 1304 | 
                                          <xsl:for-each select="$reference_items[not(items:substatus=preceding-sibling::*[items:status='reference']/items:substatus)]">  | 
            
            
              | 1305 | 
                                              <xsl:sort select="items:substatus"/>  | 
            
            
              | 1306 | 
                                              <xsl:variable name="current_substatus" select="items:substatus"/>  | 
            
            
              | 1307 | 
                                              <span class="ItemSummary">  | 
            
            
              | 1308 | 
                                              <xsl:call-template name="listCallNumbers">  | 
            
            
              | 1309 | 
                                                  <xsl:with-param name="items" select="$reference_items[items:resultbranch=$currentbranch and items:substatus=$current_substatus]"/>  | 
            
            
              | 1310 | 
                                                  <xsl:with-param name="max" select="$resultsMaxItems"/>  | 
            
            
              | 1311 | 
                                                  <xsl:with-param name="status_text" select="concat($currentbranch,': ',$current_substatus)"/>  | 
            
            
              | 1312 | 
                                                  <xsl:with-param name="class_block" select="concat('notforloandesc_',$current_substatus)"/> | 
            
            
              | 1313 | 
                                                  <xsl:with-param name="class_status" select="ItemBranch"/>  | 
            
            
              | 1314 | 
                                                  <xsl:with-param name="OPACItemLocation" select="$OPACItemLocation"/>  | 
            
            
              | 1315 | 
                                              </xsl:call-template>  | 
            
            
              | 1316 | 
                                              </span>  | 
            
            
              | 1317 | 
                                          </xsl:for-each>  | 
            
            
              | 1318 | 
                                      </xsl:for-each>  | 
            
            
              | 1319 | 
                                  </span></xsl:if>  | 
            
        
          | 1379 | 
           | 
          1320 | 
           | 
        
          
            
              | 1380 | 
                                      <!-- First the remaining not for loan categories -->  | 
              1321 | 
                                  <!-- Availability part 3: UNAVAILABLE ITEMS (see also pref Reference_NFL_Statuses); status reallynotforloan or status other -->  | 
            
            
              | 1381 | 
                                      <xsl:variable name="unavailable_items" select="key('item-by-status', 'reallynotforloan')"/> | 
              1322 | 
                                  <xsl:if test="number($sumAv+$sumRef) < number($itemcount)"><span class="unavailable">  | 
            
            
              | 1382 | 
                                      <xsl:for-each select="$unavailable_items[not(./items:substatus=preceding-sibling::*/items:substatus)]">  | 
              1323 | 
                                      <span class="AvailabilityLabel"><strong><xsl:text>Not available: </xsl:text></strong></span>  | 
            
            
               | 
               | 
              1324 | 
                                      <xsl:variable name="other_status_list">  | 
            
            
              | 1325 | 
                                          <status english="Checked out">Checked out</status>  | 
            
            
              | 1326 | 
                                          <status english="Withdrawn">Withdrawn</status>  | 
            
            
              | 1327 | 
                                          <status english="Lost">Lost</status>  | 
            
            
              | 1328 | 
                                          <status english="Damaged">Damaged</status>  | 
            
            
              | 1329 | 
                                          <status english="Pending hold">Pending hold</status>  | 
            
            
              | 1330 | 
                                          <status english="In transit">In transit</status>  | 
            
            
              | 1331 | 
                                          <status english="Waiting">On hold</status>  | 
            
            
              | 1332 | 
                                      </xsl:variable>  | 
            
            
              | 1333 | 
                                      <xsl:variable name="unavailable_items" select="key('item-by-status', 'reallynotforloan')|key('item-by-status', 'other')"/> | 
            
            
              | 1334 | 
                                      <!-- First group by branch -->  | 
            
            
              | 1335 | 
                                      <xsl:for-each select="items:items/items:item[not(items:resultbranch=preceding-sibling::*/items:resultbranch)]">  | 
            
            
              | 1336 | 
                                          <xsl:sort select="items:resultbranch"/>  | 
            
            
              | 1337 | 
                                          <xsl:variable name="currentbranch" select="items:resultbranch"/>  | 
            
        
          | 1383 | 
                                      <span class="ItemSummary unavailable">  | 
          1338 | 
                                      <span class="ItemSummary unavailable">  | 
        
          
            
              | 1384 | 
                                              <span class='notforloandesc'><xsl:value-of select="items:substatus"/></span>  | 
              1339 | 
                                          <!-- Within same branch, group by substatus -->  | 
            
            
              | 1385 | 
                                              <xsl:text> (</xsl:text>  | 
              1340 | 
                                          <xsl:for-each select="$unavailable_items[not(items:substatus=preceding-sibling::*[items:status='reallynotforloan' or items:status='other']/items:substatus)]">  | 
            
            
              | 1386 | 
                                              <xsl:value-of select="count(parent::*/items:item/items:substatus[ text() = current()/items:substatus  ])"/>  | 
              1341 | 
                                              <xsl:sort select="items:substatus"/>  | 
            
            
              | 1387 | 
                                              <xsl:text>)</xsl:text>  | 
              1342 | 
                                              <xsl:variable name="current_substatus" select="items:substatus"/>  | 
            
            
              | 1388 | 
                                              <xsl:choose><xsl:when test="position()=last()"><xsl:text>. </xsl:text></xsl:when><xsl:otherwise><xsl:text>, </xsl:text></xsl:otherwise></xsl:choose>  | 
              1343 | 
                                                  <xsl:call-template name="listCallNumbers">  | 
            
            
               | 
               | 
              1344 | 
                                                      <xsl:with-param name="items" select="$unavailable_items[items:resultbranch=$currentbranch and items:substatus=$current_substatus]"/>  | 
            
            
              | 1345 | 
                                                      <xsl:with-param name="max" select="$resultsMaxItemsUnavailable"/>  | 
            
            
              | 1346 | 
                                                      <xsl:with-param name="status_text">  | 
            
            
              | 1347 | 
                                                          <xsl:value-of select="$currentbranch"/>  | 
            
            
              | 1348 | 
                                                          <xsl:text>: </xsl:text>  | 
            
            
              | 1349 | 
                                                          <xsl:if test="items:status='other'">  | 
            
            
              | 1350 | 
                                                              <xsl:value-of select="exsl:node-set($other_status_list)/status[@english=$current_substatus]"/>  | 
            
            
              | 1351 | 
                                                          </xsl:if>  | 
            
            
              | 1352 | 
                                                          <xsl:if test="items:status='reallynotforloan'">  | 
            
            
              | 1353 | 
                                                              <xsl:value-of select="$current_substatus"/>  | 
            
            
              | 1354 | 
                                                          </xsl:if>  | 
            
            
              | 1355 | 
                                                      </xsl:with-param>  | 
            
            
              | 1356 | 
                                                      <xsl:with-param name="class_block" select="concat('unavailable_',items:substatus)"/> | 
            
            
              | 1357 | 
                                                      <xsl:with-param name="class_status" select="ItemBranch"/>  | 
            
            
              | 1358 | 
                                                      <xsl:with-param name="OPACItemLocation" select="$OPACItemLocation"/>  | 
            
            
              | 1359 | 
                                                  </xsl:call-template>  | 
            
            
              | 1360 | 
                                          </xsl:for-each>  | 
            
        
          | 1389 | 
                                      </span>  | 
          1361 | 
                                      </span>  | 
        
        
          | 1390 | 
                                  </xsl:for-each>  | 
          1362 | 
                                  </xsl:for-each>  | 
        
            
               | 
               | 
              1363 | 
                                  </span></xsl:if>  | 
            
        
          | 1391 | 
           | 
          1364 | 
           | 
        
          
            
              | 1392 | 
                                      <!-- Followed by other statuses -->  | 
              1365 | 
                              </xsl:otherwise>  | 
            
            
              | 1393 | 
                                      <xsl:if test="count(key('item-by-status', 'Checked out'))>0"> | 
               | 
               | 
            
            
              | 1394 | 
                                          <span class="unavailable">  | 
            
            
              | 1395 | 
                                              <xsl:text>Checked out (</xsl:text>  | 
            
            
              | 1396 | 
                                              <xsl:value-of select="count(key('item-by-status', 'Checked out'))"/> | 
            
            
              | 1397 | 
                                              <xsl:text>). </xsl:text>  | 
            
            
              | 1398 | 
                                          </span>  | 
            
            
              | 1399 | 
                                      </xsl:if>  | 
            
            
              | 1400 | 
                                      <xsl:if test="count(key('item-by-status', 'Withdrawn'))>0"> | 
            
            
              | 1401 | 
                                          <span class="unavailable">  | 
            
            
              | 1402 | 
                                              <xsl:text>Withdrawn (</xsl:text>  | 
            
            
              | 1403 | 
                                              <xsl:value-of select="count(key('item-by-status', 'Withdrawn'))"/> | 
            
            
              | 1404 | 
                                              <xsl:text>). </xsl:text>  | 
            
            
              | 1405 | 
                                          </span>  | 
            
            
              | 1406 | 
                                      </xsl:if>  | 
            
            
              | 1407 | 
                                      <xsl:if test="$hidelostitems='0' and count(key('item-by-status', 'Lost'))>0"> | 
            
            
              | 1408 | 
                                          <span class="unavailable">  | 
            
            
              | 1409 | 
                                              <xsl:text>Lost (</xsl:text>  | 
            
            
              | 1410 | 
                                              <xsl:value-of select="count(key('item-by-status', 'Lost'))"/> | 
            
            
              | 1411 | 
                                              <xsl:text>). </xsl:text>  | 
            
            
              | 1412 | 
                                          </span>  | 
            
            
              | 1413 | 
                                      </xsl:if>  | 
            
            
              | 1414 | 
                                      <xsl:if test="count(key('item-by-status', 'Damaged'))>0"> | 
            
            
              | 1415 | 
                                          <span class="unavailable">  | 
            
            
              | 1416 | 
                                              <xsl:text>Damaged (</xsl:text>  | 
            
            
              | 1417 | 
                                              <xsl:value-of select="count(key('item-by-status', 'Damaged'))"/> | 
            
            
              | 1418 | 
                                              <xsl:text>). </xsl:text>  | 
            
            
              | 1419 | 
                                          </span>  | 
            
            
              | 1420 | 
                                      </xsl:if>  | 
            
            
              | 1421 | 
                                      <xsl:if test="count(key('item-by-status', 'Pending hold'))>0"> | 
            
            
              | 1422 | 
                                          <span class="unavailable">  | 
            
            
              | 1423 | 
                                              <xsl:text>Pending hold (</xsl:text>  | 
            
            
              | 1424 | 
                                              <xsl:value-of select="count(key('item-by-status', 'Pending hold'))"/> | 
            
            
              | 1425 | 
                                              <xsl:text>). </xsl:text>  | 
            
            
              | 1426 | 
                                          </span>  | 
            
            
              | 1427 | 
                                      </xsl:if>  | 
            
            
              | 1428 | 
                                      <xsl:if test="count(key('item-by-status', 'In transit'))>0"> | 
            
            
              | 1429 | 
                                          <span class="unavailable">  | 
            
            
              | 1430 | 
                                              <xsl:text>In transit (</xsl:text>  | 
            
            
              | 1431 | 
                                              <xsl:value-of select="count(key('item-by-status', 'In transit'))"/> | 
            
            
              | 1432 | 
                                              <xsl:text>). </xsl:text>  | 
            
            
              | 1433 | 
                                          </span>  | 
            
            
              | 1434 | 
                                      </xsl:if>  | 
            
            
              | 1435 | 
                                      <xsl:if test="count(key('item-by-status', 'Waiting'))>0"> | 
            
            
              | 1436 | 
                                          <span class="unavailable">  | 
            
            
              | 1437 | 
                                              <xsl:text>On hold (</xsl:text>  | 
            
            
              | 1438 | 
                                              <xsl:value-of select="count(key('item-by-status', 'Waiting'))"/> | 
            
            
              | 1439 | 
                                              <xsl:text>). </xsl:text>  | 
            
            
              | 1440 | 
                                          </span>  | 
            
            
              | 1441 | 
                                      </xsl:if>  | 
            
            
              | 1442 | 
                                  </span>  | 
            
            
              | 1443 | 
                              </xsl:when>  | 
            
        
          | 1444 | 
                      </xsl:choose>  | 
          1366 | 
                      </xsl:choose>  | 
        
        
          | 1445 | 
                  </span>  | 
          1367 | 
                  </span>  | 
        
        
          | 1446 | 
                  <!-- End of Availability line -->  | 
          1368 | 
                  <!-- End of Availability line -->  | 
        
        
          | 1447 | 
           | 
          1369 | 
           | 
        
            
              | 1448 | 
                      <!-- Location line -->  | 
               | 
               | 
            
            
              | 1449 | 
                      <xsl:choose>  | 
            
            
              | 1450 | 
                          <xsl:when test="($OPACItemLocation='location' or $OPACItemLocation='ccode') and (count(key('item-by-status', 'available'))!=0 or count(key('item-by-status', 'reference'))!=0)"> | 
            
            
              | 1451 | 
                              <span class="results_summary location">  | 
            
            
              | 1452 | 
               | 
            
            
              | 1453 | 
                              <xsl:choose>  | 
            
            
              | 1454 | 
                                  <xsl:when test="$OPACItemLocation='location'">  | 
            
            
              | 1455 | 
                                      <span class="label">Location(s): </span>  | 
            
            
              | 1456 | 
                                  </xsl:when>  | 
            
            
              | 1457 | 
                                  <xsl:when test="$OPACItemLocation='ccode'">  | 
            
            
              | 1458 | 
                                      <span class="label">Collection(s): </span>  | 
            
            
              | 1459 | 
                                  </xsl:when>  | 
            
            
              | 1460 | 
                              </xsl:choose>  | 
            
            
              | 1461 | 
               | 
            
            
              | 1462 | 
                              <xsl:choose>  | 
            
            
              | 1463 | 
                              <xsl:when test="count(key('item-by-status', 'available'))>0"> | 
            
            
              | 1464 | 
                                  <span class="available">  | 
            
            
              | 1465 | 
                                      <xsl:variable name="available_items" select="key('item-by-status', 'available')"/> | 
            
            
              | 1466 | 
                                      <xsl:for-each select="$available_items[generate-id() = generate-id(key('item-by-status-and-branch-home', concat(items:status, ' ', items:homebranch))[1])]"> | 
            
            
              | 1467 | 
                                          <xsl:choose>  | 
            
            
              | 1468 | 
                                              <xsl:when test="$OPACItemLocation='location'"><strong><xsl:value-of select="concat(items:location,' ')"/></strong></xsl:when>  | 
            
            
              | 1469 | 
                                              <xsl:when test="$OPACItemLocation='ccode'"><strong><xsl:value-of select="concat(items:ccode,' ')"/></strong></xsl:when>  | 
            
            
              | 1470 | 
                                          </xsl:choose>  | 
            
            
              | 1471 | 
                                          <xsl:if test="items:itemcallnumber != '' and items:itemcallnumber">  | 
            
            
              | 1472 | 
                                              <span class="CallNumberAndLabel">  | 
            
            
              | 1473 | 
                                                  <span class="LabelCallNumber">Call number: </span>  | 
            
            
              | 1474 | 
                                                  <span class="CallNumber"><xsl:value-of select="items:itemcallnumber"/></span>  | 
            
            
              | 1475 | 
                                              </span>  | 
            
            
              | 1476 | 
                                          </xsl:if>  | 
            
            
              | 1477 | 
                                          <xsl:choose><xsl:when test="position()=last()"><xsl:text>. </xsl:text></xsl:when><xsl:otherwise><xsl:text>, </xsl:text></xsl:otherwise></xsl:choose>  | 
            
            
              | 1478 | 
                                      </xsl:for-each>  | 
            
            
              | 1479 | 
                                  </span>  | 
            
            
              | 1480 | 
                              </xsl:when>  | 
            
            
              | 1481 | 
                              <xsl:when test="count(key('item-by-status', 'reference'))>0"> | 
            
            
              | 1482 | 
                                  <span class="available">  | 
            
            
              | 1483 | 
                                      <xsl:variable name="reference_items" select="key('item-by-status', 'reference')"/> | 
            
            
              | 1484 | 
                                      <xsl:for-each select="$reference_items[generate-id() = generate-id(key('item-by-status-and-branch-home', concat(items:status, ' ', items:homebranch))[1])]"> | 
            
            
              | 1485 | 
                                          <xsl:choose>  | 
            
            
              | 1486 | 
                                              <xsl:when test="$OPACItemLocation='location'"><strong><xsl:value-of select="concat(items:location,' ')"/></strong></xsl:when>  | 
            
            
              | 1487 | 
                                              <xsl:when test="$OPACItemLocation='ccode'"><strong><xsl:value-of select="concat(items:ccode,' ')"/></strong></xsl:when>  | 
            
            
              | 1488 | 
                                          </xsl:choose>  | 
            
            
              | 1489 | 
                                          <xsl:if test="items:itemcallnumber != '' and items:itemcallnumber">  | 
            
            
              | 1490 | 
                                              <span class="CallNumberAndLabel">  | 
            
            
              | 1491 | 
                                                  <span class="LabelCallNumber">Call number: </span>  | 
            
            
              | 1492 | 
                                                  <span class="CallNumber"><xsl:value-of select="items:itemcallnumber"/></span>  | 
            
            
              | 1493 | 
                                              </span>  | 
            
            
              | 1494 | 
                                          </xsl:if>  | 
            
            
              | 1495 | 
                                          <xsl:choose><xsl:when test="position()=last()"><xsl:text>. </xsl:text></xsl:when><xsl:otherwise><xsl:text>, </xsl:text></xsl:otherwise></xsl:choose>  | 
            
            
              | 1496 | 
                                      </xsl:for-each>  | 
            
            
              | 1497 | 
                                  </span>  | 
            
            
              | 1498 | 
                              </xsl:when>  | 
            
            
              | 1499 | 
                              </xsl:choose>  | 
            
            
              | 1500 | 
                              </span>  | 
            
            
              | 1501 | 
                          </xsl:when>  | 
            
            
              | 1502 | 
                      </xsl:choose>  | 
            
            
              | 1503 | 
                      <!-- End of Location line -->  | 
            
            
              | 1504 | 
               | 
            
        
          | 1505 | 
              </xsl:template>  | 
          1370 | 
              </xsl:template>  | 
        
        
          | 1506 | 
           | 
          1371 | 
           | 
        
        
          | 1507 | 
              <xsl:template name="nameABCQ">  | 
          1372 | 
              <xsl:template name="nameABCQ">  | 
        
  
    | 
      
            Lines 1598-1601
          
      
      
        Link Here
      
     | 
  
        
          | 1598 | 
                  </xsl:if>  | 
          1463 | 
                  </xsl:if>  | 
        
        
          | 1599 | 
              </xsl:template>  | 
          1464 | 
              </xsl:template>  | 
        
        
          | 1600 | 
           | 
          1465 | 
           | 
        
            
               | 
               | 
              1466 | 
                  <xsl:template name="listCallNumbers">  | 
            
            
              | 1467 | 
                      <xsl:param name="items"/>  | 
            
            
              | 1468 | 
                      <xsl:param name="max"/>  | 
            
            
              | 1469 | 
                      <xsl:param name="status_text"/>  | 
            
            
              | 1470 | 
                      <xsl:param name="class_block"/>  | 
            
            
              | 1471 | 
                      <xsl:param name="class_status"/>  | 
            
            
              | 1472 | 
                      <xsl:param name="OPACItemLocation"/>  | 
            
            
              | 1473 | 
                      <xsl:if test="count($items)>0">  | 
            
            
              | 1474 | 
                          <span class="$class_block">  | 
            
            
              | 1475 | 
                              <span class="$class_status"><xsl:value-of select="$status_text"/></span>  | 
            
            
              | 1476 | 
                              <xsl:text> (</xsl:text>  | 
            
            
              | 1477 | 
                              <xsl:value-of select="count($items)"/>  | 
            
            
              | 1478 | 
                              <xsl:text>)</xsl:text>  | 
            
            
              | 1479 | 
                              <xsl:if test="$max>0 and $OPACItemLocation!='library'">  | 
            
            
              | 1480 | 
                                  <span class="CallNumberAndLabel">  | 
            
            
              | 1481 | 
                                  <span class="LabelCallNumber">  | 
            
            
              | 1482 | 
                                      <xsl:if test="$OPACItemLocation='callnum'">Call number: </xsl:if>  | 
            
            
              | 1483 | 
                                      <xsl:if test="$OPACItemLocation='ccode'">Collection code, call number: </xsl:if>  | 
            
            
              | 1484 | 
                                      <xsl:if test="$OPACItemLocation='location'">Location, call number: </xsl:if>  | 
            
            
              | 1485 | 
                                  </span>  | 
            
            
              | 1486 | 
                                  <span class="CallNumber">  | 
            
            
              | 1487 | 
                                  <xsl:for-each select="$items[position() <= $max]">  | 
            
            
              | 1488 | 
                                      <xsl:if test="$OPACItemLocation='location'">  | 
            
            
              | 1489 | 
                                          <strong><xsl:value-of select="concat(items:location,' ')"/></strong>  | 
            
            
              | 1490 | 
                                      </xsl:if>  | 
            
            
              | 1491 | 
                                      <xsl:if test="$OPACItemLocation='ccode'">  | 
            
            
              | 1492 | 
                                          <strong><xsl:value-of select="concat(items:ccode,' ')"/></strong>  | 
            
            
              | 1493 | 
                                      </xsl:if>  | 
            
            
              | 1494 | 
                                      <xsl:value-of select="items:itemcallnumber"/><xsl:if test="position()!=last()"><xsl:text>, </xsl:text></xsl:if>  | 
            
            
              | 1495 | 
                                  </xsl:for-each>  | 
            
            
              | 1496 | 
                                  <xsl:if test="count($items)>$max"><xsl:text>, ..</xsl:text></xsl:if>  | 
            
            
              | 1497 | 
                                  </span>  | 
            
            
              | 1498 | 
                                  </span>  | 
            
            
              | 1499 | 
                              </xsl:if>  | 
            
            
              | 1500 | 
                              <xsl:text>. </xsl:text>  | 
            
            
              | 1501 | 
                          </span>  | 
            
            
              | 1502 | 
                      </xsl:if>  | 
            
            
              | 1503 | 
                  </xsl:template>  | 
            
            
              | 1504 | 
               | 
            
            
              | 1505 | 
               | 
            
        
          | 1601 | 
          </xsl:stylesheet>  | 
          1506 | 
          </xsl:stylesheet>  | 
        
            
              | 1602 | 
              -   | 
               | 
               |