<t:switch prioritized="true">
<html>
  {$goBackPage := "",
   $kontoPage := $orderedMagazinePage := $providedPage := $orderedPage := $requestedPage := (),
   if (get("first-login", false())) then (
     videlibri:delete-current-books(), 
     first-login := false()
     
   ) else (), 
   head(//tr[ends-with(normalize-space(th[1]), "Ausweis gültig bis")]/join(td)
        otherwise //dl/dt[normalize-space() = "Ausweis gültig bis"]/following-sibling::dd[1]
   )!($account-expiration := .) }
  <t:switch prioritized="true">
  <body>
    <t:switch>
    <td>Keine Ausleihen</td>
    <a t:condition="contains(., 'Ausleihe') and contains(@href, '&amp;sp=SZ')">{kontoPage := @href}</a>
    </t:switch>
  
    <t:element 
       t:optional="true"
       t:condition="(self::a or self::td) and contains(., 'Bestellung') and contains(., 'Magazin')">{orderedMagazinePage := descendant-or-self::a/@href}</t:element>
    
    <t:switch t:optional="true">
    <td>Keine Bereitstellung</td>
    <a t:condition="contains(., 'Bereitstellung')">{providedPage := @href}</a>
    </t:switch>
    
    <t:switch t:optional="true">
    <td>Keine Bestellwünsche</td>
    <a t:condition="contains(., 'Bestellw')">{orderedPage := @href}</a>
    </t:switch>
  
    <t:switch t:optional="true">
    <td>Keine Vormerkung</td>
    <a t:condition="contains(., 'Vormerkung')">{requestedPage := @href}</a>
    </t:switch>
  
  </body>
  
  <div id="konto-services">
    <t:switch>
      <li><a t:condition="contains(., 'Ausleihe')">{$kontoPage := local:aDISLink(., "*SZA")}</a></li>
      <li>Keine Ausleihe</li>
    </t:switch>
    {let $otherLinks := .//li/a[not(contains(., "Ausleihe")) and matches(., "[0-9]")]
     return
    $otherLinks/(
      if (contains(., "Vormerkung")) then $requestedPage := local:aDISLink(., "*SZM")
      else if (contains(., "Magazin")) then $orderedMagazinePage := local:aDISLink(., "*SZB")
      else if (contains(., "Bereitstellung")) then $providedPage := local:aDISLink(., "*SZS")
      else if (contains(., "Bestellw")) then $orderedPage := local:aDISLink(., "*SZW")
      else ()
    )}
    
  </div>
  
  </t:switch>
      <!--<t:s>kontoPage := extract(@href, "(.*)&amp;requestCount", 1),
           requestCount := extract(@href, "requestCount=([0-9]+)", 1)
      </t:s>-->
</html>      

<div class="message"><div id="R01"><h1>{vl:raise("Account-Fehlermeldung:" || .)}</h1></div></div>

</t:switch>
