<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
                xmlns:msxsl="urn:schemas-microsoft-com:xslt"
                xmlns:fclt="http://facilitor.nl/xsltools">
    <xsl:import href="./printFG.xsl"/>

  <xsl:output method="html" encoding="windows-1252" indent="yes"/>
  <xsl:decimal-format name="european" decimal-separator="," grouping-separator="."/>

  <xsl:param name="mode"/>
  <xsl:param name="srtnotificatiecode"/>

  <xsl:variable name="DefRev">
    <xsl:value-of select="substring(translate('$Revision$', '$ ', ''), 10)"/>
  </xsl:variable>
  <xsl:variable name="Rev">0</xsl:variable>

  <xsl:variable name="PRJ_AFDELING_THEMA_KEY">-1</xsl:variable>
  <xsl:variable name="PRJ_ONDERHANDEN_THEMA_KEY">-1</xsl:variable>
  <xsl:variable name="PRJ_BEWONER_LABEL_KEY">-1</xsl:variable>
  <xsl:variable name="PRJ_IMAGE_URL">../cad/mySlnk2IMG.asp</xsl:variable>
  <xsl:variable name="FacilitorRoot"><xsl:value-of select="//header/custId"/>.facilitor.nl</xsl:variable>

  <xsl:template name="escape">
    <xsl:param name="b"/>
    <xsl:if test="$b=''"/>
    <xsl:if test="$b!=''">
      <xsl:if test="substring($b,1,1)='&gt;'">
        <xsl:text disable-output-escaping="yes">&gt;</xsl:text>
      </xsl:if>
      <xsl:if test="substring($b,1,1)='&lt;'">
        <xsl:text disable-output-escaping="yes">&lt;</xsl:text>
      </xsl:if>
      <xsl:if test="substring($b,1,1)!='&gt;' and substring($b,1,1)!='&lt;'">
        <xsl:value-of select="substring($b,1,1)"/>
      </xsl:if>
      <xsl:call-template name="escape">
        <xsl:with-param name="b">
          <xsl:value-of select="substring($b,2)"/>
        </xsl:with-param>
      </xsl:call-template>
    </xsl:if>
  </xsl:template>

  <xsl:template name="linebreaks">
    <xsl:param name="string"/>
    <xsl:param name="escaping"/>
    <xsl:choose>
      <xsl:when test="contains($string, '&#xA;')">
        <xsl:choose>
          <xsl:when test="$escaping='no'">
            <xsl:value-of select="substring-before($string, '&#xA;')" disable-output-escaping="yes"/>
          </xsl:when>
          <xsl:otherwise>
            <xsl:value-of select="substring-before($string, '&#xA;')"/>
          </xsl:otherwise>
        </xsl:choose>
        <br/>
        <xsl:call-template name="linebreaks">
          <xsl:with-param name="string" select="substring-after($string, '&#xA;')"/>
          <xsl:with-param name="escaping" select="$escaping"/>
        </xsl:call-template>
      </xsl:when>
      <xsl:otherwise>
        <xsl:choose>
          <xsl:when test="$escaping='no'">
            <xsl:value-of select="$string" disable-output-escaping="yes"/>
          </xsl:when>
          <xsl:otherwise>
            <xsl:value-of select="$string"/>
          </xsl:otherwise>
        </xsl:choose>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <msxsl:script language="JScript" implements-prefix="fclt">
<![CDATA[
    String.prototype.format = function() {
        var args = arguments;
        return this.replace(/\{(\d+)\}/gi, function (match, d) {
            return args.length > d ? args[d] : match;
        });
    };

    var safe = {
        nvl: function (x)
        {
            if (x == null)
                return "";
            else
                return String(x);
        },
        vcalendar: function (waarde)
        {
            return safe.nvl(waarde)
                       .replace(/\\/g, '\\')
                       .replace(/;/g, '\;')
                       .replace(/,/g, '\,')
                       .replace(/[\r\n]/g, '\\n');
        },
        vcalendar_param: function (waarde)
        {
            return '"'
                  + safe.nvl(waarde)
                        .replace(/[\r\n]\s*/g, ' ')
                        .replace(/"/g, '')
                  + '"';
        },
        html: function (waarde)
        {
            // Heeft XSLT hier niet een handigere truc voor?
            return safe.nvl(waarde).replace(/&/g, '&amp;')
                                   .replace(/</g, '&lt;')
                                   .replace(/>/g, '&gt;')
                                   .replace(/\n/g, '<br>')
        },
        htmlattr: function (waarde)
        {
            return safe.nvl(waarde).replace(/\'/g, '&#39;')
                                   .replace(/\"/g, '&#34;');
        }
    };

     /* Voor iCalender property waarden */
    function safe_vCal(nodelist)
    {
        if (!nodelist.length)
            return nodelist;
        var waarde = nodelist.nextNode().text;
        return safe.vcalendar(waarde);
    }

     /* Voor iCalender property parameter waarden */
    function safe_vCal_param(nodelist)
    {
        if (!nodelist.length)
            return nodelist;
        var waarde = nodelist.nextNode().text;
        return safe.vcalendar_param(waarde);
    }

    // Let op: deze functie lijkt veel op shared.inc/safe.fclthtml
    //         belangrijkste verschil is dat we hier geen \r in de tekst tegenkomen
    //         wat enkele regexp's iets anders maakt
    function fclthtml(nodelist, module, key) {

        if (!nodelist.length)
            return nodelist;

        var waarde = nodelist.nextNode().text;

        var safepairs = "h1,h2,h3,h4,h5,h6,b,i,u,s,em,strong,small,big,th,td,tr,table,pre,code".split(",");
        var safehtml = safe.html(waarde); // Let op: vervangt *alle* \n door <br>. Dat gaan we deels later nog terugdraaien
                                          // We hebben het wel *nodig* omdat .* niet over meerdere regels werkt (hoewel dat
                                          // weer oplosbaar schijnt te zijn met [\s\S])

        // Checking for [link] url (|optionaltext) [/link]
        //           or [url]  url (|optionaltext) [/url]
        var strre = "\\[(link|url)\\](.*?)\\[\\/(?:\\1)\\]";
        var allowedLinkRegex = new RegExp("^((ftp|http|https):\\/\\/|(mailto|tel):)", "i"); // S("allowedLinkRegex")
        var matched = waarde.match(new RegExp(strre, "gi"));
        if (matched != null)
        {
          var url = "";
          var label = "";
          for (var i = 0; i < matched.length; i++)
          {
            var groups = matched[i].match(new RegExp(strre, "i")); // Zonder 'g'lobal-flag
            if (groups)
            {
              // groups[1] = "link" of "url" (wordt verder niet gebruikt)
              // groups[2] = url (|optionaltext)
              var result = groups[2].split("|");
              if (result.length > 0)
              {
                var safe_url = safe.htmlattr(result[0]);
                if (result.length > 2)
                {
                  result.shift();
                  label = result.join("|");
                }
                else if (result.length == 2)
                  label = result[1];
                else
                  label = result[0];

                if (safe_url.match(allowedLinkRegex))
                    safehtml = safehtml.replace(safe.html(matched[i]), "<a href=\"" + safe_url + "\" target=\"_blank\" rel=\"noopener noreferrer\">" + safe.html(label) + "</a>");
              }
            }
          }
        }

        // Checking for [mention] prs_key | prs_name [/mention] as used in notes
        // Deze strippen we ipv parsen, je bent het immers zelf
        strre = "\\[mention\\](\\d+)\\|(.+?)\\[\\/mention]";
        var matched = waarde.match(new RegExp(strre, "gi"));
        if (matched != null)
        {
          for (var i = 0; i < matched.length; i++)
          {
            var groups = matched[i].match(new RegExp(strre, "i")); // Zonder 'g'lobal-flag
            if (groups)
            { // groups[1] = prs_key
              // groups[2] = prs_name
              safehtml = safehtml.replace(safe.html(matched[i]), "@" + safe.html(groups[2]));
            }
          }
        }

        // Checking for [img] src [/img]
        // Deze strippen we ipv parsen, da's net wat makkelijker
        strre = "\\[img\\]([\\S\\s]*?)\\[\\/img\\]";
        matched = safehtml.match(new RegExp(strre, "gi"));
        if (matched != null) {
          for (var i = 0; i < matched.length; i++) {
            var groups = matched[i].match(new RegExp(strre, "i")); // Zonder 'g'lobal-flag
            if (groups) {
              if (module && key) {
                var filename = groups[1];
                var frc = '<img frc="M=' + module + ':K=' + key + ':F=' + encodeURIComponent(filename) + '"/>';
                safehtml = safehtml.replace(matched[i], frc);
              } else { // Dan maar strippen
                safehtml = safehtml.replace(matched[i], "[Image]");
              }
            }
          }
        }

        for (var i = 0; i < safepairs.length; i++)
        {
            var code = safepairs[i];
            var strre = "\\[{0}\\](.*?)\\[\\/{0}\\]".format(code); // De ? maakt de .* lazy (ipv greedy)
            var strnew = "<" + code + ">$1</" + code + ">";
            var re = new RegExp(strre, "g");
            var safehtml = safehtml.replace(re, strnew);
        }

        // Checking for [color=#]
        var strre = "\\[color=([#][0-9a-fA-F]{6})\\]([^\\[]*)|\\[\\/color\\]".format(code);
        var strnew = "<span style='color:$1;'>$2</span>";
        var re = new RegExp(strre, "g");
        var safehtml = safehtml.replace(re, strnew);

        // Nu de <br>'s binnen de tabel terugzetten. Let op dat ze *binnen* <td>'s weer wel moeten blijven
        // TODO: Kan dit beter?
        if (safehtml.indexOf("<table>") > -1)
        {
            var tablepairs = "th,td,tr,table".split(",");
            for (var i = 0; i < tablepairs.length; i++)
            {
                var code = tablepairs[i];
                var re = new RegExp("<{0}>(<br>)+".format(code), "g");
                var safehtml = safehtml.replace(re, "<" + code + ">");
                var re = new RegExp("</{0}>(<br>)+".format(code), "g");
                var safehtml = safehtml.replace(re, "</" + code + ">");
            }
        }

        // Nu de <br>'s binnen <pre> terugzetten
        var matches = safehtml.match(/<pre(?:.*?)>(?:.*?)<\/pre>/g);
        if (!matches)
            matches = safehtml.match(/<code(?:.*?)>(?:.*?)<\/code>/g);
        if (matches)
        {
            var len = matches.length;
            var i;
            for (i = 0; i < len; i++)
            {
                var pre = matches[i];
                pre = pre.replace(/<br(?:.*?)>/g, '\r');  // een \n wordt toch een <br>?
                safehtml = safehtml.replace(matches[i], pre);
            }
        }
        return safehtml;
   }
]]>
  </msxsl:script>

  <xsl:template name="stylesheet">
    <style>body {
       font-family: Verdana;
       background-color: rgb(255, 255, 255);
       margin-left:8px;
       margin-top:8px;
       cursor: auto;
       color: #000;
       font-size: 9pt;
    }

    table {
      border: 0;
      border-collapse: collapse;
      padding:2px;
    }

    table.details {
      background-color: #31398C;
    }

    th {
      font-family: Verdana;
      font-size: 9pt;
      font-weight: normal;
      color: #ffffff;
      text-decoration: none;
      padding-left:  3px;
      padding-right: 3px;
      padding-top: 3px;
      padding-bottom: 3px;
      background-color: #31398C;
    }

    th.resth, th.besth {
      font-family: Verdana;
      font-size: 9pt;
      font-weight: normal;
      color: #000;
      text-decoration: none;
      padding-left:  3px;
      padding-right: 3px;
      padding-top: 3px;
      padding-bottom: 3px;
      background-color: #fff;
    }

    td, p {
      font-family: Verdana;
      font-style: normal;
      font-size: 8pt;
      font-weight: normal;
      color:  #000000;
      text-align: left;
      vertical-align: top;
    }

    td.result {
      text-decoration: none;
      padding-bottom: 2px;
      padding-top: 2px;
      padding-left: 2px;
      padding-right: 2px;
      background-color: #f0f0f0;
    }

    td.resresult, td.besresult {
      text-decoration: none;
      padding-bottom: 2px;
      padding-top: 2px;
      padding-left: 2px;
      padding-right: 2px;
      background-color: #fff;
    }

    td.kenmerklabel {
      text-decoration: none;
      font-style: italic;
      padding-bottom: 2px;
      padding-top: 2px;
      padding-left: 20px;
      padding-right: 2px;
      background-color: #fff;
    }

    td.kenmerkvalue {
      text-decoration: none;
      font-style: italic;
      padding-bottom: 2px;
      padding-top: 2px;
      padding-left: 20px;
      padding-right: 2px;
      background-color: #fff;
    }

    td.sec_heading {
      font-size: 9pt;
      text-decoration: none;
      padding-bottom: 2px;
      padding-top: 2px;
      padding-left: 2px;
      padding-right: 2px;
      text-align: left;
      background-color: #d0d0d0;
    }

    td.caption {
      font-size:   18pt;
      padding-bottom: 30px;
      padding-top: 40px;
    }

    td.subcaption {
      font-size: 10pt;
      font-weight: bold;
      text-decoration: underline;
    }

    td.label {
      font-size: 10pt;
    }

    td.value {
      font-style: italic;
      font-size: 10pt;
    }

    td.tekst {
      font-size: 10pt;
    }

    td.adres {
      font-size: 8pt;
      text-align: right;
    }

    td.tekstkop {
      font-weight: bold;
      font-size: 10pt;
    }

    td.tiny, span.tiny {
      font-size: 6pt;
      text-align: right;
    }
    .fatal {
       background-color: red;
       color: white;
       font-weight: bold;
       padding-left: 2px;
       padding-right: 2px;
    }
    pre, xmp, code {
        font-style: normal;
        white-space: pre;
        display:block;
    }
    .mldbeh {color: #666;}
     a {
         text-decoration: none;
         color: #6685AE;
     }
     a:hover{text-decoration: underline;}
     hr {color: #6685AE;}

     @media print {
         .noprint { display: none; }
     }
    </style>
  </xsl:template>

  <xsl:template name="htmlhead">
    <head>
      <!--Generic FACILITOR HTML head for ANY report-->
      <meta http-equiv="pragma" content="no-cache"/>
      <meta http-equiv="expires" content="0"/>
      <meta http-equiv="cache-control" content="no-cache"/>
      <title><xsl:value-of select="//lcl/FAC/facilitorformulier"/></title>
      <xsl:call-template name="stylesheet"/>
    </head>
  </xsl:template>

  <xsl:template name="pageheader">
    <table border="0" width="100%">
      <tr>
        <td width="34%" bordercolor="#FFFFFF">
          <xsl:choose>
            <xsl:when test="$mode='email'">
                  <xsl:element name="img">
                    <xsl:attribute name="src"><xsl:value-of select="concat('cid:',//header/fac_logo_file)"/></xsl:attribute>
                  </xsl:element>
            </xsl:when>
            <xsl:otherwise>
              <xsl:element name="img">
                <xsl:attribute name="class">flogoimg</xsl:attribute>
                <xsl:attribute name="src">../../cust/<xsl:value-of select="//header/custId"/>/<xsl:value-of select="//header/fac_logo_file"/></xsl:attribute>
              </xsl:element>
            </xsl:otherwise>
          </xsl:choose>
        </td>
        <td width="33%"></td>
        <td width="33%" align="right" valign="bottom" style="text-align:right" class="fheaddate">
          <xsl:value-of select="//lcl/FAC/printdatum"/>&#xA0;<xsl:value-of select="//header/dateTime"/>
        </td>
      </tr>
    </table>
  </xsl:template>

  <xsl:template name="pagefooter">
    <table border="0" width="100%">
      <tr>
        <td align="right" class="tiny ffoot" style="color:#aaa">
          Facilitor<xsl:comment><xsl:value-of select="//header/custId"/><xsl:value-of select="//header/version"/>.<xsl:value-of select="$DefRev"/>.<xsl:value-of select="$Rev"/></xsl:comment></td>
      </tr>
    </table>
  </xsl:template>

  <!-- template voor het netjes tonen van prijzen -->
  <xsl:template name="showprice">
    <xsl:param name="price"/>
    <xsl:param name="prefix"/>
    <xsl:param name="postfix"/>
      <xsl:if test="string(number($price))!='NaN'">
         <xsl:value-of select="concat($prefix, format-number($price, '0,00', 'european'), $postfix)"/>
      </xsl:if>
  </xsl:template>

  <!-- template voor het netjes tonen van getallen -->
  <!--   gebruik in aanroep default='' als er bij geen waarde ook een lege string moet worden terug gegeven. -->
  <xsl:template name="shownumber">
    <xsl:param name="getal"/>
    <xsl:param name="default" select="'0'"/>
    <xsl:param name="format" select="''"/>
    <xsl:choose>
        <xsl:when test="contains($format, '@')">
            <!-- gebruik de decimal-format -->
            <xsl:variable name="frmt" select="substring-before($format, '@')"/>
            <xsl:choose>
              <xsl:when test="string(number($getal))!='NaN'">
                <xsl:value-of select="format-number($getal, $frmt, 'european')"/>
              </xsl:when>
              <xsl:otherwise>
                <xsl:if test="string(number($default))!='NaN'">
                  <xsl:value-of select="format-number($default, $frmt, 'european')"/>
                </xsl:if>
              </xsl:otherwise>
            </xsl:choose>
        </xsl:when>
        <xsl:otherwise>
            <!-- geen decimal-format gebruiken -->
            <xsl:choose>
              <xsl:when test="string(number($getal))!='NaN'">
                <xsl:value-of select="format-number($getal, $format)"/>
              </xsl:when>
              <xsl:otherwise>
                <xsl:if test="string(number($default))!='NaN'">
                  <xsl:value-of select="format-number($default, $format)"/>
                </xsl:if>
              </xsl:otherwise>
            </xsl:choose>

        </xsl:otherwise>
    </xsl:choose>


  </xsl:template>



   <!-- URL NAAR DE FACILITOR KTO INVULPAGINA -->
  <xsl:template name="kto_url">
    <xsl:param name="bmr"/>
    <xsl:if test="$bmr='b'">
      <xsl:element name="a">
        <xsl:attribute name="href">https://<xsl:value-of select="$FacilitorRoot"/>/default.asp?fac_id=<xsl:value-of select="//header/custId"/>&amp;Jumpto=appl/mld/mld_melding.asp%3Furole=fe%26kto_type=B%26kto_key=<xsl:value-of select="key"/></xsl:attribute>deze link</xsl:element>
    </xsl:if>
    <xsl:if test="$bmr='m'">
      <xsl:element name="a">
        <xsl:attribute name="href">https://<xsl:value-of select="$FacilitorRoot"/>/default.asp?fac_id=<xsl:value-of select="//header/custId"/>&amp;Jumpto=appl/mld/mld_melding.asp%3Furole=fe%26kto_type=M%26kto_key=<xsl:value-of select="key"/></xsl:attribute>deze link</xsl:element>
    </xsl:if>
    <xsl:if test="$bmr='r'">
      <xsl:element name="a">
        <xsl:attribute name="href">https://<xsl:value-of select="$FacilitorRoot"/>/default.asp?fac_id=<xsl:value-of select="//header/custId"/>&amp;Jumpto=appl/mld/mld_melding.asp%3Furole=fe%26kto_type=R%26kto_key=<xsl:value-of select="rsv_ruimte/key"/></xsl:attribute>deze link</xsl:element>
    </xsl:if>
  </xsl:template>



  <xsl:template name="cnt_begintext">
    <tr>
      <td colspan="2" class="tekst">&#xA0;</td>
    </tr>
  </xsl:template>

  <xsl:template name="cnt_endtext">
    <tr>
      <td colspan="2" class="tekst">&#xA0;</td>
    </tr>
  </xsl:template>

  <xsl:template name="res_begintext">
    <tr>
      <td colspan="2" class="tekst">&#xA0;</td>
    </tr>
  </xsl:template>

  <xsl:template name="res_endtext">
    <tr>
      <td colspan="2" class="tekst">&#xA0;</td>
    </tr>
  </xsl:template>

  <xsl:template name="bez_begintext">
    <tr>
      <td colspan="2" class="tekst"><xsl:value-of select="//lcl/BEZ/bez_begintext1"/>
       </td>
    </tr>
  </xsl:template>

  <xsl:template name="bez_endtext">
    <tr>
      <td colspan="2" class="tekst">&#xA0;</td>
    </tr>
  </xsl:template>

  <xsl:template name="prs_begintext">
    <tr>
      <td colspan="2" class="tekst"><xsl:value-of select="//lcl/PRS/prs_begintext1"/>
        <br/><xsl:value-of select="//lcl/PRS/prs_begintext2"/></td>
    </tr>
  </xsl:template>

  <xsl:template name="prs_endtext">
    <tr>
      <td colspan="2" class="tekst">&#xA0;</td>
    </tr>
  </xsl:template>

  <xsl:template match="bestelling" mode="include">
    <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" WIDTH="100%">
      <TR>
        <TD WIDTH="40" ROWSPAN="30" ID="LINKERMARGE"></TD>
        <TD>
          <table border="0" width="100%" bordercolor="#000000" CELLPADDING="2">
            <tr>
              <td align="left" width="100%" class="caption" colspan="4"><xsl:value-of select="//lcl/BES/bestelaanvraag"/>&#xA0;<xsl:value-of select="key"/>
                  <xsl:if test="ismutatie=1"> (WIJZIGING)</xsl:if>
                <xsl:if test="isretour=1"> (RETOUR)</xsl:if>
                </td>
            </tr>
            <xsl:choose>
            <xsl:when test="string(aanvrager/naam_full)!=string(voor/naam_full)">
            <tr>
                <td width="13%" class="label" align="left"><xsl:value-of select="//lcl/FAC/aanvrager"/></td>
                <td width="33%" class="value" align="right">: <xsl:value-of select="aanvrager/naam_full"/></td>
                <td width="20%" class="label" align="left"><xsl:value-of select="//lcl/BES/aanvraagdatum"/></td>
                <td width="32%" class="value" align="right">:
                <xsl:value-of select="datum/datum"/>&#xA0;
                <xsl:value-of select="datum/tijd"/>
                </td>
            </tr>
            <tr>
              <td class="label"><xsl:value-of select="//lcl/BES/bestelvoor"/></td>
              <td class="value">: <xsl:value-of select="voor/naam_full"/></td>
              <td colspan="2"/>
            </tr>
            </xsl:when>
            <xsl:otherwise>
            <tr>
              <td width="13%" class="label" align="left"><xsl:value-of select="//lcl/FAC/aanvrager"/></td>
              <td width="33%" class="value" align="right">: <xsl:value-of select="voor/naam_full"/></td>
              <td width="20%" class="label" align="left"><xsl:value-of select="//lcl/BES/aanvraagdatum"/></td>
              <td width="32%" class="value" align="right">:
                <xsl:value-of select="datum/datum"/>&#xA0;
                <xsl:value-of select="datum/tijd"/>
              </td>
            </tr>
            </xsl:otherwise>
            </xsl:choose>
            <xsl:if test="string(voor/email)!=''">
              <tr>
                <td class="label"><xsl:value-of select="//lcl/FAC/e-mail"/></td>
                <td class="value">: <xsl:value-of select="voor/email"/></td>
                <td colspan="2"/>
              </tr>
            </xsl:if>
            <xsl:choose>
              <xsl:when test="voor/telefoonnr!=''">
                <tr>
                  <td class="label"><xsl:value-of select="//lcl/FAC/telefoon"/></td>
                  <td class="value">: <xsl:value-of select="voor/telefoonnr"/></td>
                  <td class="label"><xsl:value-of select="//lcl/BES/gewenste_afleverdatum"/></td>
                  <td class="value">:
                    <xsl:value-of select="leverdatum/datum"/>
                  </td>
                </tr>
              </xsl:when>
              <xsl:when test="voor/mobiel!=''">
                <tr>
                  <td class="label"><xsl:value-of select="//lcl/FAC/telefoon"/></td>
                  <td class="value">: <xsl:value-of select="voor/mobiel"/></td>
                  <td class="label"><xsl:value-of select="//lcl/BES/gewenste_afleverdatum"/></td>
                  <td class="value">:
                    <xsl:value-of select="leverdatum/datum"/>
                  </td>
                </tr>
              </xsl:when>
              <xsl:otherwise>
                <tr>
                  <td class="label"><xsl:value-of select="//lcl/FAC/telefoon"/></td>
                  <td class="value">: -</td>
                  <td class="label"><xsl:value-of select="//lcl/BES/gewenste_afleverdatum"/></td>
                  <td class="value">:
                    <xsl:value-of select="leverdatum/datum"/>
                  </td>
                </tr>
              </xsl:otherwise>
            </xsl:choose>
            <tr>
              <td class="label"><xsl:value-of select="//lcl/FAC/afdeling"/></td>
              <td class="value">:
                <xsl:if test="voor/afdeling/omschrijving=''">-</xsl:if>
                <xsl:value-of select="voor/afdeling/omschrijving"/>
              </td>
              <td class="label"><xsl:value-of select="//lcl/BES/aanvraagstatus"/></td>
              <td class="value">: <xsl:value-of select="status"/></td>
            </tr>
            <tr>
              <td class="label"><xsl:value-of select="//lcl/FAC/kostenplaats"/></td>
              <td class="value">:
                <xsl:if test="kostenplaats/nr=''">-</xsl:if>
                <xsl:value-of select="kostenplaats/nr"/>
              </td>
              <td colspan="2"/>
            </tr>
            <tr>
              <td class="label" style="vertical-align:top"><xsl:value-of select="//lcl/BES/afleveradres"/></td>
              <td class="value">:
                <xsl:value-of select="afleveradres/naam"/>
                <xsl:if test="afleveradres/bezoek_adres">
                  <br/>&#xA0;
                  <xsl:value-of select="afleveradres/bezoek_adres"/>
                  <br/>&#xA0;
                  <xsl:value-of select="afleveradres/bezoek_postcode"/>&#xA0;
                  <xsl:value-of select="afleveradres/bezoek_plaats"/>
                  <br/>&#xA0;
                  <xsl:value-of select="afleveradres/bezoek_land"/>
                </xsl:if>
              </td>
              <td colspan="2"/>
            </tr>
            <xsl:if test="bestel_opm">
              <tr>
                <td height="10px" colspan="4"/>
              </tr>
              <tr>
                <td class="label" style="vertical-align:top"><xsl:value-of select="//lcl/FAC/opmerkingen"/></td>
                <td class="value" colspan="3">:
                <xsl:call-template name="linebreaks">
                  <xsl:with-param name="string" select="bestel_opm"/>
                </xsl:call-template>
                </td>
              </tr>
            </xsl:if>
            <tr>
              <td height="20px"/>
            </tr>
            <xsl:for-each select="kenmerk[count(@xmlnode)=0]">
                <xsl:if test="(@type!='L' and @type!='l' and @type!='Q' and @type!='b')">
              <tr>
              <xsl:choose>
              <xsl:when test="@type='M'">
                <xsl:if test="attachments/attachment/filename!=''"><td><b><xsl:value-of select="@naam"/>:</b></td></xsl:if>
              </xsl:when>
              <xsl:otherwise>
                <td><b><xsl:value-of select="@naam"/>:</b></td>
              </xsl:otherwise>
              </xsl:choose>
              <td class="value" colspan="3">
                <xsl:choose>
                  <xsl:when test="attachments!=''">
                    <xsl:for-each select="attachments/attachment">
                      <xsl:sort select="@volgnummer" data-type="number"/>
                      <xsl:if test="position()&gt;1">, </xsl:if><xsl:value-of select="filename"/>
                    </xsl:for-each>
                  </xsl:when>
                  <xsl:otherwise>
                    <xsl:value-of select="."/>
                  </xsl:otherwise>
                </xsl:choose>
              </td>
              </tr>
              </xsl:if>
            </xsl:for-each>
            <tr>
              <td height="20px"/>
            </tr>
           <tr>
              <td colspan="4" style="border-top:1px solid #000;"/>
           </tr>
            <tr>
              <td colspan="4">
                <table cellpadding="1" cellspacing="0" border="0" bordercolor="#000000" frame="box" width="99%">
                  <tr>
                    <th class="besth" style="text-align:left"><xsl:value-of select="//lcl/BES/artikelnr"/></th>
                    <th class="besth"><xsl:value-of select="//lcl/FAC/omschrijving"/></th>
                    <th class="besth"><xsl:value-of select="//lcl/FAC/opmerkingen"/></th>
                    <th class="besth" style="text-align:right"><xsl:value-of select="//lcl/FAC/aantal"/></th>
                    <th class="besth" style="text-align:right"><xsl:value-of select="//lcl/FAC/prijs"/></th>
                    <th class="besth" style="text-align:right"><xsl:value-of select="//lcl/FAC/totaal"/></th>
                  </tr>
                  <xsl:for-each select="bestelitem">
                    <tr>
                      <td class="besresult" style="text-align:left">
                      &#xA0;<xsl:value-of select="srtdeel/artikel_nummer"/>
                      </td>
                      <td class="besresult" style="text-align:left">
                        <xsl:value-of select="srtdeel/omschrijving"/>
                      </td>
                      <td class="besresult">
                        <xsl:for-each select="kenmerk[count(@xmlnode)=0]">
                            <xsl:if test="(@type!='L' and @type!='l' and @type!='Q' and @type!='b' and @type!='M')">
                          <xsl:value-of select="@naam"/>:
                          <xsl:value-of select="."/>
                          <br/>
                          </xsl:if>
                        </xsl:for-each>&#xA0;</td>
                      <td class="besresult" style="text-align:right">
                        <xsl:value-of select="aantal"/>
                      </td>
                      <td class="besresult" style="text-align:right">
                        <xsl:call-template name="shownumber">
                          <xsl:with-param name="getal" select="prijs"/>
                          <xsl:with-param name="format" select="'0,00@EU'"/>
                        </xsl:call-template>
                      </td>
                      <td class="besresult" style="text-align:right">
                        <xsl:call-template name="shownumber">
                          <xsl:with-param name="getal" select="aantal*prijs"/>
                          <xsl:with-param name="format" select="'0,00@EU'"/>
                        </xsl:call-template>
                      </td>
                    </tr>
                  </xsl:for-each>
                  <tr>
                    <td colspan="6" height="6px" style="border-top:1px solid #000;"/>
                  </tr>

                  <xsl:if test="/facilitor/bestelling/levkosten != '0'">
                  <tr>
                    <td class="label" style="text-align:right;border-style:solid;border-width:0px;" colspan="5"><xsl:value-of select="//lcl/BES/transportkosten"/>:</td>
                    <td class="label" style="text-align:right;border-style:solid;border-width:0px;">
                      <xsl:call-template name="shownumber">
                        <xsl:with-param name="getal" select="/facilitor/bestelling/levkosten"/>
                        <xsl:with-param name="format" select="'0,00@EU'"/>
                      </xsl:call-template>
                    </td>
                  </tr>
                  </xsl:if>

                  <tr>
                    <td class="tekstkop" style="text-align:right;border-style:solid;border-width:0px;" colspan="5"><xsl:value-of select="//lcl/FAC/totaal"/>:</td>
                    <td class="tekstkop" style="text-align:right;border-style:solid;border-width:0px;">
                      <xsl:call-template name="shownumber">
                        <xsl:with-param name="getal" select="sum(/facilitor/bestelling/bestelitem/totaal)+ /facilitor/bestelling/levkosten"/>
                        <xsl:with-param name="format" select="'0,00@EU'"/>
                      </xsl:call-template>
                    </td>
                  </tr>
                </table>
              </td>
            </tr>
          </table>
        </TD>
        <TD WIDTH="30" ROWSPAN="30" ID="RECHTERMARGE"/>
      </TR>
    </TABLE>
  </xsl:template>

   <xsl:template match="bestelling" mode="kto">
     <br/>Geachte heer/mevrouw <xsl:value-of select="voor/naam_full"/>,<br/><br/>
    <br/>De bestelling <xsl:value-of select="key"/> is onlangs geleverd.
    <br/>Om je in de toekomst nog beter van dienst te kunnen zijn, is je mening omtrent de uitgevoerde werkzaamheden van belang.
    <br/>Wij verzoeken je
    <xsl:call-template name="kto_url">
      <xsl:with-param name="bmr">b</xsl:with-param>
    </xsl:call-template> te volgen en je reactie te geven. Het invullen van dit formulier duurt ongeveer 2 minuten.
    <br/>Bij voorbaat hartelijk dank voor je medewerking.
    <br/>
    <br/>Facilitair Service Centre
    <br/>
    <br/>Onderstaand tref je de gegevens van deze bestelling nogmaals aan:<br/><br/><br/>
    <xsl:apply-templates select="." mode="include"/>
  </xsl:template>

  <xsl:template match="bestelling" mode="full">
       <xsl:choose>
            <xsl:when test="$mode='summary'"></xsl:when>
       <xsl:otherwise>
    <html>
      <xsl:comment>================================ BESTELLINGEN ==============================</xsl:comment>
      <xsl:comment>Facilitor default XSL template for bestellingen</xsl:comment>
      <xsl:call-template name="htmlhead"/>
      <xsl:element name="body">
        <xsl:if test="$mode!='email'">
          <xsl:attribute name="onload">window.print();</xsl:attribute>
        </xsl:if>
        <xsl:call-template name="pageheader"/>
        <xsl:choose>
             <xsl:when test="$srtnotificatiecode = 'BESKTO'">
               <xsl:apply-templates select="." mode="kto"/>
             </xsl:when>
            <xsl:otherwise>
                <xsl:apply-templates select="." mode="include"/>
             </xsl:otherwise>
            </xsl:choose>
        <xsl:call-template name="pagefooter"/>
      </xsl:element>
    </html>
       </xsl:otherwise>
      </xsl:choose>
  </xsl:template>

  <xsl:template match="bestelling">
    <xsl:choose>
      <xsl:when test="@mode='preview'">
        <xsl:apply-templates select="." mode="preview"/>
      </xsl:when>
      <xsl:otherwise>
        <xsl:apply-templates select="." mode="full"/>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <xsl:template match="bestelopdracht" mode="include">
    <TABLE BORDER="0" CELLPADDING="1" CELLSPACING="0" WIDTH="100%">
      <TR>
        <TD WIDTH="40" ROWSPAN="30" ID="LINKERMARGE"></TD>
        <TD>
          <!-- Bestelopdracht -->
          <table border="0" bordercolor="#ffffff" width="100%">
            <tr>
              <td colspan="4" class="caption" style="text-align:center">
                <b><xsl:value-of select="//lcl/BES/inkooporder"/></b>
              </td>
            </tr>
            <tr>
              <td colspan="4" style="height:30px"/>
            </tr>
            <tr>
              <td colspan="2" class="label" style="width:50%">
                <b><xsl:value-of select="//lcl/BES/factuur_aan"/>:</b>
              </td>
              <td class="label" colspan="2" style="width:50%">
                <b><xsl:value-of select="//lcl/BES/leverancier"/>:</b>
              </td>
            </tr>
            <tr>
              <td colspan="2" class="value">
                <xsl:value-of select="factuuradres/naam"/>
                <br/>
                <xsl:value-of select="factuuradres/post_adres"/>
                <br/>
                <xsl:value-of select="factuuradres/post_postcode"/>&#xA0;
                <xsl:value-of select="factuuradres/post_plaats"/>
                <br/>
                <xsl:value-of select="factuuradres/post_land"/>
              </td>
              <td colspan="2" class="value">
                <xsl:value-of select="bedrijf/naam"/>
                <br/>
                <xsl:value-of select="bedrijf/post_adres"/>
                <br/>
                <xsl:value-of select="bedrijf/post_postcode"/>&#xA0;
                <xsl:value-of select="bedrijf/post_plaats"/>
                <br/>
                <xsl:value-of select="bedrijf/post_land"/>
              </td>
            </tr>
            <tr>
              <td colspan="4" style="height:20px"/>
            </tr>
            <tr>
              <td colspan="2" class="label">
                <b><xsl:value-of select="//lcl/FAC/contactgegevens"/>:</b>
              </td>
              <td/>
              <td colspan="2">
                <b/>
              </td>
            </tr>
            <tr>
              <td style="vertical-align:top" class="label" width="20%">
                <b><xsl:value-of select="//lcl/BES/besteller"/></b>
              </td>
              <td class="value" width="30%">:
                <xsl:value-of select="bestelling/aanvrager/naam_full"/>
              </td>
              <td class="label" width="22%">
                <b><xsl:value-of select="//lcl/BES/aanvraagnummers"/></b>
              </td>
              <td class="value" width="28%">:
                 <xsl:value-of select="bestelling/key"/>
              </td>
            </tr>
            <tr>
              <td class="label">
                <b><xsl:value-of select="//lcl/FAC/e-mail"/></b>
              </td>
              <td class="value">:
                <xsl:value-of select="bestelling/aanvrager/email"/>
              </td>
              <td class="label">
                <b><xsl:value-of select="//lcl/BES/opdrachtnummer"/></b>
              </td>
              <td class="value">:
                <xsl:value-of select="id"/>
              </td>
            </tr>
            <tr>
              <td class="label">
                <b><xsl:value-of select="//lcl/FAC/telefoon"/></b>
              </td>
              <td class="value">:
                <xsl:choose>
                  <xsl:when test="bestelling/aanvrager/telefoonnr">
                   <xsl:value-of select="bestelling/aanvrager/telefoonnr"/>
                  </xsl:when>
                  <xsl:when test="bestelling/aanvrager/mobiel!=''">
                    <xsl:value-of select="bestelling/aanvrager/mobiel"/>
                  </xsl:when>
                </xsl:choose>
             </td>
              <td class="label">
                 <b><xsl:value-of select="//lcl/BES/orderdatum"/></b>
              </td>
              <td class="value">:
                <xsl:value-of select="datum/datum"/>
              </td>
            </tr>
            <tr>
              <td class="label">
                <b><xsl:value-of select="//lcl/FAC/kostenplaats"/></b>
              </td>
              <td class="value">:
                <xsl:value-of select="bestelling/kostenplaats/nr"/>
              </td>
              <td colspan="2"/>
              <xsl:comment>
                <td class="label">
                  <b><xsl:value-of select="//lcl/BES/gewenste_afleverdatum"/></b>
                </td>
                <td class="value">
                  <xsl:value-of select="bestelling/leverdatum/datum"/>
                </td>
              </xsl:comment>
            </tr>
            <tr>
              <td class="label">
                <b><xsl:value-of select="//lcl/FAC/werkplek"/></b>
              </td>
              <td class="value">:
                <xsl:value-of select="bestelling/plaats"/>
              </td>
              <td colspan="2"/>
            </tr>
            <tr>
              <td colspan="4" style="height:20px"/>
            </tr>
            <tr>
              <td colspan="2" class="label">
                <b><xsl:value-of select="//lcl/BES/afleveradres"/>:</b>
              </td>
              <td colspan="2">
                <b/>
              </td>
            </tr>
            <tr>
              <td colspan="2" style="vertical-align:top" class="value">
                <xsl:value-of select="afleveradres/naam"/>
                <xsl:if test="afleveradres/bezoek_adres">
                  <br/>
                  <xsl:value-of select="afleveradres/bezoek_adres"/>
                  <br/>
                  <xsl:value-of select="afleveradres/bezoek_postcode"/>&#xA0;
                  <xsl:value-of select="afleveradres/bezoek_plaats"/>
                  <br/>
                  <xsl:value-of select="afleveradres/bezoek_land"/>
                </xsl:if>
              </td>
              <td colspan="2"/>
            </tr>
            <xsl:if test="bestelling/bestel_opm">
              <tr>
                <td height="10px" colspan="4"/>
              </tr>
              <tr>
                <td class="label" style="vertical-align:top"><b><xsl:value-of select="//lcl/FAC/opmerkingen"/></b></td>
                <td class="value" colspan="3">:
                <xsl:call-template name="linebreaks">
                  <xsl:with-param name="string" select="bestelling/bestel_opm"/>
                </xsl:call-template>
                </td>
              </tr>
            </xsl:if>
            <tr>
              <td colspan="4" style="height:20px"/>
            </tr>
              <xsl:for-each select="bestelling/kenmerk[@type!='L' and @type!='l' and @type!='Q' and @type!='b']">
            <tr>
              <xsl:choose>
              <xsl:when test="@type='M'">
                <xsl:if test="attachments/attachment/filename!=''"><td><b><xsl:value-of select="@naam"/>:</b></td></xsl:if>
              </xsl:when>
              <xsl:otherwise>
                <td><b><xsl:value-of select="@naam"/>:</b></td>
              </xsl:otherwise>
              </xsl:choose>
              <td class="value">
                <xsl:choose>
                  <xsl:when test="attachments!=''">
                    <xsl:for-each select="attachments/attachment">
                      <xsl:sort select="@volgnummer" data-type="number"/>
                      <xsl:if test="position()&gt;1">, </xsl:if><xsl:value-of select="filename"/>
                    </xsl:for-each>
                  </xsl:when>
                  <xsl:otherwise>
                    <xsl:value-of select="."/>
                  </xsl:otherwise>
                </xsl:choose>
              </td>
               </tr>
              </xsl:for-each>
            <tr>
              <td colspan="4" style="height:20px"/>
            </tr>
           <tr>
              <td colspan="4" style="border-top:1px solid #000;"/>
           </tr>
            <TR>
              <TD colspan="7">
                <TABLE cellpadding="1" cellspacing="0" border="0" bordercolor="#000000" frame="box" width="99%">
                  <tr>
                    <th class="besth" style="width:9%; text-align:left"><xsl:value-of select="//lcl/BES/regel"/></th>
                    <th class="besth" style="width:13%; text-align:left"><xsl:value-of select="//lcl/BES/artikelnr"/></th>
                    <th class="besth" style="width:36%"><xsl:value-of select="//lcl/FAC/omschrijving"/></th>
                    <th class="besth" style="width:11%; text-align:left"><xsl:value-of select="//lcl/FAC/eenheid"/></th>
                    <th class="besth" style="width:9%; text-align:right"><xsl:value-of select="//lcl/FAC/aantal"/></th>
                    <th class="besth" style="width:11%; text-align:right"><xsl:value-of select="//lcl/FAC/prijs"/></th>
                    <th class="besth" style="width:11%; text-align:right"><xsl:value-of select="//lcl/FAC/totaal"/></th>
                  </tr>
                  <xsl:for-each select="bestelopdrachtitem">
                    <xsl:sort select="srtdeel/omschrijving"/>
                    <xsl:sort select="posnr" data-type="number"/>
                    <tr>
                      <td class="besresult">
                        <xsl:value-of select="posnr"/>
                      </td>
                      <td class="besresult">
                        <xsl:value-of select="bestelitem/srtdeel/artikel_nummer"/>
                      </td>
                      <td class="besresult">
                        <xsl:value-of select="bestelitem/srtdeel/omschrijving"/>&#xA0;
                        <xsl:for-each select="bestelitem/kenmerk">
                          <br/>
                          <xsl:value-of select="@naam"/>: <xsl:value-of select="."/></xsl:for-each>
                      </td>
                      <td class="besresult">
                        <xsl:value-of select="bestelitem/srtdeel/eenheid"/>
                      </td>
                      <td class="besresult" style="text-align:right">
                        <xsl:value-of select="aantal"/>
                      </td>
                      <td class="besresult" style="text-align:right">
                       <xsl:call-template name="showprice">
                          <xsl:with-param name="price" select="prijs"/>
                          <xsl:with-param name="prefix" select="'&#x20AC;&#xA0;'"/>
                       </xsl:call-template>
                      </td>
                      <td class="besresult" style="text-align:right">
                       <xsl:call-template name="showprice">
                          <xsl:with-param name="price" select="totaal"/>
                          <xsl:with-param name="prefix" select="'&#x20AC;&#xA0;'"/>
                       </xsl:call-template>
                      </td>
                    </tr>
                  </xsl:for-each>
                  <tr>
                    <td colspan="7" height="6px" style="border-top:1px solid #000;"/>
                  </tr>
                  <tr>
                    <td colspan="6"/>
                    <td style="text-align:right">
                      <b>
                        <xsl:call-template name="showprice">
                          <xsl:with-param name="price" select="sum(bestelopdrachtitem/totaal)"/>
                          <xsl:with-param name="prefix" select="'&#x20AC;&#xA0;'"/>
                        </xsl:call-template>
                      </b>
                    </td>
                  </tr>
                </TABLE>
              </TD>
            </TR>
            <tr>
              <td colspan="4" style="height:40px"/>
            </tr>
            <tr>
              <td colspan="4" style="text-align:center; font-size:9px"><xsl:value-of select="//lcl/BES/order_disclaimer1"/>(<xsl:value-of select="id"/>)<xsl:value-of select="//lcl/BES/order_disclaimer2"/></td>
            </tr>
          </table>
        </TD>
        <TD WIDTH="30" ROWSPAN="30" ID="RECHTERMARGE"/>
      </TR>
    </TABLE>
  </xsl:template>

  <xsl:template match="bestelopdracht" mode="full">
       <xsl:choose>
            <xsl:when test="$mode='summary'"></xsl:when>
       <xsl:otherwise>
    <html>
      <xsl:comment>================================ BESTELOPDRACHTEN ==============================</xsl:comment>
      <xsl:comment>Facilitor default XSL template for bestelopdracht</xsl:comment>
      <xsl:call-template name="htmlhead"/>
      <xsl:element name="body">
        <xsl:if test="$mode!='email'">
          <xsl:attribute name="onload">window.print();</xsl:attribute>
        </xsl:if>
        <xsl:call-template name="pageheader"/>
        <xsl:apply-templates select="." mode="include"/>
        <xsl:call-template name="pagefooter"/>
      </xsl:element>
    </html>
       </xsl:otherwise>
      </xsl:choose>
  </xsl:template>

  <xsl:template match="reservering" mode="outlook">
BEGIN:VCALENDAR
VERSION:2.0
METHOD:REQUEST
BEGIN:VEVENT
UID:FCLTRES<xsl:value-of select="rsv_ruimte/key"/>
DTSTAMP:<xsl:value-of select="datum/utcdatum"/>T<xsl:value-of select="datum/utctijd"/>Z
DTSTART:<xsl:value-of select="rsv_ruimte/van/utcdatum"/>T<xsl:value-of select="rsv_ruimte/van/utctijd"/>Z
DTEND:<xsl:value-of select="rsv_ruimte/tot/utcdatum"/>T<xsl:value-of select="rsv_ruimte/tot/utctijd"/>Z
SUMMARY:<xsl:value-of select="fclt:safe_vCal(rsv_ruimte/res_activiteit/omschrijving)"/>: <xsl:value-of select="fclt:safe_vCal(rsv_ruimte/omschrijving)"/>
DESCRIPTION:<xsl:value-of select="fclt:safe_vCal(rsv_ruimte/opmerking)"/>
LOCATION:<xsl:value-of select="fclt:safe_vCal(rsv_ruimte/res_ruimte/nr)"/>
ORGANIZER;CN=<xsl:value-of select="fclt:safe_vCal_param(rsv_ruimte/contact_user/naam_full)"/>:MAILTO:reservering-noreply@facilitor.nl
<xsl:for-each select="rsv_ruimte/afspraak/bezoeker">
ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=TENTATIVE;CN=<xsl:value-of select="naam"/>
<xsl:if test="string(bedrijf)!=''"> (<xsl:value-of select="bedrijf"/>)</xsl:if>:MAILTO:<xsl:if test="boolean(intern_user)">
<xsl:value-of select="intern_user/email"/></xsl:if></xsl:for-each>
SEQUENCE:<xsl:for-each select="rsv_ruimte/tracking/track">
           <xsl:sort select="./datum/timestamp" data-type="number" order="descending"/>
           <xsl:if test="position() = 1">
             <xsl:value-of select="./datum/timestamp"/>
           </xsl:if>
         </xsl:for-each>
PRIORITY:5
END:VEVENT
END:VCALENDAR
  </xsl:template>

  <xsl:template match="reservering" mode="include">
    <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" WIDTH="100%">
      <TR>
        <TD WIDTH="40" ROWSPAN="30" ID="LINKERMARGE"/>
        <TD>
          <xsl:choose>
             <xsl:when test="$srtnotificatiecode='RESDEL' and verwijder">
              <table>
                <tr>
                  <td height="20"/>
                </tr>
                <tr>
                  <td class="caption" style="color: red"><xsl:value-of select="//lcl/RES/annulering"/></td>
                </tr>
              </table>
            </xsl:when>
          </xsl:choose>
            <!-- Bevestiging reservering -->
            <!-- Ook tonen voor verwijderde reserveringen -->

            <!-- De algemene gegevens van de deelreservering met het laagste volgnummer worden gebruikt als referentie gegevens! -->
            <xsl:variable name="min_volgnr">
              <xsl:value-of select="//reservering/rsv_ruimte/volgnr[not(. &gt; //reservering/rsv_ruimte/volgnr)]"/>
            </xsl:variable>

            <table border="0" bordercolor="#000000" width="100%">
              <tr>
                <td class="caption" valign="top" colspan="4">
                  <xsl:choose>
                    <xsl:when test="@content='complete'"><xsl:value-of select="//lcl/RES/reservering"/>&#xA0;<xsl:value-of select="key"/></xsl:when>
                    <xsl:otherwise><xsl:value-of select="//lcl/RES/deelreservering"/>&#xA0;<xsl:value-of select="key"/> /<xsl:value-of select="$min_volgnr"/></xsl:otherwise>
                  </xsl:choose>
                  <xsl:if test="string(rsv_ruimte[volgnr=$min_volgnr]/omschrijving)!=''">&#xA0;-&#xA0;<xsl:value-of select="rsv_ruimte[volgnr=$min_volgnr]/omschrijving"/></xsl:if>&#xA0;</td>
              </tr>
                <tr>
                <td class="tekstkop" colspan="4" style="text-decoration:underline">Contactgegevens:</td>
              </tr>
        <tr>
                <td width="13%" class="label"><xsl:value-of select="//lcl/FAC/aanvrager"/></td>
                <td width="37%" class="value">: <xsl:value-of select="rsv_ruimte[volgnr=$min_volgnr]/contact_user/naam_full"/></td>
                <td width="13%" class="label"><xsl:value-of select="//lcl/FAC/afdeling"/></td>
                <td width="37%" class="value">: <xsl:value-of select="rsv_ruimte[volgnr=$min_volgnr]/contact_user/afdeling/omschrijving"/></td>
              </tr>
              <tr>
                <td width="13%" class="label"><xsl:value-of select="//lcl/FAC/telefoon"/></td>
                <td width="37%" class="value">: <xsl:value-of select="rsv_ruimte[volgnr=$min_volgnr]/contact_user/telefoonnr"/></td>
        <xsl:if test="string(rsv_ruimte[volgnr=$min_volgnr]/contact_user/werkplek/plaats/regio/district/locatie/omschrijving)!=''">
            <td width="13%" class="label"><xsl:value-of select="//lcl/FAC/locatie"/></td>
                    <td width="37%" class="value">: <xsl:value-of select="rsv_ruimte[volgnr=$min_volgnr]/contact_user/werkplek/plaats/regio/district/locatie/omschrijving"/></td>
                </xsl:if>
              </tr>
              <tr>
                <td width="15%" class="label"><xsl:value-of select="//lcl/FAC/e-mail"/></td>
                <td colspan="3" class="value">: <xsl:value-of select="rsv_ruimte[volgnr=$min_volgnr]/contact_user/email"/></td>
              </tr>
             <xsl:if test="$srtnotificatiecode='RESDEL'">
              <tr>
                <td width="20%" class="label"><xsl:value-of select="//lcl/RES/begintijd"/></td>
                <td width="80%" colspan="3" class="value">: <xsl:value-of select="rsv_ruimte/van/datum"/>&#xA0;<xsl:value-of select="rsv_ruimte/van/tijd"/></td>
              </tr>
             </xsl:if>
              <tr>
                <td height="25px"/>
              </tr>
              <xsl:if test="rsv_ruimte[volgnr=$min_volgnr]/contact_user/key!=ingevoerd_user/key">
                <tr>
                  <td width="20%" class="label"><xsl:value-of select="//lcl/RES/behandeld_door"/></td>
                  <td width="80%" class="value">: <xsl:value-of select="ingevoerd_user/naam_full"/></td>
                </tr>
                <tr>
                  <td height="30px"/>
                </tr>
              </xsl:if>
              <tr>
                <td colspan="2" class="tekst">
                  <xsl:choose>
                    <xsl:when test="$srtnotificatiecode='RESNEW'"/>
                    <xsl:when test="$srtnotificatiecode='RESDEL'"><xsl:value-of select="//lcl/RES/reservering_vervallen"/></xsl:when>
                    <xsl:otherwise>
                      <xsl:call-template name="res_begintext"/>
                    </xsl:otherwise>
                  </xsl:choose>
                </td>
              </tr>
                    <xsl:choose>
                        <xsl:when test="$srtnotificatiecode!='RESDEL'">
              <tr>
                <td height="10px"/>
              </tr>
              <tr>
                <td colspan="4">
                  <table cellpadding="1" border="0" WIDTH="99%" bordercolor="#000000" frame="box">
                    <!-- rsv_ruimte -->
                    <xsl:for-each select="rsv_ruimte">
                      <xsl:sort select="van/timestamp"/>
                      <xsl:call-template name="rsv_ruimte">
                        <xsl:with-param name="min_volgnr" select="$min_volgnr"/>
                      </xsl:call-template>
                    </xsl:for-each>
                    <!-- totaal reservering -->
                    <xsl:if test="@content='complete'">
                    <tr>
                      <td colspan="9" height="15px" style="border-bottom:1px solid #000;"/>
                    </tr>
                    <tr>
                      <td class="tekstkop" align="right" colspan="5" style="border-width:0px;"><xsl:value-of select="//lcl/RES/totaalprijs_reservering"/>:</td>
                      <td class="tekstkop" colspan="2" style="text-align:right;border-width:0px;">
                                              <xsl:call-template name="europrijs">
                                                  <xsl:with-param name="prijs" select="sum(rsv_ruimte/prijs[string(number(.))!='NaN'])+sum(rsv_ruimte/rsv_deel/prijs[string(number(.))!='NaN'])+sum(rsv_ruimte/rsv_artikel/prijs[string(number(.))!='NaN'])"/>
                                              </xsl:call-template>
                      </td>
                    </tr>
                    </xsl:if>
                  </table>
                </td>
              </tr>
              <xsl:call-template name="res_endtext">
                <xsl:with-param name="min_volgnr" select="$min_volgnr"/>
              </xsl:call-template>
                </xsl:when>
              </xsl:choose>
            </table>
            <!-- Bevestiging reservering -->
        </TD>
        <TD WIDTH="30" ROWSPAN="30" ID="RECHTERMARGE"/>
      </TR>
    </TABLE>
  </xsl:template>

  <xsl:template match="reservering" mode="kto">
       <br/>Geachte heer/mevrouw <xsl:value-of select="rsv_ruimte/contact_user/tussenvoegsel"/>&#xA0;<xsl:value-of select="rsv_ruimte/contact_user/naam"/>,<br/><br/>
      <br/>De (deel)reservering <xsl:value-of select="key"/>/<xsl:value-of select="rsv_ruimte/volgnr"/> (<xsl:value-of select="rsv_ruimte/omschrijving"/>) is onlangs geweest.
      <br/>Om je in de toekomst nog beter van dienst te kunnen zijn, is je mening omtrent de uitgevoerde werkzaamheden van belang.
      <br/>Wij verzoeken je
      <xsl:call-template name="kto_url">
        <xsl:with-param name="bmr">r</xsl:with-param>
      </xsl:call-template> te volgen en je reactie te geven. Het invullen van dit formulier duurt ongeveer 2 minuten.
      <br/>Bij voorbaat hartelijk dank voor je medewerking.
      <br/>
      <br/>Facilitair Service Centre
      <br/>
      <br/>Onderstaand tref je de gegevens van deze reservering nogmaals aan:<br/><br/><br/>
      <xsl:apply-templates select="." mode="include"/>
  </xsl:template>

  <xsl:template match="reservering" mode="full">
      <xsl:choose>
        <xsl:when test="$mode='summary'"></xsl:when>
        <xsl:otherwise>
            <xsl:choose>
                <xsl:when test="$srtnotificatiecode = 'OUTLOOK' or $mode='ics'">
                    <xsl:apply-templates select="." mode="outlook"/>
                </xsl:when>
                <xsl:otherwise>
                    <html>
                      <xsl:comment>================================ RESERVERINGEN ==============================</xsl:comment>
                      <xsl:comment>Facilitor default XSL template for reservering</xsl:comment>
                      <xsl:call-template name="htmlhead"/>
                      <xsl:element name="body">
                        <xsl:if test="$mode!='email'">
                            <xsl:attribute name="onload">window.print();</xsl:attribute>
                        </xsl:if>
                        <xsl:call-template name="pageheader"/>
                        <xsl:choose>
                            <xsl:when test="$srtnotificatiecode = 'RESKTO'">
                                <xsl:apply-templates select="." mode="kto"/>
                            </xsl:when>
                            <xsl:otherwise>
                                <xsl:apply-templates select="." mode="include"/>
                            </xsl:otherwise>
                        </xsl:choose>
                        <xsl:call-template name="pagefooter"/>
                      </xsl:element>
                    </html>
                </xsl:otherwise>
            </xsl:choose>
        </xsl:otherwise>
      </xsl:choose>
  </xsl:template>

  <xsl:template match="afspraak" mode="include">
    <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" WIDTH="100%">
      <TR>
        <TD WIDTH="40" ROWSPAN="30" ID="LINKERMARGE"/>
        <TD>
          <xsl:choose>
            <xsl:when test="not(boolean(bezoeker))">
              <table>
                <tr>
                  <td height="20"/>
                </tr>
                <tr>
                  <td class="caption"><xsl:value-of select="//lcl/BEZ/geen_bezoekers"/></td>
                </tr>
              </table>
            </xsl:when>
            <xsl:otherwise>
              <!-- Bevestiging bezoekers registratie -->
              <table border="0" bordercolor="#ffffff" width="100%">
                <xsl:if test="1!=1">
                <tr>
                  <td>
                    <xsl:element name="img">
                    <xsl:attribute name="style">height: 3.25cm; width: 3.25cm; margin:0cm; padding:0; border:none</xsl:attribute>
                    <xsl:attribute name="qrc">https://<xsl:value-of select="$FacilitorRoot"/>fclttoegang(reservering,<xsl:value-of select="rsv_ruimte/key"/>)</xsl:attribute>
                    </xsl:element>
                  </td>
                  <td class="caption" valign="top"><xsl:value-of select="//lcl/BEZ/bevestiging_bezoekersregistratie"/><br/><span class="tiny"><xsl:value-of select="//lcl/FAC/nummer"/>&#xA0;<xsl:value-of select="key"/></span></td>
                </tr>
                </xsl:if>
                <tr>
                  <td class="label" width="20%"><xsl:value-of select="//lcl/FAC/aanvrager"/></td>
                  <td class="value" width="80%">: <xsl:value-of select="contact_user/naam_full"/></td>
                </tr>
                <tr>
                  <td class="label" width="20%"><xsl:value-of select="//lcl/FAC/e-mail"/></td>
                  <td class="value" width="80%">: <xsl:value-of select="contact_user/email"/></td>
                </tr>
                <tr>
                  <td class="label" width="20%"><xsl:value-of select="//lcl/FAC/locatie"/></td>
                  <td class="value" width="80%">: <xsl:value-of select="contact_user/werkplek/plaats/regio/district/locatie/omschrijving"/></td>
                </tr>
                <tr>
                  <td class="label" width="20%"><xsl:value-of select="//lcl/FAC/afdeling"/></td>
                  <td class="value" width="80%">: <xsl:value-of select="contact_user/afdeling/omschrijving"/></td>
                </tr>
                <tr>
                  <td height="20px"/>
                </tr>
                <xsl:if test="contact_user/key!=ingevoerd_user/key">
                  <tr>
                    <td width="20%" class="label"><xsl:value-of select="//lcl/BEZ/behandeld_door"/></td>
                    <td width="80%" class="value">: <xsl:value-of select="ingevoerd_user/naam_full"/></td>
                  </tr>
                  <tr>
                    <td height="20px"/>
                  </tr>
                </xsl:if>
                <xsl:call-template name="bez_begintext"/>
                <tr>
                  <td height="20px"/>
                </tr>
                <tr>
                  <td class="tekstkop" colspan="2"><xsl:value-of select="//lcl/BEZ/bezoekgegevens"/></td>
                </tr>
                <tr>
                  <td class="label" width="20%"><xsl:value-of select="//lcl/BEZ/datum_bezoek"/></td>
                  <td class="value" width="80%">: <xsl:value-of select="datum/datum"/>
                    <xsl:if test="datum/datum!=eind/datum">- <xsl:value-of select="eind/datum"/></xsl:if>
                  </td>
                </tr>
                <tr>
                  <td class="label" width="20%"><xsl:value-of select="//lcl/BEZ/tijd_bezoek"/></td>
                  <td class="value" width="80%">: <xsl:value-of select="datum/tijd"/> - <xsl:value-of select="eind/tijd"/></td>
                </tr>
                <tr>
                  <td class="label" width="20%"><xsl:value-of select="//lcl/BEZ/op_bezoek_bij"/></td>
                  <td class="value" width="80%">: <xsl:value-of select="gastheer"/></td>
                </tr>
                <tr>
                  <td class="label" width="20%"><xsl:value-of select="//lcl/FAC/telefoon"/></td>
                  <td class="value" width="80%">: <xsl:value-of select="telefoonnr"/></td>
                </tr>
                <tr>
                  <td class="label" width="20%"><xsl:value-of select="//lcl/BEZ/bezoek_locatie"/></td>
                  <td class="value" width="80%">
                     <xsl:choose>
                        <xsl:when test="plaats/plaatsaanduiding">
                           : <xsl:value-of select="plaats/plaatsaanduiding"/>
                        </xsl:when>
                        <xsl:otherwise>
                           : <xsl:value-of select="ruimte"/>
                        </xsl:otherwise>
                     </xsl:choose>
                  </td>
                </tr>
                <tr>
                  <td class="label" width="20%"><xsl:value-of select="//lcl/BEZ/actie"/></td>
                  <td class="value" width="80%">: <xsl:value-of select="actie"/></td>
                </tr>
                <xsl:if test="opmerking!=''">
                  <tr>
                    <td class="label" width="20%"><xsl:value-of select="//lcl/FAC/opmerking"/></td>
                    <td class="value" width="80%">: <xsl:value-of select="opmerking"/></td>
                  </tr>
                </xsl:if>
                <tr>
                  <td height="20px"/>
                </tr>
                <!-- afspraak -->
                <xsl:for-each select="bezoeker">
                  <xsl:sort select="naam"/>
                  <xsl:choose>
                    <xsl:when test="position() = 1">
                      <tr>
                        <td height="10" style="border-right: 0px solid; border-top: 0px solid; border-left: 0px solid; border-bottom: 0px solid"/>
                      </tr>
                      <tr>
                            <td colspan="3" class="tekstkop"><xsl:value-of select="//lcl/BEZ/bez_begintext2"/></td>
                      </tr>
                    </xsl:when>
                  </xsl:choose>
                  <tr>
                    <td class="result">
                      <xsl:value-of select="naam"/>
                    </td>
                    <td class="result">
                      <xsl:value-of select="bedrijf"/>
                      <xsl:if test="deel">,&#xA0;<xsl:value-of select="//lcl/BEZ/parkeerplaats_gereserveerd"/></xsl:if>
                          <xsl:for-each select="kenmerk[@type!='L' and @type!='l' and @type!='Q' and @type!='b' and count(@xmlnode)=0]">
                                    <xsl:sort select="@volgnummer" data-type="number"/>
                                    <xsl:if test=".!=''">
                                      <tr>
                                      <xsl:choose>
                                      <xsl:when test="@type='M'">
                                        <xsl:if test="attachments/attachment/filename!=''"><td><b><xsl:value-of select="@naam"/>:</b></td></xsl:if>
                                      </xsl:when>
                                      <xsl:otherwise>
                                        <td><b><xsl:value-of select="@naam"/>:</b></td>
                                      </xsl:otherwise>
                                      </xsl:choose>
                                        <td colspan="3">
                                          <xsl:choose>
                                          <xsl:when test="attachments!=''">
                                            <xsl:for-each select="attachments/attachment">
                                              <xsl:sort select="@volgnummer" data-type="number"/>
                                              <xsl:if test="position()&gt;1">, </xsl:if><xsl:value-of select="filename"/>
                                            </xsl:for-each>
                                          </xsl:when>
                                          <xsl:otherwise>
                                            <xsl:value-of select="."/>
                                          </xsl:otherwise>
                                        </xsl:choose>
                                      </td>
                                      </tr>
                                    </xsl:if>
                                  </xsl:for-each>
                    </td>
                  </tr>
                </xsl:for-each>
                <xsl:call-template name="bez_endtext"/>
              </table>
              <!-- Bevestiging bezoekers registratie -->
            </xsl:otherwise>
          </xsl:choose>
        </TD>
        <TD WIDTH="30" ROWSPAN="30" ID="RECHTERMARGE"/>
      </TR>
    </TABLE>
  </xsl:template>


  <xsl:template match="afspraak" mode="full">
    <xsl:choose>
        <xsl:when test="$srtnotificatiecode = 'BEZBEZ' and $mode='email'">
            <xsl:apply-templates select="." mode="bez_afspraak_mail"/>
        </xsl:when>
        <xsl:when test="$srtnotificatiecode = 'BEZBEZ' and $mode='ics'">
            <xsl:apply-templates select="." mode="bez_afspraak_ics"/>
        </xsl:when>
        <xsl:when test="$srtnotificatiecode = 'BEZBEZ' and $mode='summary'">
            <xsl:apply-templates select="." mode="bez_afspraak_summary"/>
        </xsl:when>
        <xsl:when test="$mode='summary'"></xsl:when>
        <xsl:otherwise>
            <html>
              <xsl:comment>================================ AFSPRAKEN ==============================</xsl:comment>
              <xsl:comment>Facilitor default XSL template for afspraak</xsl:comment>
              <xsl:call-template name="htmlhead"/>
              <xsl:element name="body">
                <xsl:if test="$mode!='email'">
                  <xsl:attribute name="onload">window.print();</xsl:attribute>
                </xsl:if>
                <xsl:call-template name="pageheader"/>
                <xsl:apply-templates select="." mode="include"/>
                <xsl:call-template name="pagefooter"/>
              </xsl:element>
            </html>
        </xsl:otherwise>
      </xsl:choose>
  </xsl:template>

  <xsl:template match="afspraak" mode="bez_afspraak_mail">
    <xsl:comment>ADDICS</xsl:comment>

    <xsl:choose>
        <xsl:when test="not(rsv_ruimte)">
            Hierbij ontvangt u een bevestiging van afspraak <xsl:value-of select="key"/>.<br/>
            <xsl:value-of select="opmerking"/>
        </xsl:when>
        <xsl:otherwise>
            Hierbij ontvangt u een uitnodiging voor het bijwonen van <xsl:value-of select="rsv_ruimte/omschrijving"/>.<br/>
            <xsl:value-of select="rsv_ruimte/opmerking"/>
        </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <xsl:template match="afspraak" mode="bez_afspraak_summary">
    <xsl:choose>
        <xsl:when test="not(rsv_ruimte)">
            Bevestiging afspraak <xsl:value-of select="key"/>
        </xsl:when>
        <xsl:otherwise>
            <xsl:value-of select="rsv_ruimte/omschrijving"/>
        </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <xsl:template match="afspraak" mode="bez_afspraak_ics">
BEGIN:VCALENDAR
PRODID:-//Microsoft Corporation//Outlook 16.0 MIMEDIR//EN
VERSION:2.0
METHOD:REQUEST
X-MS-OLK-FORCEINSPECTOROPEN:TRUE
BEGIN:VEVENT
CLASS:PUBLIC
CREATED:<xsl:value-of select="aanmaak/utcdatum"/>T<xsl:value-of select="aanmaak/utctijd"/>Z
DESCRIPTION:
DTEND;TZID="W. Europe Standard Time":<xsl:value-of select="eind/utcdatum"/>T<xsl:value-of select="eind/utctijd"/>Z
DTSTAMP:<xsl:value-of select="datum/utcdatum"/>T<xsl:value-of select="datum/utctijd"/>Z
DTSTART;TZID="W. Europe Standard Time":<xsl:value-of select="datum/utcdatum"/>T<xsl:value-of select="datum/utctijd"/>Z
LAST-MODIFIED:<xsl:value-of select="aanmaak/utcdatum"/>T<xsl:value-of select="aanmaak/utctijd"/>Z
LOCATION:<xsl:choose><xsl:when test="not(rsv_ruimte)"><xsl:value-of select="plaats/regio/district/locatie/omschrijving"/></xsl:when><xsl:otherwise><xsl:value-of select="rsv_ruimte/res_ruimte/nr"/></xsl:otherwise></xsl:choose> (<xsl:value-of select="plaats/regio/district/locatie/plaats"/> - <xsl:value-of select="plaats/regio/district/locatie/adres"/>)
PRIORITY:5
SEQUENCE:0
SUMMARY;LANGUAGE=<xsl:value-of select="/facilitor/header/language"/>:<xsl:value-of select="rsv_ruimte/res_activiteit/omschrijving"/>: <xsl:value-of select="rsv_ruimte/omschrijving"/>
TRANSP:OPAQUE
UID:FCLTBEZ<xsl:value-of select="bezoeker/key"/>
X-MICROSOFT-CDO-BUSYSTATUS:BUSY
X-MICROSOFT-CDO-IMPORTANCE:1
X-MICROSOFT-DISALLOW-COUNTER:FALSE
X-MS-OLK-AUTOFILLLOCATION:FALSE
X-MS-OLK-CONFTYPE:0
BEGIN:VALARM
TRIGGER:-PT15M
ACTION:DISPLAY
DESCRIPTION:Reminder
END:VALARM
END:VEVENT
END:VCALENDAR
  </xsl:template>


  <xsl:template match="bezoeker" mode="include">
      <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" WIDTH="100%">
          <TR>
              <TD WIDTH="40" ROWSPAN="30" ID="LINKERMARGE"/>
              <TD>
              <table border="0" bordercolor="#ffffff" width="100%">
                <tr>
                  <td class="caption" valign="top" colspan="2"><xsl:value-of select="//lcl/BEZ/bezoeker"/>&#xA0;<xsl:value-of select="naam"/><br/></td>
                </tr>
                 <tr>
                   <td class="label" width="20%"><xsl:value-of select="//lcl/FAC/bedrijf"/></td>
                     <td class="value">: <xsl:value-of select="bedrijf"/></td>
                 </tr>
                  <xsl:for-each select="kenmerk[@type!='L' and @type!='l' and @type!='Q' and @type!='b' and @type!='M' and count(@xmlnode)=0]">
                  <xsl:sort select="@volgnummer" data-type="number"/>
                  <xsl:if test=".!=''">
                      <tr>
                         <td class="label"><xsl:value-of select="@naam"/>:</td>
                         <td class="value">: <xsl:value-of select="."/></td>
                      </tr>
                  </xsl:if>
                  </xsl:for-each>
                 <xsl:if test="deel"><tr><td></td><td class="value">: <xsl:value-of select="//lcl/BEZ/parkeerplaats_gereserveerd"/></td></tr></xsl:if>
                <tr>
                  <td class="label" width="20%"><xsl:value-of select="//lcl/BEZ/op_bezoek_bij"/></td>
                  <td class="value" width="80%">: <xsl:value-of select="afspraak/gastheer"/></td>
                </tr>
                 <xsl:if test="done"><tr></tr><tr><td class="label"><xsl:value-of select="//lcl/BEZ/tijd_bezoek"/></td><td class="value">: <xsl:value-of select="done/datum"/>&#xA0;<xsl:value-of select="done/tijd"/> - <xsl:value-of select="out/datum"/>&#xA0;<xsl:value-of select="out/tijd"/></td></tr></xsl:if>
              </table>
              </TD>
              <TD WIDTH="30" ROWSPAN="30" ID="RECHTERMARGE"/>
          </TR>
      </TABLE>
  </xsl:template>

  <xsl:template match="bezoeker" mode="badge">
    <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" WIDTH="100%">
      <tr>
        <td style="text-align:center; font-size:30px; font-weight: bold; height:60px;"><xsl:value-of select="//lcl/BEZ/bezoeker"/></td>
      </tr>
      <tr>
        <td style="text-align:center; font-size:16px; font-weight: bold; height:20px;"><xsl:value-of select="naam"/></td>
      </tr>
      <tr>
        <td style="text-align:center; font-size:16px; font-weight: bold;"><xsl:value-of select="bedrijf"/></td>
      </tr>
      <tr>
        <td style="text-align:right;">
          <xsl:element name="img">
            <xsl:attribute name="src">../../cust/<xsl:value-of select="//header/custId"/>/<xsl:value-of select="//header/fac_logo_file"/></xsl:attribute>
          </xsl:element>
        </td>
      </tr>
    </TABLE>
  </xsl:template>

  <xsl:template match="bezoeker" mode="full">
       <xsl:choose>
            <xsl:when test="$mode='summary'"></xsl:when>
       <xsl:otherwise>
    <html>
      <xsl:comment>================================ BEZOEKER ==============================</xsl:comment>
      <xsl:comment>Facilitor default XSL template for bezoeker</xsl:comment>
      <xsl:call-template name="htmlhead"/>
      <xsl:element name="body">
        <xsl:if test="$mode!='email'">
          <xsl:attribute name="onload">window.print();</xsl:attribute>
        </xsl:if>
        <xsl:choose>
          <xsl:when test="$srtnotificatiecode = 'BEZBAD'">
            <xsl:apply-templates select="." mode="badge"/>
          </xsl:when>
          <xsl:otherwise>
            <xsl:call-template name="pageheader"/>
            <xsl:apply-templates select="." mode="include"/>
            <xsl:call-template name="pagefooter"/>
          </xsl:otherwise>
        </xsl:choose>
      </xsl:element>
    </html>
       </xsl:otherwise>
      </xsl:choose>
  </xsl:template>

  <xsl:template match="melding" mode="include">
    <table border="0" width="100%" cellpadding="2">
      <tr>
        <td colspan="2" class="caption" style="padding-top:20px;padding-bottom:20px">
          <b>
            <xsl:value-of select="//lcl/MLD/melding"/>&#160;<xsl:value-of select="discipline/srtdiscipline/prefix"/><xsl:value-of select="key"/>
            <xsl:if test="onderwerp != ''">:&#160;<xsl:value-of select="onderwerp"/></xsl:if>
          </b>
        </td>
        <td colspan="2" class="caption" style="padding-top:20px;padding-bottom:20px">
          <xsl:if test="spoed&lt;3">
            <b><xsl:value-of select="//lcl/MLD/spoed"/></b>
          </xsl:if>
        </td>
      </tr>
      <xsl:if test="not(//opdracht/extra_key) and extra_key">
        <xsl:variable name="mx_key"><xsl:value-of select="extra_key"/></xsl:variable>
        <tr>
          <td align="right" valign="top" style="padding-top:10px;">
            <b><xsl:value-of select="//lcl/FAC/bericht"/>:</b>
          </td>
          <td colspan="3" style="padding-top:10px;">
            <xsl:call-template name="linebreaks">
                <xsl:with-param name="escaping" select="'no'"/>
              <xsl:with-param name="string" select="fclt:fclthtml(notes/note[key=$mx_key]/omschrijving)"/>
            </xsl:call-template>
          </td>
        </tr>
        <tr>
          <td colspan="4" style="padding-bottom:20px;">
            <hr/>
          </td>
        </tr>
      </xsl:if>
      <tr>
        <td align="right" width="16%">
          <b><xsl:value-of select="//lcl/FAC/aanvrager"/>:</b>
        </td>
        <td align="left" width="34%">
          <xsl:value-of select="voor/naam_full"/>
        </td>
        <td align="right" width="16%">
          <b><xsl:value-of select="//lcl/FAC/telefoon"/>:</b>
        </td>
        <td align="left" width="34%">
          <xsl:if test="voor/telefoonnr=''">-</xsl:if>
          <xsl:value-of select="voor/telefoonnr"/>
        </td>
      </tr>
      <xsl:if test="string(voor/naam_full)!=string(voor/naam_full)">
                          <tr>
                <td align="right" width="16%"><b><xsl:value-of select="//lcl/MLD/meldingvoor"/>:</b></td>
                <td align="left" width="34%"><xsl:value-of select="voor/naam_full"/></td>
              </tr>
            </xsl:if>
      <tr>
        <td align="right">
          <b><xsl:value-of select="//lcl/FAC/locatie"/>:</b>
        </td>
        <td align="left">
          <xsl:value-of select="voor/werkplek/plaats/regio/district/locatie/code"/>&#xA0;
          <xsl:if test="voor/werkplek/plaats/regio/district/locatie/omschrijving!=''">(<xsl:value-of select="voor/werkplek/plaats/regio/district/locatie/omschrijving"/>)</xsl:if>
        </td>
        <td align="right" valign="top">
          <b><xsl:value-of select="//lcl/FAC/afdeling"/>:</b>
        </td>
        <td align="left">
          <xsl:value-of select="voor/afdeling/omschrijving"/>
        </td>
      </tr>
      <xsl:if test="voor/werkplek/plaats/regio/district/locatie/gebouw/code!=''">
          <tr>
            <td align="right" valign="top">
              <b><xsl:value-of select="//lcl/FAC/werkplek"/>:</b>
            </td>
            <td align="left">
              <xsl:value-of select="voor/werkplek/plaats/regio/district/locatie/gebouw/code"/>-<xsl:value-of select="voor/werkplek/plaats/regio/district/locatie/gebouw/naam"/><br/>
                  <xsl:value-of select="voor/werkplek/plaats/regio/district/locatie/gebouw/verdieping/code"/>&#xA0;<xsl:value-of select="voor/werkplek/plaats/regio/district/locatie/gebouw/verdieping/ruimte/nr"/>&#xA0;
              <xsl:if test="voor/werkplek/plaats/regio/district/locatie/gebouw/verdieping/ruimte/omschrijving!=''">(<xsl:value-of select="voor/werkplek/plaats/regio/district/locatie/gebouw/verdieping/ruimte/omschrijving"/>)</xsl:if>
            </td>
            <td colspan="2"/>
          </tr>
      </xsl:if>
      <tr height="40px">
        <td colspan="4">
          <hr/>
        </td>
      </tr>
      <tr>
        <td align="right">
          <b><xsl:value-of select="//lcl/FAC/locatie"/>:</b>
        </td>
        <td align="left">
          <xsl:value-of select="plaats/regio/district/locatie/code"/>&#xA0;
          <xsl:if test="plaats/regio/district/locatie/omschrijving!=''">(<xsl:value-of select="plaats/regio/district/locatie/omschrijving"/>)</xsl:if>
        </td>
        <td align="right">
          <b><xsl:value-of select="//lcl/MLD/status"/>:</b>
        </td>
        <td align="left">
          <xsl:value-of select="status"/>
        </td>
      </tr>
      <tr>
        <xsl:choose>
          <xsl:when test="plaats/@type='T'">
            <td align="right">
              <b><xsl:value-of select="//lcl/FAC/terrein"/>:</b>
            </td>
            <td align="left">
              <xsl:value-of select="plaats/regio/district/locatie/terrein/code"/>-<xsl:value-of select="plaats/regio/district/locatie/terrein/naam"/></td>
          </xsl:when>
          <xsl:otherwise>
            <td align="right">
              <b><xsl:value-of select="//lcl/FAC/gebouw"/>:</b>
            </td>
            <td align="left">
              <xsl:value-of select="plaats/regio/district/locatie/gebouw/code"/>-<xsl:value-of select="plaats/regio/district/locatie/gebouw/naam"/></td>
          </xsl:otherwise>
        </xsl:choose>
        <td align="right">
          <b><xsl:value-of select="//lcl/MLD/melddatum"/>:</b>
        </td>
        <td align="left">
          <xsl:value-of select="gemeld/datum"/>&#xA0;
          <xsl:value-of select="gemeld/tijd"/>
        </td>
      </tr>
      <tr>
        <xsl:if test="plaats/@type='T' or plaats/@type='G'">
          <td colspan="2"/>
        </xsl:if>
        <xsl:if test="plaats/@type!='T' and plaats/@type!='G'">
          <td align="right">
            <b><xsl:value-of select="//lcl/FAC/bouwlaag"/>:</b>
          </td>
          <td align="left">
            <xsl:value-of select="plaats/regio/district/locatie/gebouw/verdieping/code"/>&#xA0;
            <xsl:if test="plaats/regio/district/locatie/gebouw/verdieping/omschrijving!=''">(<xsl:value-of select="plaats/regio/district/locatie/gebouw/verdieping/omschrijving"/>)</xsl:if>
          </td>
        </xsl:if>
        <xsl:choose>
            <xsl:when test="uitvoertijd[@eenheid='U']">
              <td width="16%" align="right">
                <b><xsl:value-of select="//lcl/MLD/uitvoertijd"/>:</b>
              </td>
              <td width="34%">
                <xsl:call-template name="shownumber">
                  <xsl:with-param name="getal" select="uitvoertijd"/>
                  <xsl:with-param name="format" select="'0.##'"/>
                </xsl:call-template>&#160;<xsl:value-of select="//lcl/MLD/uren"/>
              </td>
            </xsl:when>
            <xsl:otherwise>
              <td width="16%" align="right">
                <b><xsl:value-of select="//lcl/MLD/uitvoertijd"/>:</b>
              </td>
              <td width="34%">
                <xsl:value-of select="uitvoertijd"/>&#160;<xsl:value-of select="//lcl/FAC/dagen"/>
              </td>
            </xsl:otherwise>
        </xsl:choose>
      </tr>
      <tr>
        <xsl:if test="plaats/@type='R'">
          <td align="right" valign="top">
            <b><xsl:value-of select="//lcl/FAC/ruimte"/>:</b>
          </td>
          <td align="left">
            <xsl:value-of select="plaats/regio/district/locatie/gebouw/verdieping/ruimte/nr"/>&#xA0;
            <xsl:if test="plaats/regio/district/locatie/gebouw/verdieping/ruimte/omschrijving!=''">(<xsl:value-of select="plaats/regio/district/locatie/gebouw/verdieping/ruimte/omschrijving"/>)</xsl:if>
          </td>
        </xsl:if>
        <xsl:if test="plaats/@type!='R'">
          <td colspan="2"/>
        </xsl:if>
        <td align="right">
          <b><xsl:value-of select="//lcl/MLD/datum_gereed"/>:</b>
        </td>
        <td align="left">
          <xsl:value-of select="datum_gepland/datum"/>&#xA0;<xsl:value-of select="datum_gepland/tijd"/>
        </td>
      </tr>
      <xsl:if test="kenmerk[@naam='Ordernr']!=''">
      <tr>
        <td colspan="2"/>
        <td align="right">
          <b><xsl:value-of select="//lcl/MLD/ordernr"/>:</b>
        </td>
        <td align="left">
          <xsl:value-of select="kenmerk[@naam='Ordernr']"/>
        </td>
      </tr>
      </xsl:if>
      <tr height="30px">
        <td colspan="4"/>
      </tr>
      <tr>
        <td align="right">
          <b><xsl:value-of select="//lcl/MLD/vakgroep"/>:</b>
        </td>
        <td align="left">
          <xsl:if test="discipline/omschrijving=''">-</xsl:if>
          <xsl:value-of select="discipline/omschrijving"/>
        </td>
        <xsl:if test="behandelgroep/omschrijving!=''">
          <td align="right">
            <b><xsl:value-of select="//lcl/MLD/processing_group"/>:</b>
          </td>
          <td align="left">
            <xsl:value-of select="behandelgroep/omschrijving"/>
          </td>
        </xsl:if>
      </tr>
      <tr>
        <td align="right">
          <b><xsl:value-of select="//lcl/MLD/stdmelding"/>:</b>
        </td>
        <td align="left">
          <xsl:if test="stdmelding/omschrijving=''">-</xsl:if>
          <xsl:value-of select="stdmelding/omschrijving"/>
        </td>
        <xsl:if test="behandelgroep/omschrijving!=''">
          <td align="right">
            <b><xsl:value-of select="//lcl/MLD/processor"/>:</b>
          </td>
          <td align="left">
            <xsl:if test="actieve_behandelaar/naam_full=''">-</xsl:if>
            <xsl:value-of select="actieve_behandelaar/naam_full"/>
          </td>
        </xsl:if>
      </tr>
      <tr>
        <td align="right">
          <b><xsl:value-of select="//lcl/FAC/behandelaar"/>:</b>
        </td>
        <td align="left">
          <xsl:if test="behandelaar=''">-</xsl:if>
          <xsl:value-of select="behandelaar/naam_full"/>
        </td>
      </tr>
      <xsl:comment>als we binnen een opdracht zijn, tonen we de meldingtekst niet</xsl:comment>
      <tr>
        <td align="right" valign="top">
          <b><xsl:value-of select="//lcl/FAC/omschrijving"/>:</b>
        </td>
        <td align="left" colspan="3">
          <xsl:call-template name="linebreaks">
            <xsl:with-param name="string" select="omschrijving"/>
          </xsl:call-template>
        </td>
      </tr>
      <xsl:for-each select="kenmerk[@type!='L' and @type!='l' and @type!='Q' and @type!='b' and count(@xmlnode)=0]">
        <xsl:sort select="@volgnummer" data-type="number"/>
        <xsl:if test=".!=''">
          <tr>
            <xsl:choose>
              <xsl:when test="@type='M'">
                <xsl:if test="attachments/attachment/filename!=''"><td><b><xsl:value-of select="@naam"/>:</b></td></xsl:if>
              </xsl:when>
              <xsl:otherwise>
                <td><b><xsl:value-of select="@naam"/>:</b></td>
              </xsl:otherwise>
            </xsl:choose>
              <td colspan="3">
                <xsl:choose>
                  <xsl:when test="attachments!=''">
                    <xsl:for-each select="attachments/attachment">
                      <xsl:sort select="@volgnummer" data-type="number"/>
                      <xsl:if test="position()&gt;1">, </xsl:if><xsl:value-of select="filename"/>
                    </xsl:for-each>
                  </xsl:when>
                  <xsl:otherwise>
                    <xsl:value-of select="."/>
                  </xsl:otherwise>
                </xsl:choose>
              </td>
          </tr>
        </xsl:if>
      </xsl:for-each>
      <xsl:if test="count(deel)&gt;0">
        <xsl:for-each select="deel">
          <xsl:sort select="omschrijving"/>
          <tr>
            <xsl:choose>
              <xsl:when test="position()=1">
                <td align="right" valign="top">
                  <b><xsl:value-of select="//lcl/MLD/objecten"/>:</b>
                </td>
              </xsl:when>
              <xsl:otherwise>
                <td/>
              </xsl:otherwise>
            </xsl:choose>
            <td align="left" valign="top">
              <xsl:value-of select="omschrijving"/>
            </td>
              <xsl:if test="count(controle)&gt;0">
                <td colspan="2" align="left" valign="top">
                  <b><xsl:value-of select="//lcl/MLD/taak"/>: </b> <xsl:value-of select="controle/srtcontrole/omschrijving"/>
                </td>
              </xsl:if>
            <td colspan="2" valign="top">
              <xsl:comment>NADER TE DEFINIEREN</xsl:comment>
            </td>
          </tr>
        </xsl:for-each>
      </xsl:if>
      <xsl:if test="behandelwijze=2 and not(/facilitor/opdracht)">
        <xsl:for-each select="notes/note[flag=1]">
              <xsl:sort select="aanmaak/timestamp" order="ascending"/>
          <tr>
            <xsl:choose>
              <xsl:when test="position() = 1">
                <td align="right" valign="top">
                  <b><xsl:value-of select="//lcl/MLD/behandeling"/>:</b>
                </td>
              </xsl:when>
              <xsl:otherwise>
                <td/>
              </xsl:otherwise>
            </xsl:choose>
            <td colspan="3">
              <span class="mldbeh"><xsl:value-of select="aanmaak/datum"/>&#xA0;<xsl:value-of select="aanmaak/tijd"/>&#xA0;-&#xA0;<xsl:value-of select="noteur/naam_friendly"/></span>&#xA0;
              <xsl:call-template name="linebreaks">
                <xsl:with-param name="string" select="omschrijving"/>
              </xsl:call-template>
            </td>
          </tr>
        </xsl:for-each>
      </xsl:if>
      <xsl:if test="opmerking!=''">
        <tr>
          <td align="right" valign="top">
            <b><xsl:value-of select="//lcl/MLD/afhandeling"/>:</b>
          </td>
          <td colspan="3">
            <xsl:call-template name="linebreaks">
              <xsl:with-param name="string" select="opmerking"/>
            </xsl:call-template>
          </td>
        </tr>
      </xsl:if>
    </table>
  </xsl:template>

   <xsl:template match="melding" mode="kto">
      <br/>Geachte heer/mevrouw <xsl:value-of select="voor/tussenvoegsel"/>&#xA0;<xsl:value-of select="voor/naam"/>,<br/><br/>
    <br/>De melding <xsl:value-of select="discipline/srtdiscipline/prefix"/><xsl:value-of select="key"/> (<xsl:value-of select="stdmelding/omschrijving"/>) is onlangs verwerkt.
    <br/>Om je in de toekomst nog beter van dienst te kunnen zijn is je mening omtrent de uitgevoerde werkzaamheden van belang.
    <br/>Wij verzoeken je
    <xsl:call-template name="kto_url">
      <xsl:with-param name="bmr">m</xsl:with-param>
    </xsl:call-template> te volgen en je reactie te geven. Het invullen van dit formulier duurt ongeveer 2 minuten.
    <br/>Bij voorbaat hartelijk dank voor je medewerking.
    <br/>
    <br/>Facilitair Service Centre
    <br/>
      <br/>Onderstaand tref je de gegevens van deze melding nogmaals aan:<br/><br/><br/>
    <xsl:apply-templates select="." mode="include"/>
  </xsl:template>

  <xsl:template match="melding" mode="full">
       <xsl:choose>
            <xsl:when test="$mode='summary'"></xsl:when>
       <xsl:otherwise>
    <html>
      <xsl:comment>================================ MELDINGEN ==============================</xsl:comment>
      <xsl:comment>Facilitor default XSL template for melding</xsl:comment>
      <xsl:call-template name="htmlhead"/>
      <xsl:element name="body">
        <xsl:if test="$mode!='email' and $mode!='share' ">
          <xsl:attribute name="onload">window.print();</xsl:attribute>
        </xsl:if>
        <xsl:call-template name="pageheader"/>
        <xsl:choose>
            <xsl:when test="$mode = 'share'">
                <div>Melding <xsl:value-of select="discipline/srtdiscipline/prefix"/><xsl:value-of select="key"/> (<xsl:value-of select="stdmelding/omschrijving"/>)
                    <xsl:element name="a">
                        <xsl:attribute name="href">https://<xsl:value-of select="$FacilitorRoot"/>?<xsl:value-of select="../bookmarks/melding"/><xsl:value-of select="key"/></xsl:attribute>
                        <xsl:attribute name="target">_new</xsl:attribute>#<xsl:value-of select="key"/>
                    </xsl:element>
                    <xsl:if test="onderwerp != ''">&#160;<br/><span class="subj"><xsl:value-of select="onderwerp"/></span></xsl:if>
                </div>
            </xsl:when>
            <xsl:when test="$srtnotificatiecode = 'MLDKTO'">
                <xsl:apply-templates select="." mode="kto"/>
            </xsl:when>
            <xsl:otherwise>
                <xsl:apply-templates select="." mode="include"/>
            </xsl:otherwise>
        </xsl:choose>
        <xsl:call-template name="pagefooter"/>
      </xsl:element>
    </html>
       </xsl:otherwise>
      </xsl:choose>
  </xsl:template>

  <xsl:template match="opdracht" mode="include">
    <xsl:variable name="uitvoerende_cp">
      <xsl:value-of select="contactpersoon/voorletters"/><xsl:if test="contactpersoon/voorletters!=''"><xsl:text> </xsl:text></xsl:if><xsl:value-of select="contactpersoon/tussenv"/><xsl:if test="contactpersoon/tussenv!=''"><xsl:text> </xsl:text></xsl:if><xsl:value-of select="contactpersoon/naam"/>
    </xsl:variable>
    <table border="0" width="100%" cellpadding="2">
      <xsl:choose>
        <!-- ORDNOL -->
        <xsl:when test="$srtnotificatiecode='ORDNOL'">
          <tr>
            <td colspan="4">
              <xsl:choose><xsl:when test="contactpersoon/voornaam!=''">Beste <xsl:value-of select="contactpersoon/voornaam"/></xsl:when><xsl:when test="$uitvoerende_cp!=''">Beste <xsl:value-of select="$uitvoerende_cp"/></xsl:when><xsl:otherwise>Beste</xsl:otherwise></xsl:choose>,
              <!--br/><br/>Er is een notitie gemaakt bij opdracht <xsl:element name="a"><xsl:attribute name="href">https://<xsl:value-of select="$FacilitorRoot"/>?<xsl:value-of select="../bookmarks/opdracht"/><xsl:value-of select="key"/>&amp;urole=b2&amp;sso=1</xsl:attribute><xsl:value-of select="melding/stdmelding/discipline/srtdiscipline/prefix"/><xsl:value-of select="melding/key"/>/<xsl:value-of select="bedrijfopdr_volgnr"/></xsl:element> in Facilitor.-->
              <br/><br/>Er is een notitie gemaakt bij opdracht <xsl:value-of select="melding/stdmelding/discipline/srtdiscipline/prefix"/><xsl:value-of select="melding/key"/>/<xsl:value-of select="bedrijfopdr_volgnr"/> in Facilitor.
            </td>
          </tr>
          <xsl:if test="extra_key">
            <xsl:variable name="ox_key"><xsl:value-of select="extra_key"/></xsl:variable>
            <tr>
              <td width="12%" style="padding-top:10px;">
                <b><xsl:value-of select="//lcl/FAC/bericht"/>:</b>
              </td>
              <td colspan="3" style="padding-top:10px;">
                <xsl:call-template name="linebreaks">
                  <xsl:with-param name="escaping" select="'no'"/>
                  <xsl:with-param name="string" select="fclt:fclthtml(notes/note[key=$ox_key]/omschrijving)"/>
                </xsl:call-template>
              </td>
            </tr>
          </xsl:if>
          <!-- Per 2025.3 herkenbaar welke leverancier opdrachten kunnen behandelen via Facilitor-leveranciersportaal? -->
          <!--xsl:if test="uitvoerende/bedrijf/bedrijfadres/lockeduser">
            <tr>
              <td colspan="4" style="padding-top:10px;">
                Scan de QR-code hieronder of klik <xsl:element name="a"><xsl:attribute name="href">https://<xsl:value-of select="$FacilitorRoot"/>/lockeduser(opdracht,<xsl:value-of select="key"/>,<xsl:value-of select="uitvoerende/bedrijf/key"/>)</xsl:attribute><u>hier</u></xsl:element> om te reageren via het Facilitor-leveranciersportaal.
              </td>
            </tr>
            <tr>
              <td colspan="4" style="padding-top:10px;">
                <xsl:element name="img">
                  <xsl:attribute name="style">height:125px;width:125px;margin:0cm;padding:0;border:none;</xsl:attribute>
                  <xsl:attribute name="qrc">https://<xsl:value-of select="$FacilitorRoot"/>/lockeduser(opdracht,<xsl:value-of select="key"/>,<xsl:value-of select="uitvoerende/bedrijf/key"/>)</xsl:attribute>
                </xsl:element>
              </td>
            </tr>
          </xsl:if-->
        </xsl:when>

        <!-- ORDMEN -->
        <xsl:when test="$srtnotificatiecode='ORDMEN'">
          <tr>
            <td colspan="4">
              Beste <xsl:value-of select="backoffice_contact/voornaam"/>,
              <!--br/><br/>Er is een notitie gemaakt bij opdracht <xsl:element name="a"><xsl:attribute name="href">https://<xsl:value-of select="$FacilitorRoot"/>?<xsl:value-of select="../bookmarks/opdracht"/><xsl:value-of select="key"/>&amp;urole=bo&amp;sso=1</xsl:attribute><xsl:value-of select="melding/stdmelding/discipline/srtdiscipline/prefix"/><xsl:value-of select="melding/key"/>/<xsl:value-of select="bedrijfopdr_volgnr"/></xsl:element> in Facilitor.-->
              <br/><br/>Er is een notitie gemaakt bij opdracht <xsl:value-of select="melding/stdmelding/discipline/srtdiscipline/prefix"/><xsl:value-of select="melding/key"/>/<xsl:value-of select="bedrijfopdr_volgnr"/> in Facilitor.
            </td>
          </tr>
          <xsl:if test="extra_key">
            <xsl:variable name="ox_key"><xsl:value-of select="extra_key"/></xsl:variable>
            <tr>
              <td width="12%" style="padding-top:10px;">
                <b><xsl:value-of select="//lcl/FAC/bericht"/>:</b>
              </td>
              <td colspan="3" style="padding-top:10px;">
                <xsl:call-template name="linebreaks">
                  <xsl:with-param name="escaping" select="'no'"/>
                  <xsl:with-param name="string" select="fclt:fclthtml(notes/note[key=$ox_key]/omschrijving)"/>
                </xsl:call-template>
              </td>
            </tr>
          </xsl:if>
        </xsl:when>

        <!-- STANDAARD/UITVOERINGSOPDRACHT of OFFERTEAANVRAAG -->
        <xsl:otherwise>
          <!-- Contactgegevens extern bedrijf/uitvoerende -->
          <xsl:if test="uitvoerende/bedrijf">
            <tr>
              <td colspan="4">
                <br/><xsl:value-of select="uitvoerende/bedrijf/naam"/>
                <xsl:if test="$uitvoerende_cp!=''"><br/>T.a.v. <xsl:value-of select="$uitvoerende_cp"/></xsl:if>
                <xsl:choose>
                  <xsl:when test="uitvoerende/bedrijf/post_adres!='' and uitvoerende/bedrijf/post_plaats!=''">
                    <br/><xsl:value-of select="uitvoerende/bedrijf/post_adres"/>
                    <br/><xsl:value-of select="uitvoerende/bedrijf/post_postcode"/><xsl:text>  </xsl:text><xsl:value-of select="uitvoerende/bedrijf/post_plaats"/>
                    <br/><xsl:if test="uitvoerende/bedrijf/post_land!='Nederland' or uitvoerende/bedrijf/post_land!='NL'"><xsl:value-of select="uitvoerende/bedrijf/post_land"/></xsl:if>
                  </xsl:when>
                  <xsl:when test="uitvoerende/bedrijf/bezoek_adres!='' and uitvoerende/bedrijf/bezoek_plaats!=''">
                    <br/><xsl:value-of select="uitvoerende/bedrijf/bezoek_adres"/>
                    <br/><xsl:value-of select="uitvoerende/bedrijf/bezoek_postcode"/><xsl:text>  </xsl:text><xsl:value-of select="uitvoerende/bedrijf/bezoek_plaats"/>
                    <br/><xsl:if test="uitvoerende/bedrijf/bezoek_land!='Nederland' or uitvoerende/bedrijf/bezoek_land!='NL'"><xsl:value-of select="uitvoerende/bedrijf/bezoek_land"/></xsl:if>
                  </xsl:when>
                </xsl:choose>
              </td>
            </tr>
          </xsl:if>

          <!-- Kop (opdrachttype/nummer) -->
          <tr>
            <td colspan="4" class="caption" style="padding-top:20px;padding-bottom:10px">
              <b>
                <xsl:choose>
                  <xsl:when test="statusopdr_key = 10 and statusopdr_key_refiat&gt;0">
                    <xsl:value-of select="//lcl/MLD/hergoedkeuring"/>:&#xA0;
                  </xsl:when>
                  <xsl:when test="(statusopdr_key = 3 or statusopdr_key = 4) and statusopdr_key_refiat&gt;0">
                    <xsl:value-of select="//lcl/MLD/herfiattering"/>:&#xA0;
                  </xsl:when>
                </xsl:choose>
                <xsl:value-of select="opdrachttype/omschrijving"/>&#xA0;
                <xsl:value-of select="melding/stdmelding/discipline/srtdiscipline/prefix"/>
                <xsl:value-of select="melding/key"/>/<xsl:value-of select="bedrijfopdr_volgnr"/>
              </b>
            </td>
          </tr>

          <!-- Laatste notitie (optioneel) -->
          <xsl:if test="extra_key">
            <xsl:variable name="ox_key"><xsl:value-of select="extra_key"/></xsl:variable>
            <tr>
              <td width="12%" style="padding-top:10px;">
                <b><xsl:value-of select="//lcl/FAC/bericht"/>:</b>
              </td>
              <td colspan="3" style="padding-top:10px;">
                <xsl:call-template name="linebreaks">
                  <xsl:with-param name="escaping" select="'no'"/>
                  <xsl:with-param name="string" select="fclt:fclthtml(notes/note[key=$ox_key]/omschrijving)"/>
                </xsl:call-template>
              </td>
            </tr>
            <tr>
              <td colspan="4">
                <hr/>
              </td>
            </tr>
          </xsl:if>

          <!-- Aanmaak/behandelaar/opdrachtnummer -->
          <tr>
            <!--td width="12%"><br/>Datum:</td-->
            <!--td width="38%"><br/><xsl:value-of select="substring-before(//dateTime, ' ')"/></td-->
            <xsl:choose>
              <xsl:when test="verzonden/datum!=''">
                  <td width="12%"><br/><xsl:value-of select="//lcl/FAC/datum_verzonden"/>:</td>
                  <td width="38%"><br/><xsl:value-of select="verzonden/datum"/></td>
              </xsl:when>
              <xsl:otherwise>
                  <td width="12%"><br/><xsl:value-of select="//lcl/FAC/printdatum"/>:</td>
                  <td width="38%"><br/><xsl:value-of select="datumbegin/datum"/></td>
              </xsl:otherwise>
            </xsl:choose>
            <td width="12%"><br/><xsl:value-of select="//lcl/FAC/e-mail"/>:</td>
            <td><br/><xsl:value-of select="backoffice_contact/naam_full"/></td>
          </tr>
          <tr>
            <td><br/><xsl:value-of select="//lcl/MLD/ordernr"/>:</td>
            <!--td><br/><xsl:element name="a"><xsl:attribute name="href">https://<xsl:value-of select="$FacilitorRoot"/>?<xsl:value-of select="../bookmarks/opdracht"/><xsl:value-of select="key"/></xsl:attribute><xsl:value-of select="discipline/srtdiscipline/prefix"/><xsl:value-of select="melding/key"/>/<xsl:value-of select="bedrijfopdr_volgnr"/></xsl:element></td-->
            <td><br/><xsl:value-of select="discipline/srtdiscipline/prefix"/><xsl:value-of select="melding/key"/>/<xsl:value-of select="bedrijfopdr_volgnr"/></td>
            <td><br/><xsl:value-of select="//lcl/FAC/telefoon"/>:</td>
            <td><br/><xsl:value-of select="backoffice_contact/telefoonnr"/></td>
          </tr>
          <!--tr>
            <td><br/><xsl:value-of select="//lcl/MLD/datum_gereed"/>:</td>
            <td><br/><xsl:value-of select="datumgereed/datum"/></td>
            <td><br/><xsl:value-of select="//lcl/MLD/status"/>:</td>
            <td><br/><xsl:value-of select="status"/></td>
          </tr-->

          <!-- Plaatsgegevens -->
          <xsl:if test="melding/plaats/regio/district/locatie!=''">
            <tr>
              <td width="18%"><br/><xsl:value-of select="//lcl/FAC/locatie"/>:</td>
              <td width="32%"><br/><xsl:value-of select="melding/plaats/regio/district/locatie/code"/> (<xsl:value-of select="melding/plaats/regio/district/locatie/omschrijving"/>)</td>
              <td width="18%"></td>
              <td width="32%"></td>
            </tr>
          </xsl:if>
          <xsl:if test="melding/plaats/regio/district/locatie/adres!=''">
            <tr>
              <td><xsl:value-of select="//lcl/FAC/adres"/>:</td>
              <td colspan="3"><xsl:value-of select="melding/plaats/regio/district/locatie/adres"/>, <xsl:value-of select="melding/plaats/regio/district/locatie/postcode"/><xsl:text>  </xsl:text><xsl:value-of select="melding/plaats/regio/district/locatie/plaats"/></td>
            </tr>
          </xsl:if>
          <xsl:choose>
            <xsl:when test="melding/plaats/regio/district/locatie/terrein!=''">
              <tr>
                <td><xsl:value-of select="//lcl/FAC/terrein"/>:</td>
                <td colspan="3">
                  <xsl:value-of select="melding/plaats/regio/district/locatie/terrein/code"/>&#xA0;
                  <xsl:if test="melding/plaats/regio/district/locatie/terrein/naam!=''">(<xsl:value-of select="melding/plaats/regio/district/locatie/terrein/naam"/>)</xsl:if>
                </td>
              </tr>
            </xsl:when>
            <xsl:when test="melding/plaats/regio/district/locatie/gebouw!=''">
              <tr>
                <td><xsl:value-of select="//lcl/FAC/gebouw"/>:</td>
                <td colspan="3">
                  <xsl:value-of select="melding/plaats/regio/district/locatie/gebouw/code"/>&#xA0;
                  <xsl:if test="melding/plaats/regio/district/locatie/gebouw/naam!=''">(<xsl:value-of select="melding/plaats/regio/district/locatie/gebouw/naam"/>)</xsl:if>
                </td>
              </tr>
            </xsl:when>
            <xsl:otherwise/>
          </xsl:choose>
          <xsl:choose>
            <xsl:when test="melding/plaats/regio/district/locatie/gebouw/verdieping!=''">
              <tr>
                <td><xsl:value-of select="//lcl/FAC/bouwlaag"/>:</td>
                <td colspan="3"><xsl:value-of select="melding/plaats/regio/district/locatie/gebouw/verdieping/code"/></td>
              </tr>
            </xsl:when>
            <xsl:otherwise/>
          </xsl:choose>
          <xsl:choose>
            <xsl:when test="melding/plaats/regio/district/locatie/gebouw/verdieping/ruimte!=''">
              <tr>
                <td><xsl:value-of select="//lcl/FAC/ruimte"/>:</td>
                <td colspan="3">
                  <xsl:value-of select="melding/plaats/regio/district/locatie/gebouw/verdieping/ruimte/nr"/>&#xA0;
                  <xsl:if test="melding/plaats/regio/district/locatie/gebouw/verdieping/ruimte/omschrijving!=''">(<xsl:value-of select="melding/plaats/regio/district/locatie/gebouw/verdieping/ruimte/omschrijving"/>)</xsl:if>
                </td>
              </tr>
            </xsl:when>
            <xsl:otherwise/>
          </xsl:choose>

          <!-- Intro -->
          <xsl:choose>
            <!-- Externe opdracht -->
            <xsl:when test="uitvoerende/bedrijf">
              <tr>
                <td colspan="4">
                  <br/><br/>Geachte heer, mevrouw,
                  <xsl:choose>
                    <xsl:when test="opdrachttype/isofferte=1">
                      <br/><br/>Hierbij nodigen wij u uit om een offerte uit te brengen voor onderstaande werkzaamheden.
                      <br/>Wij zien uw offerte, voorzien van ons kenmerk <b><xsl:value-of select="melding/stdmelding/discipline/srtdiscipline/prefix"/><xsl:value-of select="melding/key"/>/<xsl:value-of select="bedrijfopdr_volgnr"/></b>, graag binnen 2 weken tegemoet.
                    </xsl:when>
                    <xsl:when test="offerte/opdracht!=''">
                      <br/><br/>Hierbij verlenen wij u de opdracht voor onderstaande werkzaamheden conform uw offerte.
                      <xsl:if test="kenmerk[@kenmerkcode='OFFERTEREF']!=''"><br/>Offertereferentie: <xsl:value-of select="kenmerk[@kenmerkcode='OFFERTEREF']"/></xsl:if>
                      <xsl:if test="kosten&gt;0"><br/>Offertebedrag:&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;€ <xsl:value-of select="format-number(kosten, '0,00', 'european')"/></xsl:if>
                      </xsl:when>
                    <xsl:otherwise>
                      <br/><br/>Hierbij verlenen wij u de opdracht voor onderstaande werkzaamheden.
                    </xsl:otherwise>
                  </xsl:choose>
                </td>
              </tr>
            </xsl:when>
            <!-- Interne opdracht -->
            <xsl:otherwise>
              <tr>
                <td colspan="4">
                  <br/><br/>Beste <xsl:value-of select="uitvoerende/persoon/naam_friendly"/>,
                  <br/><br/>Hierbij het verzoek om de onderstaande werkzaamheden uit te voeren.
                </td>
              </tr>
            </xsl:otherwise>
          </xsl:choose>

          <!-- Opdrachtomschrijving -->
          <!--tr>
            <td><b><xsl:value-of select="//lcl/FAC/omschrijving"/>:</b></td>
            <td colspan="3"><xsl:call-template name="linebreaks"><xsl:with-param name="string" select="omschrijving"/></xsl:call-template></td>
          </tr-->
          <tr>
            <td colspan="4"><br/><b><xsl:value-of select="//lcl/FAC/omschrijving"/>:</b></td>
          </tr>
          <tr>
            <td colspan="4">
              <xsl:call-template name="linebreaks"><xsl:with-param name="string" select="omschrijving"/></xsl:call-template>
            </td>
          </tr>

          <!-- Opdrachtkenmerken? => Desgewenst klantspecifiek -->
          <!--xsl:for-each select="kenmerk[@type!='L' and @type!='l' and @type!='Q' and @type!='b' and count(@xmlnode)=0 and @key!='-1']">
            <xsl:sort select="@volgnummer" data-type="number"/>
            <xsl:choose>
              <xsl:when test="attachments/attachment/filename!=''">
                <tr>
                  <td><xsl:if test="position()=1"><br/></xsl:if><b><xsl:value-of select="@naam"/></b>:</td>
                  <td colspan="3">
                    <xsl:if test="position()=1"><br/></xsl:if>
                    <xsl:for-each select="attachments/attachment">
                      <xsl:sort select="filedate/timestamp" data-type="number"/>
                      <xsl:if test="position()&gt;1">,</xsl:if><xsl:value-of select="filename"/>
                    </xsl:for-each>
                  </td>
                </tr>
              </xsl:when>
              <xsl:when test="@type!='M' and .!=''">
                <tr>
                  <td><xsl:if test="position()=1"><br/></xsl:if><b><xsl:value-of select="@naam"/></b>:</td>
                  <td colspan="3">
                    <xsl:if test="position()=1"><br/></xsl:if>
                    <xsl:value-of select="."/>
                  </td>
                </tr>
              </xsl:when>
              <xsl:otherwise/>
            </xsl:choose>
          </xsl:for-each-->

          <!-- Meldingobject(en)! -->
          <xsl:for-each select="melding/deel">
            <xsl:sort select="omschrijving"/>
            <tr>
              <xsl:choose>
                <xsl:when test="position()=1">
                  <td><br/><b><xsl:value-of select="//lcl/MLD/objecten"/>:</b></td>
                  <td colspan="3"><br/><xsl:value-of select="//opdracht/melding/deel/srtdeel/omschrijving"/> / <xsl:value-of select="omschrijving"/></td>
                </xsl:when>
                <xsl:otherwise>
                  <td/>
                  <td colspan="3"><xsl:value-of select="//opdracht/melding/deel/srtdeel/omschrijving"/> / <xsl:value-of select="omschrijving"/></td>
                </xsl:otherwise>
              </xsl:choose>
            </tr>
          </xsl:for-each>

          <!-- Opdrachtopmerking? => Desgewenst klantspecifiek -->
          <!--xsl:if test="opmerking!=''">
            <tr>
              <td colspan="4"><br/><b><xsl:value-of select="//lcl/FAC/opmerking"/>:</b></td>
            </tr>
            <tr>
              <td colspan="4">
                <xsl:call-template name="linebreaks"><xsl:with-param name="string" select="opmerking"/></xsl:call-template>
              </td>
            </tr>
          </xsl:if-->

          <!-- Kosten? => Op oude manier helemaal weg (en desgewenst klantspecifiek)? -->
          <!--table border="0" width="100%" cellpadding="2">
              <tr><td colspan="6"><br/><hr/></td></tr>
              <xsl:variable name="arbeid" select="uren*uurloon"/>
              <xsl:variable name="arbeid_refiat" select="uren_refiat*uurloon_refiat"/>
              <tr>
                  <td><b><xsl:value-of select="//lcl/MLD/uren"/>:</b></td>
                  <td>
                      <xsl:call-template name="shownumber">
                          <xsl:with-param name="getal" select="uren"/>
                          <xsl:with-param name="format" select="'0,00@EU'"/>
                      </xsl:call-template>
                      <b>&#xA0;à&#xA0;</b>&#x20AC;&#xA0;
                      <xsl:call-template name="shownumber">
                          <xsl:with-param name="getal" select="uurloon"/>
                          <xsl:with-param name="format" select="'0,00@EU'"/>
                      </xsl:call-template>
                  </td>
                  <td style="width:2in;text-align:left">
                      <xsl:if test="statusopdr_key_refiat&gt;0">
                          (<xsl:value-of select="//lcl/MLD/was"/>&#xA0;
                          <xsl:call-template name="shownumber">
                              <xsl:with-param name="getal" select="uren"/>
                              <xsl:with-param name="format" select="'0,00@EU'"/>
                          </xsl:call-template>
                          <b>&#xA0;à&#xA0;</b>&#x20AC;&#xA0;
                          <xsl:call-template name="shownumber">
                              <xsl:with-param name="getal" select="uurloon"/>
                              <xsl:with-param name="format" select="'0,00@EU'"/>
                          </xsl:call-template>)
                      </xsl:if>
                  </td>
                  <td><b><xsl:value-of select="//lcl/MLD/arbeid"/>:</b></td>
                  <td style="width:1in;text-align:right">&#x20AC;&#xA0;
                      <xsl:call-template name="shownumber">
                          <xsl:with-param name="getal" select="$arbeid"/>
                          <xsl:with-param name="format" select="'0,00@EU'"/>
                      </xsl:call-template>
                  </td>
                  <td style="width:1in;text-align:right">
                      <xsl:if test="statusopdr_key_refiat&gt;0">
                          (<xsl:value-of select="//lcl/MLD/was"/>&#xA0;&#x20AC;&#xA0;
                          <xsl:call-template name="shownumber">
                              <xsl:with-param name="getal" select="$arbeid_refiat"/>
                              <xsl:with-param name="format" select="'0,00@EU'"/>
                          </xsl:call-template>)
                      </xsl:if>
                  </td>
              </tr>
              <xsl:if test="string(number(materiaal))!='NaN'">
                  <tr>
                      <td colspan="3"/>
                      <td><b><xsl:value-of select="//lcl/MLD/materiaal"/>:</b></td>
                      <td style="width:1in;text-align:right">&#x20AC;&#xA0;
                          <xsl:call-template name="shownumber">
                              <xsl:with-param name="getal" select="materiaal"/>
                              <xsl:with-param name="format" select="'0,00@EU'"/>
                          </xsl:call-template>
                      </td>
                      <td style="width:1in;text-align:right">
                          <xsl:if test="statusopdr_key_refiat&gt;0">
                              (<xsl:value-of select="//lcl/MLD/was"/>&#xA0;&#x20AC;&#xA0;
                              <xsl:call-template name="shownumber">
                                  <xsl:with-param name="getal" select="materiaal_refiat"/>
                                  <xsl:with-param name="format" select="'0,00@EU'"/>
                              </xsl:call-template>)
                          </xsl:if>
                      </td>
                  </tr>
              </xsl:if>
              <xsl:variable name="correctie0" select="$arbeid + materiaal"/>
              <xsl:variable name="correctie" select="kosten - $correctie0"/>
              <xsl:variable name="correctie0_refiat" select="$arbeid_refiat + materiaal_refiat"/>
              <xsl:variable name="correctie_refiat" select="kosten_refiat - $correctie0_refiat"/>
              <xsl:if test="string(number($correctie))!='NaN' and $correctie!=0">
                  <tr>
                      <td colspan="3"/>
                      <td><b><xsl:value-of select="//lcl/MLD/correctie"/>:</b></td>
                      <td style="width:1in;text-align:right">&#x20AC;&#xA0;
                          <xsl:call-template name="shownumber">
                              <xsl:with-param name="getal" select="$correctie"/>
                              <xsl:with-param name="format" select="'0,00@EU'"/>
                          </xsl:call-template>
                      </td>
                      <td style="width:1in;text-align:right">
                          <xsl:if test="statusopdr_key_refiat&gt;0">
                              (<xsl:value-of select="//lcl/MLD/was"/>&#xA0;&#x20AC;&#xA0;
                              <xsl:call-template name="shownumber">
                                  <xsl:with-param name="getal" select="$correctie_refiat"/>
                                  <xsl:with-param name="format" select="'0,00@EU'"/>
                              </xsl:call-template>)
                          </xsl:if>
                      </td>
                  </tr>
              </xsl:if>
              <tr>
                  <td colspan="3"/>
                  <td><b><xsl:value-of select="//lcl/FAC/totaal"/>:</b></td>
                  <td style="width:1in;text-align:right">
                      <b>&#x20AC;&#xA0;
                          <xsl:call-template name="shownumber">
                              <xsl:with-param name="getal" select="kosten"/>
                              <xsl:with-param name="format" select="'0,00@EU'"/>
                          </xsl:call-template>
                      </b>
                  </td>
                  <td style="width:1in;text-align:right">
                      <xsl:if test="statusopdr_key_refiat&gt;0">
                          (<xsl:value-of select="//lcl/MLD/was"/>&#xA0;&#x20AC;&#xA0;
                          <xsl:call-template name="shownumber">
                              <xsl:with-param name="getal" select="kosten_refiat"/>
                              <xsl:with-param name="format" select="'0,00@EU'"/>
                          </xsl:call-template>)
                      </xsl:if>
                  </td>
              </tr>
          </table-->
        </xsl:otherwise>
      </xsl:choose>

      <!-- Uniforme handtekening => Desgewenst klantspecifiek -->
    </table>
  </xsl:template>

  <xsl:template match="opdracht" mode="full">
       <xsl:choose>
            <xsl:when test="$mode='summary'"></xsl:when>
       <xsl:otherwise>
    <html>
      <xsl:comment>================================ OPDRACHTEN ==============================</xsl:comment>
      <xsl:comment>Facilitor default XSL template for opdracht</xsl:comment>
      <xsl:call-template name="htmlhead"/>
      <xsl:element name="body">
        <xsl:if test="$mode!='email' and $mode!='share'">
          <xsl:attribute name="onload">window.print();</xsl:attribute>
        </xsl:if>
        <xsl:choose>
            <xsl:when test="$mode = 'share'">
            <div>Opdracht <xsl:value-of select="melding/discipline/srtdiscipline/prefix"/><xsl:value-of select="melding/key"/>/<xsl:value-of select="bedrijfopdr_volgnr"/> (<xsl:value-of select="melding/stdmelding/omschrijving"/>)
            <xsl:element name="a">
              <xsl:attribute name="href">https://<xsl:value-of select="$FacilitorRoot"/>?<xsl:value-of select="../bookmarks/opdracht"/><xsl:value-of select="key"/></xsl:attribute>
              <xsl:attribute name="target">_new</xsl:attribute>#<xsl:value-of select="melding/key"/>/<xsl:value-of select="bedrijfopdr_volgnr"/>
            </xsl:element>
            <xsl:if test="onderwerp != ''">&#160;<br/><span class="subj"><xsl:value-of select="melding/onderwerp"/></span></xsl:if>
            </div>
            </xsl:when>
            <xsl:otherwise>
                <xsl:call-template name="pageheader"/>
                <xsl:apply-templates select="." mode="include"/>
                <xsl:call-template name="pagefooter"/>
            </xsl:otherwise>
        </xsl:choose>
      </xsl:element>
    </html>
       </xsl:otherwise>
      </xsl:choose>
  </xsl:template>

  <xsl:template match="header"/>

  <xsl:template match="scenario" mode="full">
    <html>
      <xsl:comment>Facilitor default XSL template for scenario</xsl:comment>
      <xsl:call-template name="htmlhead"/>
      <body onload="window.print();">
        <xsl:call-template name="pageheader"/>
        <table border="0" width="100%" cellpadding="2">
          <tr height="100px">
            <td colspan="5" class="caption" style="text-align:center"><xsl:value-of select="//lcl/PRJ/facilitor_verhuisscenario"/></td>
          </tr>
          <tr height="80px">
            <td colspan="5" class="caption" style="text-align:center">
              <b>
                <xsl:value-of select="omschrijving"/>
              </b>
            </td>
          </tr>
          <tr>
            <td colspan="5" style="text-align:center">
              <b>
                <xsl:value-of select="status"/>
              </b>
            </td>
          </tr>
          <tr>
            <td width="19%"/>
            <td width="19%"/>
            <td width="19%"/>
            <td width="19%"/>
            <td width="19%"/>
          </tr>
          <tr>
            <td/>
            <td colspan="3">
              <xsl:value-of select="opmerking"/>
            </td>
            <td/>
          </tr>
          <tr>
            <td height="20px" colspan="5"/>
          </tr>
          <tr height="120px">
            <td colspan="3"/>
            <td style="vertical-align:top">
              <b><xsl:value-of select="//lcl/PRJ/opgesteld_door"/></b>
            </td>
            <td/>
          </tr>
          <tr>
            <td colspan="3"/>
            <td colspan="2" style="vertical-align:top"><xsl:value-of select="//lcl/FAC/behandelaar"/>:&#xA0;<xsl:value-of select="behandelaar/naam_full"/><br/>
        <xsl:value-of select="//lcl/FAC/telefoon"/>&#xA0;<xsl:value-of select="behandelaar/telefoonnr"/><br/>
              <xsl:value-of select="behandelaar/kenmerk[@naam='Email']"/>
            </td>
          </tr>
          <tr>
            <td colspan="3"/>
            <td style="vertical-align:top">
              <b><xsl:value-of select="//lcl/PRJ/in_opdracht_van"/></b>
            </td>
            <td/>
          </tr>
          <tr>
            <td colspan="3"/>
            <td colspan="2" style="vertical-align:top">
              <xsl:value-of select="melding/melder/naam"/>
              <br/><xsl:value-of select="//lcl/PRJ/aanvraag_nummer"/>&#xA0;<xsl:value-of select="melding/key"/><br/>
        <xsl:value-of select="//lcl/PRJ/aanvraag_datum"/>&#xA0;<xsl:value-of select="melding/datum"/><br/>
        <xsl:value-of select="//lcl/FAC/kostenplaats"/>&#xA0;<xsl:value-of select="melding/kostenplaats/nr"/>&#xA0;<xsl:value-of select="melding/kostenplaats/omschrijving"/><br/>
        <xsl:value-of select="//lcl/MLD/ordernr"/>&#xA0;<xsl:value-of select="melding/ordernr"/><br/></td>
          </tr>
          <tr>
            <td class="pagebreak"/>
          </tr>
          <tr height="80px">
            <td colspan="5" class="caption" style="text-align:center">
              <b><xsl:value-of select="//lcl/PRJ/samenvatting"/></b>
            </td>
          </tr>
          <tr>
            <td colspan="5">
              <xsl:value-of select="melding/omschrijving"/>
              <br/>
            </td>
          </tr>
          <tr>
            <td colspan="5"><xsl:value-of select="//lcl/PRJ/samenvatting_text1"/></td>
          </tr>
          <tr>
            <td colspan="5"><xsl:value-of select="//lcl/PRJ/samenvatting_text2"/></td>
          </tr>
          <tr>
            <td><xsl:value-of select="//lcl/PRJ/geplande_uitvoerdatum"/>:</td>
            <td colspan="4">
              <xsl:value-of select="datum"/></td>
          </tr>
          <tr>
            <td><xsl:value-of select="//lcl/PRJ/geraamde_kosten"/>:</td>
            <td colspan="4">
              <xsl:value-of select="raming"/></td>
          </tr>
          <tr>
            <td class="pagebreak"/>
          </tr>
        </table>
          <h1><xsl:value-of select="//lcl/PRJ/eindsituatie"/></h1>
          <xsl:for-each select="prjverdieping">
            <h2>
              <xsl:value-of select="plaats/plaatsaanduiding"/>
              <xsl:value-of select="plaats/regio/district/locatie/gebouw/verdieping/omschrijving"/>
            </h2>
              <xsl:element name="img">
                <xsl:attribute name="src">
                  <xsl:value-of select="$PRJ_IMAGE_URL"/>?mode=0&amp;vKey=<xsl:value-of select="plaats/key"/>&amp;scenario_key=<xsl:value-of select="/facilitor/scenario/key"/>&amp;paperWidth=170&amp;paperHeight=120&amp;forPrint=1&amp;label=<xsl:value-of select="$PRJ_BEWONER_LABEL_KEY"/>&amp;thema=<xsl:value-of select="$PRJ_AFDELING_THEMA_KEY"/></xsl:attribute>
                <xsl:attribute name="style">width:170mm</xsl:attribute>
                <xsl:attribute name="border">1</xsl:attribute>
                <xsl:attribute name="galleryimg">false</xsl:attribute>
              </xsl:element>
                     <table>
            <tr>
              <th><xsl:value-of select="//lcl/PRJ/ruimtenr"/></th>
              <th><xsl:value-of select="//lcl/PRJ/ruimte_omschrijving"/></th>
              <th><xsl:value-of select="//lcl/PRJ/oppervlakte"/></th>
              <th><xsl:value-of select="//lcl/PRJ/medewerker"/></th>
              <th><xsl:value-of select="//lcl/PRJ/werkplek_bezetting"/></th>
              <th><xsl:value-of select="//lcl/FAC/afdeling"/></th>
            </tr>
            <xsl:for-each select="prjruimte">
              <xsl:for-each select="prjwerkplek">
                <xsl:for-each select="prjperslidwerkplek">
                  <tr>
                    <td>
                      <xsl:value-of select="../../nr"/>
                    </td>
                    <td>
                      <xsl:value-of select="../../omschrijving"/>
                    </td>
                    <td>
                      <xsl:value-of select="../../bruto_vloeropp"/> m2</td>
                    <td>
                      <xsl:value-of select="bezetter/naam_full"/>
                    </td>
                    <td><xsl:value-of select="../omschrijving"/>&#xA0;(<xsl:call-template name="shownumber">
                                                                         <xsl:with-param name="getal" select="wpopp"/>
                                                                         <xsl:with-param name="format" select="'###0,00@EU'"/>
                                                                       </xsl:call-template>m2, <xsl:value-of select="bezetting"/>%)
                    </td>
                    <td>
                      <xsl:value-of select="bezetter/afdeling/naam"/>
                      <xsl:value-of select="bezetter_afdeling/naam"/>
                    </td>
                    <td/>
                  </tr>
                </xsl:for-each>
              </xsl:for-each>
            </xsl:for-each>
                    </table>
            <h2><xsl:value-of select="//lcl/PRJ/aantekeningen"/></h2>
            <table>
            <xsl:for-each select="note">
              <tr>
                <td>
                  <b>
                    <xsl:value-of select="nr"/>
                  </b>
                </td>
                <td colspan="4">
                  <xsl:value-of select="omschrijving"/>
                </td>
              </tr>
            </xsl:for-each>
            <tr>
              <td class="pagebreak"/>
            </tr>
            </table>
          </xsl:for-each>
          <!-- NAAR-VAN Lijst (uitpak lijst, nieuwe situatie)
       Basis loop is ALLE nieuwe ruimtes/ werkplekken/ bezetting
    -->
          <h1><xsl:value-of select="//lcl/PRJ/naar_van_lijst"/></h1>
          <xsl:for-each select="prjverdieping">
            <h2>
                <xsl:value-of select="plaats/plaatsaanduiding"/>
                <xsl:value-of select="plaats/regio/district/locatie/gebouw/verdieping/omschrijving"/>
            </h2>
              <xsl:element name="img">
                <xsl:attribute name="src">
                  <xsl:value-of select="$PRJ_IMAGE_URL"/>?mode=0&amp;vKey=<xsl:value-of select="plaats/key"/>&amp;scenario_key=<xsl:value-of select="/facilitor/scenario/key"/>&amp;paperWidth=170&amp;paperHeight=120&amp;paperColor=16777215&amp;label=<xsl:value-of select="$PRJ_BEWONER_LABEL_KEY"/>&amp;thema=<xsl:value-of select="$PRJ_ONDERHANDEN_THEMA_KEY"/></xsl:attribute>
                <xsl:attribute name="style">width:170mm</xsl:attribute>
                <xsl:attribute name="border">1</xsl:attribute>
                <xsl:attribute name="galleryimg">false</xsl:attribute>
              </xsl:element>
                    <table>
            <tr>
              <th><xsl:value-of select="//lcl/FAC/ruimtenr"/></th>
              <th><xsl:value-of select="//lcl/FAC/omschrijving"/> </th>
              <th><xsl:value-of select="//lcl/FAC/werkplek"/></th>
              <th><xsl:value-of select="//lcl/PRJ/bezetting"/></th>
              <th><xsl:value-of select="//lcl/PRJ/medewerker"/></th>
              <th><xsl:value-of select="//lcl/FAC/afdeling"/></th>
              <th><xsl:value-of select="//lcl/PRJ/herkomst"/></th>
            </tr>
            <xsl:for-each select="prjruimte">
              <xsl:for-each select="prjwerkplek">
                <xsl:for-each select="prjperslidwerkplek">
                   <xsl:variable name="bestemming" select="concat(../../../plaats/plaatsaanduiding,'-',../../nr)"/>
                  <!-- Alleen opnemen als de nieuwe bezetter niet ook al hier een bezetting had -->
                  <xsl:if test="count(bezetter/werkplek/plaats[plaatsaanduiding=$bestemming]) = 0 or (count(bezetter/werkplek/plaats[plaatsaanduiding=$bestemming]) = 1 and ../volgnr != bezetter/werkplek/volgnr)">
                    <tr>
                      <td>
                        <xsl:value-of select="../../nr"/>
                      </td>
                      <td>
                        <xsl:value-of select="../../omschrijving"/>
                      </td>
                      <td><xsl:value-of select="../omschrijving"/>
                      </td>
                      <td><xsl:value-of select="bezetting"/>%</td>
                      <td>
                        <xsl:value-of select="bezetter/naam_full"/>
                      </td>
                      <td>
                        <xsl:value-of select="bezetter/afdeling/naam"/>
                        <xsl:value-of select="bezetter_afdeling/naam"/>
                      </td>
                      <td>
                        <xsl:for-each select="bezetter">
                          <xsl:for-each select="werkplek">
                             <xsl:sort select="plaats/plaatsaanduiding"/>
                            <xsl:value-of select="plaats/plaatsaanduiding"/>&#160;<xsl:value-of select="omschrijving"/><br/></xsl:for-each>
                        </xsl:for-each>
                      </td>
                    </tr>
                  </xsl:if>
                </xsl:for-each>
              </xsl:for-each>
            </xsl:for-each>
            <tr>
              <td class="pagebreak"/>
            </tr>
                    </table>
          </xsl:for-each>
          <!-- VAN-NAAR Lijst (inpak lijst, oude situatie)
       Basis loop is ALLE oude ruimtes/ werkplekken/ bezetting
    -->
        <h1><xsl:value-of select="//lcl/PRJ/van_naar_lijst"/></h1>
                    <table>
          <tr>
            <th><xsl:value-of select="//lcl/PRJ/ruimte_herkomst"/></th>
            <th><xsl:value-of select="//lcl/FAC/werkplek"/></th>
            <th><xsl:value-of select="//lcl/PRJ/medewerker"/></th>
            <th><xsl:value-of select="//lcl/FAC/afdeling"/></th>
            <th><xsl:value-of select="//lcl/PRJ/nieuwe_verdieping"/></th>
            <th><xsl:value-of select="//lcl/FAC/ruimte"/></th>
            <th><xsl:value-of select="//lcl/FAC/werkplek"/></th>
            <th><xsl:value-of select="//lcl/FAC/omschrijving"/></th>
          </tr>
          <xsl:for-each select="prjverdieping/prjruimte">
            <xsl:for-each select="prjwerkplek">
              <xsl:for-each select="prjperslidwerkplek">
                <xsl:sort select="bezetter/werkplek/plaats/plaatsaanduiding"/>
                <!-- Let op: OUDE bezetter -->
                <xsl:variable name="herkomst" select="bezetter/werkplek/plaats/plaatsaanduiding"/>
                <xsl:if test="$herkomst!=''">
                  <xsl:variable name="bestemming" select="concat(../../../plaats/plaatsaanduiding,'-',../../nr)"/>
                  <!-- Alleen opnemen als de oude bezetter niet hier een nieuwe bezetting heeft -->
                  <xsl:if test="count(bezetter/werkplek/plaats[plaatsaanduiding=$bestemming]) = 0 or (count(bezetter/werkplek/plaats[plaatsaanduiding=$bestemming]) = 1 and ../volgnr != bezetter/werkplek/volgnr)">
                    <tr>
                      <td>
                        <xsl:value-of select="$herkomst"/>
                      </td>
                      <td><xsl:value-of select="bezetter/werkplek/omschrijving"/></td>
                      <td>
                        <xsl:value-of select="bezetter/naam_full"/>
                      </td>
                      <td>
                        <xsl:value-of select="bezetter/afdeling/naam"/>
                        <xsl:value-of select="bezetter_afdeling/naam"/>
                      </td>
                      <td>
                        <xsl:value-of select="../../../plaats/plaatsaanduiding"/>
                      </td>
                      <td>
                          <xsl:value-of select="../../nr"/>
                      </td>
                      <td>
                        <xsl:value-of select="../omschrijving"/>
                      </td>
                      <td>
                        <xsl:value-of select="../../omschrijving"/>
                      </td>
                    </tr>
                  </xsl:if>
                </xsl:if>
              </xsl:for-each>
            </xsl:for-each>
          </xsl:for-each>
          <tr>
            <td class="pagebreak"/>
          </tr>
                </table>
        <xsl:call-template name="pagefooter"/>
      </body>
    </html>
  </xsl:template>

  <xsl:template name="rsv_ruimte">
    <xsl:param name="min_volgnr"/>
    <tr>
      <xsl:choose>
        <xsl:when test="res_ruimte!=''">
          <td class="tekstkop" colspan="10" frame="box"><u>
            <xsl:if test="dirtlevel!='0'">
                <span class="fatal"><xsl:value-of select="//lcl/RES/ongeldig"/></span>&#xA0;
            </xsl:if>
            <xsl:value-of select="van/datum"/>&#xA0;
            <xsl:value-of select="//lcl/RES/deelreservering"/>&#xA0;<xsl:value-of select="../key"/>&#xA0;/<xsl:value-of select="volgnr"/>&#xA0;
            <xsl:if test="string(res_activiteit/omschrijving)!=''">(<xsl:value-of select="res_activiteit/omschrijving"/>)&#xA0;</xsl:if>
            <xsl:value-of select="res_ruimte/plaats/regio/district/locatie/omschrijving"/></u>
          </td>
        </xsl:when>
        <!-- "roomservice" -->
        <xsl:otherwise>
          <td class="tekstkop" colspan="10" frame="box" style="border-style:solid;border-width:0px;"><u>
        <xsl:if test="dirtlevel!='0'">
            <span class="fatal"><xsl:value-of select="//lcl/RES/ongeldig"/></span>&#xA0;
        </xsl:if>
           <xsl:value-of select="van/datum"/>
            <xsl:if test="string(van/datum)!=string(tot/datum)">
                &#xA0;-&#xA0;<xsl:value-of select="tot/datum"/>
            </xsl:if>&#xA0;
            <xsl:value-of select="//lcl/RES/deelreservering"/>&#xA0;<xsl:value-of select="../key"/>&#xA0;/<xsl:value-of select="volgnr"/>&#xA0;
            <xsl:value-of select="plaats/plaatsaanduiding"/></u>
          </td>
        </xsl:otherwise>
      </xsl:choose>
    </tr>
    <xsl:if test="string(omschrijving)!=string(//reservering/rsv_ruimte[volgnr=$min_volgnr]/omschrijving)">
      <tr>
        <td class="label"><xsl:value-of select="//lcl/FAC/omschrijving"/></td>
        <td class="value" colspan="9">
          : <xsl:value-of select="omschrijving"/>
        </td>
      </tr>
    </xsl:if>
    <xsl:if test="string(contact_user/naam_full)!=string(//reservering/rsv_ruimte[volgnr=$min_volgnr]/contact_user/naam_full)">
      <tr>
        <td class="label"><xsl:value-of select="//lcl/FAC/aanvrager"/></td>
        <td class="value" colspan="9">
          : <xsl:value-of select="contact_user/naam_full"/>/ <xsl:value-of select="contact_user/werkplek/plaats/regio/district/locatie/omschrijving"/></td>
      </tr>
    </xsl:if>
    <tr>
    <td class="label"><xsl:value-of select="//lcl/RES/status"/></td>
    <td class="value" colspan="5">: <xsl:value-of select="status_fo"/>
    </td>
    </tr>
   <tr>
    <td class="label"><xsl:value-of select="//lcl/RES/gastheer_vrouw"/></td>
    <td class="value" colspan="5">: <xsl:value-of select="host_user/naam_full"/></td>
  </tr>
  <tr>
    <td class="label"><xsl:value-of select="//lcl/FAC/kostenplaats"/></td>
    <td class="value" colspan="5">: <xsl:value-of select="kostenplaats/nr"/>&#xA0;
      <xsl:value-of select="kostenplaats/omschrijving"/>
    </td>
  </tr>
  <xsl:if test="string(opmerking)!=''">
      <tr>
        <td class="label"> <xsl:value-of select="//lcl/FAC/opmerking"/></td>
        <td class="value" colspan="9">
          : <xsl:call-template name="linebreaks">
          <xsl:with-param name="escaping" select="'no'"/>
          <xsl:with-param name="string" select="fclt:fclthtml(opmerking)"/>
          </xsl:call-template>
        </td>
      </tr>
   </xsl:if>
    <tr>
        <td colspan="10" style="border-top:1px solid #000;"/>
    </tr>
    <tr>
      <th class="resth" width="24%" align="left"><xsl:value-of select="//lcl/FAC/omschrijving"/></th>
      <th class="resth" width="14%" align="left"><xsl:value-of select="//lcl/RES/aantal"/></th>
      <!--<th width="80">Datum</th>-->
      <th class="resth" width="14%" style="text-align:right"><xsl:value-of select="//lcl/RES/begintijd"/></th>
      <th class="resth" width="14%" style="text-align:right"><xsl:value-of select="//lcl/RES/eindtijd"/></th>
      <th class="resth" width="16%" align="center"><xsl:value-of select="//lcl/RES/opstelling"/></th>
      <th class="resth" width="17%" style="text-align:right"><xsl:value-of select="//lcl/RES/prijs"/></th>
    </tr>
    <xsl:if test="res_ruimte!=''">
      <tr>
        <td width="24%" class="resresult" style="text-align:left;"><xsl:if test="dirtlevel!='0'"><span class="fatal"><xsl:value-of select="//lcl/RES/ongeldig"/></span>&#xA0;</xsl:if>
          <xsl:value-of select="res_ruimte/nr"/>
          <br/>(max. <xsl:value-of select="res_ruimte/bezoekers"/>&#xA0;<xsl:value-of select="//lcl/FAC/personen"/>)</td>
        <td width="14%" class="resresult" style="text-align:left">
          <xsl:value-of select="bezoekers"/>&#xA0;<xsl:value-of select="//lcl/FAC/personen"/></td>
        <!--<td class="result" style="text-align:right">
          <xsl:value-of select="van/datum"/>
        </td>-->
        <td width="14%" class="resresult" style="text-align:right">
          <xsl:value-of select="van/tijd"/>
        </td>
        <td width="14%" class="resresult" style="text-align:right">
          <xsl:value-of select="tot/tijd"/>
        </td>
        <td width="16%" class="resresult" style="text-align:center">
          <xsl:value-of select="res_ruimte/opstelling"/>
        </td>
        <td width="17%" class="resresult" style="text-align:right">
          <xsl:call-template name="europrijs">
            <xsl:with-param name="prijs" select="prijs"/>
          </xsl:call-template>
        </td>
      </tr>
    </xsl:if>
    <!-- rsv_deel-lijst gesorteerd op van-tijd -->
    <xsl:for-each select="rsv_deel">
      <xsl:sort select="van/tijd"/>
      <tr>
        <td class="resresult"><xsl:if test="dirtlevel!='0'"><span class="fatal"><xsl:value-of select="//lcl/RES/ongeldig"/></span>&#xA0;</xsl:if>
          <xsl:value-of select="res_deel/deel/omschrijving"/>
        </td>
        <td class="resresult">
          <xsl:value-of select="aantal"/>
        </td>
        <!--<td class="result" style="text-align:right">
          <xsl:value-of select="van/datum"/>
        </td>-->
        <td class="resresult" style="text-align:right">
          <xsl:value-of select="van/tijd"/>
        </td>
        <td class="resresult" style="text-align:right">
          <xsl:value-of select="tot/tijd"/>
        </td>
        <td></td>
        <td class="resresult" style="text-align:right">
          <xsl:call-template name="europrijs">
            <xsl:with-param name="prijs" select="prijs"/>
          </xsl:call-template>
        </td>
      </tr>
    </xsl:for-each>
    <!-- rsv_artikel-lijst gesorteerd op van-tijd -->
    <xsl:for-each select="rsv_artikel">
      <xsl:sort select="levering/tijd"/>
      <tr>
        <td class="resresult">
          <xsl:value-of select="omschrijving"/>
        </td>
        <td class="resresult">
          <xsl:value-of select="aantal"/>
        </td>
        <!--<td class="result" style="text-align:right">
          <xsl:value-of select="levering/datum"/>
        </td>-->
        <td class="resresult" style="text-align:right">
          <xsl:value-of select="levering/tijd"/>
        </td>
        <td></td>
        <td></td>
        <td class="resresult" style="text-align:right">
          <xsl:call-template name="europrijs">
            <xsl:with-param name="prijs" select="prijs"/>
          </xsl:call-template>
        </td>
      </tr>
      <!-- kenmerk -->
      <xsl:if test="kenmerk">
      <tr>
        <td colspan="6">
          <table>
            <xsl:for-each select="kenmerk[count(@xmlnode)=0]">
              <xsl:sort select="@volgnummer" data-type="number"/>
              <xsl:if test=".!=''">
                <tr>
                  <td class="kenmerklabel"><xsl:value-of select="@naam"/></td>
                  <td class="kenmerkvalue">:
                    <xsl:call-template name="convertnumber">
                      <xsl:with-param name="valtype" select="@type"/>
                      <xsl:with-param name="waarde"  select="."/>
                    </xsl:call-template>
                  </td>
                </tr>
              </xsl:if>
            </xsl:for-each>
          </table>
        </td>
      </tr>
      </xsl:if>
    </xsl:for-each>
    <!-- totaal per deelreservering -->
    <tr  height="1">
      <td colspan="10" style="border-top:1px solid #000;"/>
    </tr>
    <tr>
      <td class="tekst" colspan="4"></td>
      <td class="tekst" colspan="2" style="text-align:right;"><b>
             <xsl:call-template name="europrijs">
               <xsl:with-param name="prijs" select="sum(prijs[string(number(.))!='NaN'])+sum(rsv_deel/prijs[string(number(.))!='NaN'])+sum(rsv_artikel/prijs[string(number(.))!='NaN'])"/>
             </xsl:call-template></b>
      </td>
    </tr>
    <!-- afspraak-lijst gesorteerd op naam -->
    <xsl:for-each select="afspraak/bezoeker">
      <xsl:sort select="naam"/>
      <xsl:choose>
        <xsl:when test="position() = 1">
          <tr>
            <td class="tekst">
              <br/><xsl:value-of select="//lcl/BEZ/bezoekers"/></td>
          </tr>
          <tr>
            <th><xsl:value-of select="//lcl/FAC/naam"/></th>
            <th colspan="3"><xsl:value-of select="//lcl/FAC/bedrijf"/></th>
            <th colspan="4"><xsl:value-of select="//lcl/BEZ/parkeerplaats"/></th>
          </tr>
        </xsl:when>
      </xsl:choose>
      <tr>
        <td class="result">
          <xsl:value-of select="naam"/>
        </td>
        <td class="result" colspan="3">
          <xsl:value-of select="bedrijf"/>
        </td>
        <td class="result" colspan="4">
          <xsl:value-of select="deel/omschrijving"/>
        </td>
      </tr>
    </xsl:for-each>

    <!-- kenmerk -->
    <xsl:if test="kenmerk">
    <tr>
    <td colspan="5">
    <table>
      <xsl:for-each select="kenmerk[count(@xmlnode)=0]">
        <xsl:sort select="@volgnummer" data-type="number"/>
        <xsl:if test=".!=''">
          <tr>
            <td class="label">
              <xsl:value-of select="@naam"/></td>
            <td class="value">
              : <xsl:value-of select="."/>
            </td>
          </tr>
        </xsl:if>
      </xsl:for-each>
    </table>
    </td>
    </tr>
    </xsl:if>

  </xsl:template>

  <xsl:template name="europrijs">
    <xsl:param name="prijs"/>

    <xsl:choose>
      <xsl:when test="string(number($prijs))='NaN'">€ <xsl:value-of select="format-number(0, '0,00', 'european')"/></xsl:when>
      <xsl:otherwise>€ <xsl:value-of select="format-number($prijs , '0,00', 'european')"/></xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <xsl:template name="convertnumber">
    <xsl:param name="valtype"/>
    <xsl:param name="waarde"/>

    <xsl:choose>
      <xsl:when test="$valtype = 'N' and $waarde &lt; 1 and $waarde &gt; -1">
        <xsl:value-of select="concat('0', $waarde)"/>
      </xsl:when>
      <xsl:otherwise>
        <xsl:value-of select="$waarde"/>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <xsl:template match="message" mode="include">
    <xsl:variable name="msg_key" select="string(key)"/>
    <table border="0" width="100%" cellpadding="2">
      <tr>
        <td width="20%" class="label"><xsl:value-of select="//lcl/MSG/bericht_van"/></td>
        <td width="80%" class="value">: <xsl:value-of select="afzender/naam_full"/></td>
      </tr>
      <tr>
        <td width="20%" class="label"><xsl:value-of select="//lcl/FAC/e-mail"/></td>
        <td width="80%" class="value">: <xsl:value-of select="afzender/email"/></td>
      </tr>
      <tr>
        <td class="label"><xsl:value-of select="//lcl/MSG/berichtdatum"/></td>
        <td class="value">:
          <xsl:value-of select="aanmaak/datum"/>&#xA0;
          <xsl:value-of select="aanmaak/tijd"/>
        </td>
      </tr>
      <tr>
        <td height="20"/>
      </tr>
      <tr>
        <td colspan="2" class="tekst">
          <xsl:call-template name="linebreaks">
            <xsl:with-param name="string" select="fclt:fclthtml(omschrijving, 'MES', $msg_key)"/>
            <xsl:with-param name="escaping" select="'no'"/>
          </xsl:call-template>
        </td>
      </tr>
    </table>
  </xsl:template>

  <xsl:template match="message" mode="full">
       <xsl:choose>
            <xsl:when test="$mode='summary'"></xsl:when>
       <xsl:otherwise>
    <html>
      <xsl:comment>================================ MESSAGES ==============================</xsl:comment>
      <xsl:comment>Facilitor default XSL template for message</xsl:comment>
      <xsl:call-template name="htmlhead"/>
      <xsl:element name="body">
        <xsl:if test="$mode!='email'">
          <xsl:attribute name="onload">window.print();</xsl:attribute>
        </xsl:if>
        <xsl:apply-templates select="." mode="include"/>
        <xsl:call-template name="pagefooter"/>
      </xsl:element>
    </html>
       </xsl:otherwise>
      </xsl:choose>
  </xsl:template>

  <xsl:template match="rapport" mode="default">
    <html>
      <xsl:comment>================================ RAPPORT ==============================</xsl:comment>
      <xsl:comment>Facilitor default XSL template for rapport</xsl:comment>
      <xsl:call-template name="htmlhead"/>
      <body>
        <table>
          <xsl:for-each select="rapport_data/data_row">
            <xsl:sort select="."/>
            <tr>
              <td>
                <xsl:value-of select="current()"/>
              </td>
            </tr>
          </xsl:for-each>
        </table>
      </body>
    </html>
  </xsl:template>

  <xsl:template match="rapport">
        <xsl:apply-templates select="." mode="default"/>
  </xsl:template>

  <xsl:template match="sysrapport">
    <xsl:choose>

        <xsl:when test="substring(@view,1,29)='ctr_v_monthly_recurring_tasks'"><!-- dutch only -->
          <html>
            <head>
            <style>
              table td {
                border-bottom: 1px solid #b1c3d5;
              }
              .lastyear,
              .thisyear,
              .nextyear {
                text-align: center;
                border-radius: 3px;
              }
              .legenda span {
                  padding: 3px;
                  margin-left: 1px;
              }
              .stat-1  { background-color: #003366; color:white;}
              .stat-1b { background-color: #FFC7CE; color: #CC0000;}
              .stat0   { background-color: #FFA500;}
              .stat2   { background-color: #B9D7FF;}
              .stat3   { background-color: #FFFFC8;}
              .statc1  { background-color: #339933; color:white;}
              .statc0  { background-color: #990000; color:white;}
            </style>
              <script language="javascript">
                function filltd(tdid, pstatus, ctrmodesuccess, controldate)
                {
                  var td = document.getElementById(tdid);
                  var cdate = new Date(new Date(new Date(new Date(controldate).setHours(0)).setMinutes(0)));
                  var today = new Date(new Date(new Date(new Date(new Date(new Date().setHours(0)).setMinutes(0))).setSeconds(0)).setMilliseconds(0));
                  if (td)
                  {
                    if (pstatus == -1) td.innerHTML = "T"; // toekomstig
                    if (pstatus == -1) td.style.color = "#FFFFFF";
                    if (pstatus == -1 &amp;&amp; (cdate.getTime() &gt;= today.getTime()))
                    {
                      td.style.color = "#FFFFFF";
                      td.style.backgroundColor = "#003366";
                    }
                      else if (pstatus == -1)
                    {
                      td.style.color = "#CC0000";
                      td.style.backgroundColor = "#FFC7CE";
                    }
                    if (pstatus == 0) td.innerHTML = "P"; // ingepland
                    if (pstatus == 0) td.style.backgroundColor = "#FFA500";
                    if (pstatus == 2) td.innerHTML = "S"; // gestart
                    if (pstatus == 2) td.style.backgroundColor = "#B9D7FF";
                    if (pstatus == 3) td.innerHTML = "U"; // in uitvoering
                    if (pstatus == 3) td.style.backgroundColor = "#FFFFC8";
                    if (ctrmodesuccess == 1) td.innerHTML = "G";  // succesvol
                    if (ctrmodesuccess == 1) td.style.backgroundColor = "#339933";
                    if (ctrmodesuccess == 1) td.style.color = "#FFFFFF";
                    if (ctrmodesuccess == 0) td.innerHTML = "F";  // niet succesvol
                    if (ctrmodesuccess == 0) td.style.backgroundColor = "#990000";
                    if (ctrmodesuccess == 0) td.style.color = "#FFFFFF";
                  }
                }
                function filltable()
                {
                  <xsl:for-each select="rapport_data/data_row">
                        <xsl:sort select="deel_key" order="ascending"/>
                        <xsl:sort select="ins_srtcontrole_key" order="ascending"/>
                            filltd("<xsl:value-of select="concat(DEEL_KEY,'_', INS_SRTCONTROLE_KEY, '_', MAAND, '_', JAAR)"/>",
                    "<xsl:value-of select="INSPECTIE_CODE"/>",
                    "<xsl:value-of select="SUCCESVOL"/>",
                    "<xsl:value-of select="VOLGENDEDATUM"/>");
                  </xsl:for-each>
                  var th = document.getElementsByClassName("th_lastyear");
                  $(".lastyear").hide();
                  $(".nextyear").hide();
                }
                function backoneyear()
                {
                  if (!$(".thisyear").is(":hidden"))
                  {
                    $(".lastyear").show();
                    $(".thisyear").hide();
                  }
                  else if (!$(".nextyear").is(":hidden"))
                  {
                                  $(".thisyear").show();
                                  $(".nextyear").hide();
                  }
                }
                function forwardoneyear()
                {
                  if (!$(".lastyear").is(":hidden"))
                  {
                    $(".lastyear").hide();
                                  $(".thisyear").show();
                  }
                  else if (!$(".thisyear").is(":hidden"))
                  {
                                  $(".thisyear").hide();
                                  $(".nextyear").show();
                  }
                }
              </script>
            </head>
          <body onLoad="filltable();">
                      <table width="100%" id="result">

                          <xsl:if test="count(rapport_data/data_row)=0">
                              <tr>
                                  <td>
                                      <center>
                                          <b>Geen gegevens gevonden</b>
                                    </center>
                                </td>
                            </tr>
                        </xsl:if>

                    <xsl:variable name="year">
                        <xsl:value-of select="preceding-sibling::header/dateYear"/>
                    </xsl:variable>

                        <xsl:variable name="sorted">
                            <xsl:for-each select="rapport_data/data_row">
                                <xsl:sort select="DEEL_KEY"/>
                                <xsl:sort select="INS_SRTCONTROLE_KEY"/>
                                <xsl:copy-of select="."/>
                            </xsl:for-each>
                        </xsl:variable>

                        <xsl:for-each select="msxsl:node-set($sorted)/data_row">
                            <xsl:if test="position() = 1">
                                <tr>
                                    <th style="text-align:left">Gebouw</th>
                                    <th style="text-align:left">Object</th>
                                    <th style="text-align:left">Controle</th>
                                    <th><button type="submit" onclick="backoneyear()">&lt;</button></th>
                                    <th class="lastyear"><xsl:value-of select="$year - 1" /><br></br>Jan</th>
                                    <th class="lastyear"><br></br>Feb</th>
                                    <th class="lastyear"><br></br>Mrt</th>
                                    <th class="lastyear"><br></br>Apr</th>
                                    <th class="lastyear"><br></br>Mei</th>
                                    <th class="lastyear"><br></br>Jun</th>
                                    <th class="lastyear"><br></br>Jul</th>
                                    <th class="lastyear"><br></br>Aug</th>
                                    <th class="lastyear"><br></br>Sep</th>
                                    <th class="lastyear"><br></br>Okt</th>
                                    <th class="lastyear"><br></br>Nov</th>
                                    <th class="lastyear"><xsl:value-of select="$year - 1" /><br></br>Dec</th>

                                    <th class="thisyear"><xsl:value-of select="$year" /><br></br>Jan</th>
                                    <th class="thisyear"><br></br>Feb</th>
                                    <th class="thisyear"><br></br>Mrt</th>
                                    <th class="thisyear"><br></br>Apr</th>
                                    <th class="thisyear"><br></br>Mei</th>
                                    <th class="thisyear"><br></br>Jun</th>
                                    <th class="thisyear"><br></br>Jul</th>
                                    <th class="thisyear"><br></br>Aug</th>
                                    <th class="thisyear"><br></br>Sep</th>
                                    <th class="thisyear"><br></br>Okt</th>
                                    <th class="thisyear"><br></br>Nov</th>
                                    <th class="thisyear"><xsl:value-of select="$year" /><br></br>Dec</th>

                                    <th class="nextyear"><xsl:value-of select="$year + 1" /><br></br>Jan</th>
                                    <th class="nextyear"><br></br>Feb</th>
                                    <th class="nextyear"><br></br>Mrt</th>
                                    <th class="nextyear"><br></br>Apr</th>
                                    <th class="nextyear"><br></br>Mei</th>
                                    <th class="nextyear"><br></br>Jun</th>
                                    <th class="nextyear"><br></br>Jul</th>
                                    <th class="nextyear"><br></br>Aug</th>
                                    <th class="nextyear"><br></br>Sep</th>
                                    <th class="nextyear"><br></br>Okt</th>
                                    <th class="nextyear"><br></br>Nov</th>
                                    <th class="nextyear"><xsl:value-of select="$year + 1" /><br></br>Dec</th>
                                    <th><button type="submit" onclick="forwardoneyear()">&gt;</button></th>
                                </tr>
                            </xsl:if>

                <xsl:variable name="prev_deel">
                        <xsl:choose>
                            <xsl:when test="position()=1">-1</xsl:when>
                            <xsl:otherwise>
                                <xsl:value-of select="preceding-sibling::data_row[1]/DEEL_KEY"/>
                            </xsl:otherwise>
                        </xsl:choose>
                    </xsl:variable>

                    <xsl:variable name="prev_cont">
                        <xsl:choose>
                            <xsl:when test="position()=1">-1</xsl:when>
                            <xsl:otherwise>
                                <xsl:value-of select="preceding-sibling::data_row[1]/INS_SRTCONTROLE_KEY"/>
                            </xsl:otherwise>
                        </xsl:choose>
                    </xsl:variable>

               <xsl:if test="DEEL_KEY != $prev_deel or INS_SRTCONTROLE_KEY != $prev_cont">
                  <tr>
                     <td><xsl:value-of select="GEBOUW"/></td>
                     <td><xsl:element name="span">
                        <xsl:attribute name="class">fld details</xsl:attribute>
                        <xsl:attribute name="onclick">FcltMgr.openDetail(&quot;/appl/ins/ins_deel.asp?urole=bo&amp;ins_key=<xsl:value-of select="DEEL_KEY"/>&quot;, { reuse: true, titel: &quot;&quot; })</xsl:attribute>
                        <xsl:value-of select="OBJECT"/>
                        </xsl:element>
                     </td>
                     <td><xsl:value-of select="TAAK"/></td>
                     <td></td>
                     <xsl:element name="td">
                        <xsl:attribute name="id"><xsl:value-of select="concat(DEEL_KEY, '_', INS_SRTCONTROLE_KEY, '_01', '_', $year - 1)"/></xsl:attribute>
                        <xsl:attribute name="class">lastyear</xsl:attribute>
                     </xsl:element>
                     <xsl:element name="td">
                        <xsl:attribute name="id"><xsl:value-of select="concat(DEEL_KEY, '_', INS_SRTCONTROLE_KEY, '_02', '_', $year - 1)"/></xsl:attribute>
                        <xsl:attribute name="class">lastyear</xsl:attribute>
                     </xsl:element>
                     <xsl:element name="td">
                        <xsl:attribute name="id"><xsl:value-of select="concat(DEEL_KEY, '_', INS_SRTCONTROLE_KEY, '_03', '_', $year - 1)"/></xsl:attribute>
                        <xsl:attribute name="class">lastyear</xsl:attribute>
                     </xsl:element>
                     <xsl:element name="td">
                        <xsl:attribute name="id"><xsl:value-of select="concat(DEEL_KEY, '_', INS_SRTCONTROLE_KEY, '_04', '_', $year - 1)"/></xsl:attribute>
                        <xsl:attribute name="class">lastyear</xsl:attribute>
                     </xsl:element>
                     <xsl:element name="td">
                        <xsl:attribute name="id"><xsl:value-of select="concat(DEEL_KEY, '_', INS_SRTCONTROLE_KEY, '_05', '_', $year - 1)"/></xsl:attribute>
                        <xsl:attribute name="class">lastyear</xsl:attribute>
                     </xsl:element>
                     <xsl:element name="td">
                        <xsl:attribute name="id"><xsl:value-of select="concat(DEEL_KEY, '_', INS_SRTCONTROLE_KEY, '_06', '_', $year - 1)"/></xsl:attribute>
                        <xsl:attribute name="class">lastyear</xsl:attribute>
                     </xsl:element>
                     <xsl:element name="td">
                        <xsl:attribute name="id"><xsl:value-of select="concat(DEEL_KEY, '_', INS_SRTCONTROLE_KEY, '_07', '_', $year - 1)"/></xsl:attribute>
                        <xsl:attribute name="class">lastyear</xsl:attribute>
                     </xsl:element>
                     <xsl:element name="td">
                        <xsl:attribute name="id"><xsl:value-of select="concat(DEEL_KEY, '_', INS_SRTCONTROLE_KEY, '_08', '_', $year - 1)"/></xsl:attribute>
                        <xsl:attribute name="class">lastyear</xsl:attribute>
                     </xsl:element>
                     <xsl:element name="td">
                        <xsl:attribute name="id"><xsl:value-of select="concat(DEEL_KEY, '_', INS_SRTCONTROLE_KEY, '_09', '_', $year - 1)"/></xsl:attribute>
                        <xsl:attribute name="class">lastyear</xsl:attribute>
                     </xsl:element>
                     <xsl:element name="td">
                        <xsl:attribute name="id"><xsl:value-of select="concat(DEEL_KEY, '_', INS_SRTCONTROLE_KEY, '_10', '_', $year - 1)"/></xsl:attribute>
                        <xsl:attribute name="class">lastyear</xsl:attribute>
                     </xsl:element>
                     <xsl:element name="td">
                        <xsl:attribute name="id"><xsl:value-of select="concat(DEEL_KEY, '_', INS_SRTCONTROLE_KEY, '_11', '_', $year - 1)"/></xsl:attribute>
                        <xsl:attribute name="class">lastyear</xsl:attribute>
                     </xsl:element>
                     <xsl:element name="td">
                        <xsl:attribute name="id"><xsl:value-of select="concat(DEEL_KEY, '_', INS_SRTCONTROLE_KEY, '_12', '_', $year - 1)"/></xsl:attribute>
                        <xsl:attribute name="class">lastyear</xsl:attribute>
                     </xsl:element>

                     <xsl:element name="td">
                        <xsl:attribute name="id"><xsl:value-of select="concat(DEEL_KEY, '_', INS_SRTCONTROLE_KEY, '_01', '_', $year)"/></xsl:attribute>
                        <xsl:attribute name="class">thisyear</xsl:attribute>
                     </xsl:element>
                     <xsl:element name="td">
                        <xsl:attribute name="id"><xsl:value-of select="concat(DEEL_KEY, '_', INS_SRTCONTROLE_KEY, '_02', '_', $year)"/></xsl:attribute>
                        <xsl:attribute name="class">thisyear</xsl:attribute>
                     </xsl:element>
                     <xsl:element name="td">
                        <xsl:attribute name="id"><xsl:value-of select="concat(DEEL_KEY, '_', INS_SRTCONTROLE_KEY, '_03', '_', $year)"/></xsl:attribute>
                        <xsl:attribute name="class">thisyear</xsl:attribute>
                     </xsl:element>
                     <xsl:element name="td">
                        <xsl:attribute name="id"><xsl:value-of select="concat(DEEL_KEY, '_', INS_SRTCONTROLE_KEY, '_04', '_', $year)"/></xsl:attribute>
                        <xsl:attribute name="class">thisyear</xsl:attribute>
                     </xsl:element>
                     <xsl:element name="td">
                        <xsl:attribute name="id"><xsl:value-of select="concat(DEEL_KEY, '_', INS_SRTCONTROLE_KEY, '_05', '_', $year)"/></xsl:attribute>
                        <xsl:attribute name="class">thisyear</xsl:attribute>
                     </xsl:element>
                     <xsl:element name="td">
                        <xsl:attribute name="id"><xsl:value-of select="concat(DEEL_KEY, '_', INS_SRTCONTROLE_KEY, '_06', '_', $year)"/></xsl:attribute>
                        <xsl:attribute name="class">thisyear</xsl:attribute>
                     </xsl:element>
                     <xsl:element name="td">
                        <xsl:attribute name="id"><xsl:value-of select="concat(DEEL_KEY, '_', INS_SRTCONTROLE_KEY, '_07', '_', $year)"/></xsl:attribute>
                        <xsl:attribute name="class">thisyear</xsl:attribute>
                     </xsl:element>
                     <xsl:element name="td">
                        <xsl:attribute name="id"><xsl:value-of select="concat(DEEL_KEY, '_', INS_SRTCONTROLE_KEY, '_08', '_', $year)"/></xsl:attribute>
                        <xsl:attribute name="class">thisyear</xsl:attribute>
                     </xsl:element>
                     <xsl:element name="td">
                        <xsl:attribute name="id"><xsl:value-of select="concat(DEEL_KEY, '_', INS_SRTCONTROLE_KEY, '_09', '_', $year)"/></xsl:attribute>
                        <xsl:attribute name="class">thisyear</xsl:attribute>
                     </xsl:element>
                     <xsl:element name="td">
                        <xsl:attribute name="id"><xsl:value-of select="concat(DEEL_KEY, '_', INS_SRTCONTROLE_KEY, '_10', '_', $year)"/></xsl:attribute>
                        <xsl:attribute name="class">thisyear</xsl:attribute>
                     </xsl:element>
                     <xsl:element name="td">
                        <xsl:attribute name="id"><xsl:value-of select="concat(DEEL_KEY, '_', INS_SRTCONTROLE_KEY, '_11', '_', $year)"/></xsl:attribute>
                        <xsl:attribute name="class">thisyear</xsl:attribute>
                     </xsl:element>
                     <xsl:element name="td">
                        <xsl:attribute name="id"><xsl:value-of select="concat(DEEL_KEY, '_', INS_SRTCONTROLE_KEY, '_12', '_', $year)"/></xsl:attribute>
                        <xsl:attribute name="class">thisyear</xsl:attribute>
                     </xsl:element>

                     <xsl:element name="td">
                        <xsl:attribute name="id"><xsl:value-of select="concat(DEEL_KEY, '_', INS_SRTCONTROLE_KEY, '_01', '_', $year + 1)"/></xsl:attribute>
                        <xsl:attribute name="class">nextyear</xsl:attribute>
                     </xsl:element>
                     <xsl:element name="td">
                        <xsl:attribute name="id"><xsl:value-of select="concat(DEEL_KEY, '_', INS_SRTCONTROLE_KEY, '_02', '_', $year + 1)"/></xsl:attribute>
                        <xsl:attribute name="class">nextyear</xsl:attribute>
                     </xsl:element>
                     <xsl:element name="td">
                        <xsl:attribute name="id"><xsl:value-of select="concat(DEEL_KEY, '_', INS_SRTCONTROLE_KEY, '_03', '_', $year + 1)"/></xsl:attribute>
                        <xsl:attribute name="class">nextyear</xsl:attribute>
                     </xsl:element>
                     <xsl:element name="td">
                        <xsl:attribute name="id"><xsl:value-of select="concat(DEEL_KEY, '_', INS_SRTCONTROLE_KEY, '_04', '_', $year + 1)"/></xsl:attribute>
                        <xsl:attribute name="class">nextyear</xsl:attribute>
                     </xsl:element>
                     <xsl:element name="td">
                        <xsl:attribute name="id"><xsl:value-of select="concat(DEEL_KEY, '_', INS_SRTCONTROLE_KEY, '_05', '_', $year + 1)"/></xsl:attribute>
                        <xsl:attribute name="class">nextyear</xsl:attribute>
                     </xsl:element>
                     <xsl:element name="td">
                        <xsl:attribute name="id"><xsl:value-of select="concat(DEEL_KEY, '_', INS_SRTCONTROLE_KEY, '_06', '_', $year + 1)"/></xsl:attribute>
                        <xsl:attribute name="class">nextyear</xsl:attribute>
                     </xsl:element>
                     <xsl:element name="td">
                        <xsl:attribute name="id"><xsl:value-of select="concat(DEEL_KEY, '_', INS_SRTCONTROLE_KEY, '_07', '_', $year + 1)"/></xsl:attribute>
                        <xsl:attribute name="class">nextyear</xsl:attribute>
                     </xsl:element>
                     <xsl:element name="td">
                        <xsl:attribute name="id"><xsl:value-of select="concat(DEEL_KEY, '_', INS_SRTCONTROLE_KEY, '_08', '_', $year + 1)"/></xsl:attribute>
                        <xsl:attribute name="class">nextyear</xsl:attribute>
                     </xsl:element>
                     <xsl:element name="td">
                        <xsl:attribute name="id"><xsl:value-of select="concat(DEEL_KEY, '_', INS_SRTCONTROLE_KEY, '_09', '_', $year + 1)"/></xsl:attribute>
                        <xsl:attribute name="class">nextyear</xsl:attribute>
                     </xsl:element>
                     <xsl:element name="td">
                        <xsl:attribute name="id"><xsl:value-of select="concat(DEEL_KEY, '_', INS_SRTCONTROLE_KEY, '_10', '_', $year + 1)"/></xsl:attribute>
                        <xsl:attribute name="class">nextyear</xsl:attribute>
                     </xsl:element>
                     <xsl:element name="td">
                        <xsl:attribute name="id"><xsl:value-of select="concat(DEEL_KEY, '_', INS_SRTCONTROLE_KEY, '_11', '_', $year + 1)"/></xsl:attribute>
                        <xsl:attribute name="class">nextyear</xsl:attribute>
                     </xsl:element>
                     <xsl:element name="td">
                        <xsl:attribute name="id"><xsl:value-of select="concat(DEEL_KEY, '_', INS_SRTCONTROLE_KEY, '_12', '_', $year + 1)"/></xsl:attribute>
                        <xsl:attribute name="class">nextyear</xsl:attribute>
                     </xsl:element>
                     <td></td>
                                </tr>
                            </xsl:if>
                            </xsl:for-each>
                        </table>
              <div class="legenda">
                <span class="stat-1">T</span><span>Toekomstig</span>
                <span class="stat-1b">T</span><span>Te laat</span>
                <span class="stat0">P</span><span >Gepland</span>
                <span class="stat2">S</span><span>Gestart</span>
                <span class="stat3">U</span><span>In uitvoering</span>
                <span class="statc1">G</span><span>Succesvol uitgevoerd</span>
                <span class="statc0">F</span><span>Onsuccesvol uitgevoerd</span>
              </div>
            </body>
          </html>
            </xsl:when>

        <xsl:when test="@view='cnd_v_rap_conditiemetingen' or @view='CND_V_RAP_CONDITIEMETINGEN'">
          <html>
            <head>
              <style>
                th {
                   white-space: nowrap;
                }

                .nobr {
                   white-space: nowrap;
                }
              </style>
            </head>
            <body>
              <xsl:choose>
              <xsl:when test="count(rapport_data/data_row)=0">
                <tr><td class="tekst"><center><br/><b>Geen gegevens gevonden</b></center></td></tr>
              </xsl:when>
              <xsl:otherwise>
                <table width="100%">
                  <thead>
                    <tr>
                        <th><xsl:value-of select="//lcl/FAC/locatie"/></th>
                        <th>Recept</th>
                        <th>Gebrek</th>
                        <th>Datum<br/>
                        Inspecteur<br/>
                        Status</th>
                        <th>Ernst<br/>
                        Omvang<br/>
                        Intensiteit</th>
                        <th>Aspecten</th>
                        <th>Foto</th>
                    </tr>
                  </thead>
                  <tbody>
                    <xsl:for-each select="rapport_data/data_row">
                      <tr>
                        <td class="tekst"><xsl:value-of select="COMPLEXNUMMER"/><br/>
                        <xsl:value-of select="CLUSTERNUMMER"/>&#xA0;
                        <strong><xsl:value-of select="CLUSTERNAAM"/></strong></td>
                        <td class="tekst nobr"><xsl:value-of select="HOOFDRECEPT"/><br/>
                        <xsl:value-of select="GROEPRECEPT"/><br/>
                        <xsl:value-of select="SUBRECEPT"/></td>
                        <td class="tekst">
                          <xsl:attribute name="onclick">FcltMgr.openDetail('appl/mld/mld_melding.asp?mld_key=<xsl:value-of select="MELDINGNUMMER"/>', '');</xsl:attribute>
                                        <xsl:value-of select="GEBREK"/>&#xA;(<span style="cursor:pointer; text-decoration: underline;"><xsl:value-of select="MELDINGNUMMER"/></span>)</td>
                        <td class="tekst nobr"><xsl:value-of select="DATUM"/><br/>
                        <xsl:value-of select="INSPECTEUR"/><br/>
                        <xsl:value-of select="STATUS"/></td>
                        <td class="tekst nobr"><xsl:value-of select="ERNST"/><br/>
                        <xsl:value-of select="OMVANG"/><br/>
                        <xsl:value-of select="INTENSITEIT"/></td>
                        <td class="tekst">
                        <xsl:if test="VEILIGHEID_GEZONDHEID!='NVT'">
                        Veiligheid/gezondheid: <xsl:value-of select="VEILIGHEID_GEZONDHEID"/><br/>
                        </xsl:if>
                        <xsl:if test="CULTUURHISTORISCHE_WAARDE!='NVT'">
                        Cultuurhistorische waarde: <xsl:value-of select="CULTUURHISTORISCHE_WAARDE"/><br/>
                        </xsl:if>
                        <xsl:if test="GEBRUIK_EN_BEDRIJFSPROCES!='NVT'">
                        Gebruik en bedrijfsproces: <xsl:value-of select="GEBRUIK_EN_BEDRIJFSPROCES"/><br/>
                        </xsl:if>
                        <xsl:if test="TECHNISCHE_VERVOLGSCHADE!='NVT'">
                        Technische vervolgschade: <xsl:value-of select="TECHNISCHE_VERVOLGSCHADE"/><br/>
                        </xsl:if>
                        <xsl:if test="TOENAME_KLACHTENONDERHOUD!='NVT'">
                        Toename klachtenonderhoud: <xsl:value-of select="TOENAME_KLACHTENONDERHOUD"/><br/>
                        </xsl:if>
                        <xsl:if test="BELEVING_ESTHETICA!='NVT'">
                        Beleving esthetica: <xsl:value-of select="BELEVING_ESTHETICA"/>
                        </xsl:if>
                        </td>
                        <td>
                        <div style="width: 300px;">
                          <xsl:element name="img">
                            <xsl:attribute name="frc">M=MLD:N=M:S=<xsl:value-of select="FOTO"/>:K=<xsl:value-of select="MLD_MELDING_KEY"/></xsl:attribute>
                            <xsl:attribute name="style">max-width: 100%;display:block;border:3px solid white</xsl:attribute>
                          </xsl:element>
                        </div>
                        </td>
                      </tr>
                    </xsl:for-each>
                  </tbody>
                </table>
              </xsl:otherwise>
              </xsl:choose>
            </body>
          </html>
        </xsl:when>

        <xsl:otherwise>
             <xsl:apply-templates select="." mode="default"/>
        </xsl:otherwise>

    </xsl:choose>
  </xsl:template>

    <xsl:template match="resultset">
        <xsl:if test="@id = 'phonebooktable'">
          <html>
          <xsl:call-template name="htmlhead"/>
          <xsl:element name="body">
            <table>
          <xsl:for-each select="data_row">
                <xsl:sort select="naam"/>
            <tr>
                <td>
                    <xsl:if test="fninlinephotofull!=''">
              <xsl:element name="img">
                <xsl:attribute name="src"><xsl:value-of select="fninlinephotofull"/></xsl:attribute>
                <xsl:attribute name="style">margin-right:20px;</xsl:attribute>
              </xsl:element>
              </xsl:if>
                    <xsl:if test="fninlinephotofull=''">
              <xsl:element name="img">
                <xsl:attribute name="src">../Pictures/avatarx.jpg</xsl:attribute>
                <xsl:attribute name="style">margin-right:20px;</xsl:attribute>
              </xsl:element>
              </xsl:if>
              </td>
              <td><strong><xsl:if test="prs_perslid_voornaam!=''"><xsl:value-of select="prs_perslid_voornaam"/></xsl:if><xsl:if test="prs_perslid_voornaam=''"><xsl:value-of select="prs_perslid_voorletters"/></xsl:if>&#xa0;<xsl:if test="prs_perslid_tussenvoegsel!=''"><xsl:value-of select="prs_perslid_tussenvoegsel"/>&#xa0;</xsl:if><xsl:value-of select="prs_perslid_naam"/></strong><br/>
                        <xsl:value-of select="prs_srtperslid_omschrijving"/><br/>
                        <xsl:value-of select="afdeling"/><br/>
                        <xsl:value-of select="telefoonnr"/></td>
                  </tr>
              </xsl:for-each>
            </table>
          </xsl:element>
          </html>
        </xsl:if>
    </xsl:template>

  <xsl:template match="perslid" mode="include">
    <xsl:choose>
      <xsl:when test="$srtnotificatiecode='PRSREG'">
        <xsl:apply-templates select="." mode="registreertelefoon"/>
      </xsl:when>
      <xsl:when test="$srtnotificatiecode='FACTST'">
        <xsl:apply-templates select="." mode="facilitortest"/>
      </xsl:when>
      <xsl:otherwise>

    <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" WIDTH="100%">
      <TR>
        <TD WIDTH="40" ROWSPAN="30" ID="LINKERMARGE"></TD>
        <TD>
          <table border="0" width="100%" bordercolor="#000000">
            <xsl:call-template name="prs_begintext"/>
            <tr>
              <td height="10px"/>
            </tr>
            <!-- standaard persoonsgegevens (incl. kenmerken) -->
            <tr>
              <td class="label" width="20%"><xsl:value-of select="//lcl/FAC/naam"/></td>
              <td class="value" width="80%">: <xsl:value-of select="naam_full"/></td>
            </tr>
            <tr>
              <td class="label"><xsl:value-of select="//lcl/FAC/organisatie"/></td>
              <td class="value">: <xsl:value-of select="afdeling/naam"/></td>
            </tr>
            <tr>
              <td class="label"><xsl:value-of select="//lcl/FAC/functie"/></td>
              <td class="value">: (<xsl:value-of select="//lcl/FAC/nog_niet_aanwezig"/>)</td>
            </tr>
            <tr>
              <td class="label"><xsl:value-of select="//lcl/FAC/werkplek"/></td>
              <td class="value">: <xsl:value-of select="werkplek/plaats/plaatsaanduiding"/></td>
            </tr>
            <tr>
              <td class="label"><xsl:value-of select="//lcl/FAC/telefoon"/></td>
              <td class="value">: <xsl:value-of select="telefoonnr"/></td>
            </tr>
            <tr>
              <td class="label"><xsl:value-of select="//lcl/FAC/e-mail"/></td>
              <td class="value">: <xsl:value-of select="email"/></td>
            </tr>
            <tr>
              <td class="label"><xsl:value-of select="//lcl/PRS/personeelsnr"/></td>
              <td class="value">: <xsl:value-of select="nr"/></td>
            </tr>
            <xsl:for-each select="kenmerk[count(@xmlnode)=0]">
              <tr>
                <td class="label">
                  <xsl:value-of select="@naam"/>
                </td>
                <td class="value">: <xsl:value-of select="."/></td>
              </tr>
            </xsl:for-each>
            <!-- personen-lijst gesorteerd op naam-->
            <!--xsl:for-each select="perslid">
              <xsl:sort select="naam_full"/>
              <xsl:choose>
                <xsl:when test="position() = 1">
                  <tr>
                    <th>Personeelsnr</th>
                    <th>Naam</th>
                    <th>Telefoon</th>
                    <th>Organisatie</th>
                    <th>Functie</th>
                    <th>Werkplek</th>
                  </tr>
                </xsl:when>
              </xsl:choose>
              <tr>
                <td class="result">
                  <xsl:value-of select="nr"/>
                </td>
                <td class="result">
                  <xsl:value-of select="naam_full"/>
                </td>
                <td class="result">
                  <xsl:value-of select="telefoonnr"/>
                </td>
                <td class="result">
                  <xsl:value-of select="afdeling/naam"/>
                </td>
                <td class="result">
                  (nog niet aanwezig)
                </td>
                <td class="result">
                  <xsl:value-of select="werkplek/plaats/plaatsaanduiding"/>
                </td>
              </tr>
            </xsl:for-each-->
            <tr>
              <td height="10px"/>
            </tr>
            <xsl:call-template name="prs_endtext"/>
          </table>
        </TD>
        <TD WIDTH="30" ROWSPAN="30" ID="RECHTERMARGE"/>
      </TR>
    </TABLE>
    </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <xsl:template match="perslid" mode="full">
       <xsl:choose>
            <xsl:when test="$mode='summary'"></xsl:when>
       <xsl:otherwise>
    <html>
      <xsl:comment>================================ PERSONEN ==============================</xsl:comment>
      <xsl:comment>Facilitor default XSL template for perslid</xsl:comment>
      <xsl:call-template name="htmlhead"/>
      <xsl:element name="body">
        <xsl:if test="$mode!='email'">
          <xsl:attribute name="onload">window.print();</xsl:attribute>
        </xsl:if>
        <xsl:call-template name="pageheader"/>
        <xsl:apply-templates select="." mode="include"/>
        <xsl:call-template name="pagefooter"/>
      </xsl:element>
    </html>
       </xsl:otherwise>
      </xsl:choose>
  </xsl:template>

  <xsl:template match="perslid" mode="registreertelefoon">
    <table border="0" cellpadding="1">
      <tr>
        <td colspan="4" >
          Uw smartphone is geregistreerd in Facilitor. Als u dit zelf hebt gedaan, kunt u deze e-mail negeren.<br/>
          Als u deze actie niet zelf hebt uitgevoerd, dan misbruikt iemand misschien uw account. Neem contact op met uw applicatiebeheerder.
        </td>
      </tr>
    </table>
  </xsl:template>

  <xsl:template match="perslid" mode="facilitortest">
    <table border="0" cellpadding="1">
      <tr>
        <td colspan="4" >
          Dit is een Facilitor test notificatie<br/>
          Gericht aan: <xsl:value-of select="//perslid/naam_full"/> (<xsl:value-of select="//perslid/oslogin"/>)<br/>
          Verstuurd: <xsl:value-of select="//header/dateTime"/><br/>
          Mode: <xsl:value-of select="$mode"/><br/>
          srtnotificatiecode: <xsl:value-of select="$srtnotificatiecode"/><br/>
        </td>
      </tr>
    </table>
  </xsl:template>

  <xsl:template match="contract" mode="include">
    <table border="0" cellpadding="1">
      <xsl:if test="extra_key">
        <xsl:variable name="mx_key"><xsl:value-of select="extra_key"/></xsl:variable>
        <tr>
          <td align="right" valign="top" style="padding-top:10px;" class="label">
            <b><xsl:value-of select="//lcl/FAC/bericht"/>:</b>
          </td>
          <td colspan="3" style="padding-top:10px;" class="value">
            <xsl:call-template name="linebreaks">
                <xsl:with-param name="escaping" select="'no'"/>
              <xsl:with-param name="string" select="fclt:fclthtml(notes/note[key=$mx_key]/omschrijving)"/>
            </xsl:call-template>
          </td>
        </tr>
        <tr>
          <td colspan="4" style="padding-bottom:20px;">
            <hr/>
          </td>
        </tr>
      </xsl:if>
      <tr>
        <td colspan="4" class="caption"><strong><xsl:value-of select="//lcl/CNT/contract"/>&#xA0;<xsl:value-of select="nummer_intern"/><xsl:if test="versie!=''">.<xsl:value-of select="versie"/></xsl:if></strong>
          &#xA0;<xsl:value-of select="eigenaar_afd/omschrijving"/>/<xsl:value-of select="bedrijf/naam"/></td>
      </tr>
      <xsl:call-template name="cnt_begintext"/>
      <tr>
        <td class="subcaption" colspan="2" width="50%"><xsl:value-of select="//lcl/CNT/algemene_gegevens"/></td>
        <td class="subcaption" colspan="2" width="50%"><xsl:value-of select="//lcl/CNT/data"/></td>
      </tr>
      <tr>
        <td colspan="2">
          <table border="0" id="administratief" width="100%">
            <tr>
              <td class="label" width="30%"><xsl:value-of select="//lcl/CNT/contractsoort"/>:</td>
              <td class="value">
                <xsl:value-of select="discipline/omschrijving"/>
              </td>
            </tr>
            <tr>
              <td class="label"><xsl:value-of select="//lcl/CNT/beschrijving"/>:</td>
              <td class="value">
                <xsl:value-of select="omschrijving"/>
              </td>
            </tr>
            <xsl:if test="nummer!=''">
              <tr>
                <td class="label"><xsl:value-of select="//lcl/CNT/extern_nr"/>:</td>
                <td class="value">
                  <xsl:value-of select="nummer"/>
                </td>
              </tr>
            </xsl:if>
            <xsl:if test="contract">
              <tr>
                <td class="label"><xsl:value-of select="//lcl/CNT/mantel"/>:</td>
                <td class="value">
                  <xsl:value-of select="contract/nummer_intern"/>
                </td>
              </tr>
            </xsl:if>
            <xsl:if test="document!=''">
              <tr>
                <td class="label"><xsl:value-of select="//lcl/FAC/omschrijving"/>:</td>
                <td class="value">
                  <xsl:value-of select="document"/>
                </td>
              </tr>
            </xsl:if>
          </table>
        </td>
        <td colspan="2">
          <table border="0" width="100%" id="datums">
            <tr>
              <td class="label" width="30%"><xsl:value-of select="//lcl/CNT/ingangsdatum"/>:</td>
              <td class="value">
                <xsl:value-of select="looptijd_van/datum"/>
              </td>
            </tr>
            <tr>
              <td class="label"><xsl:value-of select="//lcl/CNT/rappeldatum"/>:</td>
              <td class="value">
                <xsl:value-of select="rappeldatum/datum"/>
              </td>
            </tr>
            <tr>
              <td class="label"><xsl:value-of select="//lcl/CNT/opzegdatum"/>:</td>
              <td class="value">
                <xsl:value-of select="opzegdatum/datum"/>
              </td>
            </tr>
            <tr>
              <td class="label"><xsl:value-of select="//lcl/CNT/einddatum"/>:</td>
              <td class="value">
                <xsl:value-of select="looptijd_tot/datum"/>
              </td>
            </tr>
          </table>
        </td>
      </tr>

      <tr>
        <td height="10px"/>
      </tr>

      <tr>
        <td class="subcaption" colspan="2"><xsl:value-of select="//lcl/CNT/eigenaar"/></td>
        <td class="subcaption" colspan="2"><xsl:value-of select="//lcl/CNT/contractpartij"/></td>
      </tr>
      <tr>
        <td colspan="2">
          <table border="0" id="eigenaar" width="100%">
            <tr>
              <td class="label" width="30%"><xsl:value-of select="//lcl/CNT/eigenaar"/>:</td>
              <td class="value">
                <xsl:value-of select="eigenaar_afd/omschrijving"/>
              </td>
            </tr>
            <tr>
              <td class="label"><xsl:value-of select="//lcl/CNT/beheerder"/>:</td>
              <td class="value">
                <xsl:value-of select="beheerder/naam_full"/>
              </td>
            </tr>
            <xsl:if test="kostenplaats">
              <tr>
                <td class="label"><xsl:value-of select="//lcl/FAC/kostenplaats"/>:</td>
                <td class="value">
                  <xsl:value-of select="kostenplaats/nr"/>&#xA0;
                  <xsl:value-of select="kostenplaats/omschrijving"/>
                </td>
              </tr>
            </xsl:if>
          </table>
        </td>
        <td colspan="2">
          <table border="0" id="contractant" width="100%">
            <tr>
              <td class="label" width="30%"><xsl:value-of select="//lcl/CNT/uitvoerder"/>:</td>
              <td class="value">
                <xsl:value-of select="bedrijf/naam"/>
                <xsl:if test="bedrijf/bezoek_plaats!=''">&#xA0;
              -&#xA0;<xsl:value-of select="bedrijf/bezoek_plaats"/></xsl:if>
                <xsl:if test="bedrijf/leverancier_nr!=''">&#xA0;
              (<xsl:value-of select="bedrijf/leverancier_nr"/>)</xsl:if>
              </td>
            </tr>
            <tr>
              <td/>
              <td class="value">
                <xsl:value-of select="bedrijf/post_adres"/>
              </td>
            </tr>
            <tr>
              <td/>
              <td class="value">
                <xsl:value-of select="bedrijf/post_postcode"/>&#xA0;
                <xsl:value-of select="bedrijf/post_plaats"/>
              </td>
            </tr>
            <xsl:if test="contactpersoon">
                <tr>
                  <td class="label"><xsl:value-of select="//lcl/FAC/contactpersoon"/>:</td>
                  <td class="value">
                    <xsl:value-of select="contactpersoon/naam_full"/>
                  </td>
                </tr>
            </xsl:if>
            <xsl:if test="contactpersoon/telefoon1!=''">
                <tr>
                  <td class="label"><xsl:value-of select="//lcl/FAC/telefoon"/>:</td>
                  <td class="value">
                    <xsl:value-of select="contactpersoon/telefoon1"/>
                  </td>
                </tr>
            </xsl:if>
          </table>
        </td>
      </tr>

      <tr>
        <td height="10px"/>
      </tr>

      <tr>
        <td class="subcaption" colspan="2"><xsl:value-of select="//lcl/FAC/opmerkingen"/></td>
        <td class="subcaption" colspan="2"><xsl:value-of select="//lcl/CNT/financieel"/></td>
      </tr>
      <tr>
        <td colspan="2">
            <xsl:call-template name="linebreaks">
              <xsl:with-param name="string" select="opmerking"/>
            </xsl:call-template>
        </td>
        <td colspan="2">
          <table border="0" id="financieel" width="100%">
              <xsl:if test="termijnkosten!=''">
                <tr>
                  <td class="label" width="30%"><xsl:value-of select="//lcl/CNT/termijnbedrag"/>:</td>
                  <td class="value">
                    <xsl:call-template name="europrijs">
                    <xsl:with-param name="prijs" select="termijnkosten"/>
                    </xsl:call-template>
                  </td>
                </tr>
            </xsl:if>
            <tr>
              <td class="label"><xsl:value-of select="//lcl/CNT/contractbedrag"/>:</td>
              <td class="value">
                <xsl:call-template name="europrijs">
                <xsl:with-param name="prijs" select="kosten"/>
                </xsl:call-template>
              </td>
            </tr>
          </table>
        </td>
      </tr>

      <tr>
        <td height="10px"/>
      </tr>

      <tr>
        <td class="subcaption" colspan="4"><xsl:value-of select="//lcl/FAC/details"/></td>
      </tr>
      <tr>
        <td colspan="4">
          <table>
            <xsl:for-each select="kenmerk[count(@xmlnode)=0]">
              <xsl:sort select="@volgnummer" data-type="number"/>
              <xsl:if test=".!=''">
                <tr>
                  <td class="label">
                    <xsl:value-of select="@naam"/>:</td>
                    <td class="value">
                    <xsl:choose>
                      <xsl:when test="attachments!=''">
                        <xsl:for-each select="attachments/attachment">
                          <xsl:sort select="@volgnummer" data-type="number"/>
                          <xsl:if test="position()&gt;1">, </xsl:if><xsl:value-of select="filename"/>
                        </xsl:for-each>
                      </xsl:when>
                      <xsl:otherwise>
                        <xsl:value-of select="."/>
                      </xsl:otherwise>
                    </xsl:choose>
                  </td>
                </tr>
              </xsl:if>
            </xsl:for-each>
          </table>
        </td>
      </tr>

      <tr>
        <td height="10px"/>
      </tr>

      <tr>
        <td class="subcaption" colspan="4"><xsl:value-of select="//lcl/CNT/scope"/></td>
      </tr>
      <tr>
        <td colspan="4">
          <xsl:if test="contract_plaats/plaats">
            <table cellspacing="1" width="100%">
              <tr>
                <td>
                  <strong><xsl:value-of select="//lcl/CNT/scope"/></strong>
                </td>
                <td></td>
                <td>
                  <strong><xsl:value-of select="//lcl/FAC/locatie"/></strong>
                </td>
                <td>
                  <strong><xsl:value-of select="//lcl/FAC/adres"/></strong>
                </td>
                <td>
                  <strong><xsl:value-of select="//lcl/FAC/plaats"/></strong>
                </td>
                <td style="text-align:right">
                  <strong><xsl:value-of select="//lcl/CNT/bedrag"/></strong>
                </td>
              </tr>
              <xsl:for-each select="contract_plaats/plaats">
                <xsl:sort select="regio/district/locatie/omschrijving"/>
                <tr>
                    <xsl:if test="@type='L'">
                        <td><xsl:value-of select="//lcl/FAC/locatie"/></td>
                        <td><xsl:value-of select="plaatsaanduiding"/></td>
                        <td><xsl:value-of select="regio/district/locatie/omschrijving"/></td>
                    </xsl:if>
                    <xsl:if test="@type='G'">
                        <td><xsl:value-of select="//lcl/FAC/gebouw"/></td>
                        <td><xsl:value-of select="plaatsaanduiding"/></td>
                        <td><xsl:value-of select="regio/district/locatie/gebouw/omschrijving"/></td>
                    </xsl:if>
                    <xsl:if test="@type='T'">
                        <td><xsl:value-of select="//lcl/FAC/terrein"/></td>
                        <td><xsl:value-of select="plaatsaanduiding"/></td>
                        <td><xsl:value-of select="regio/district/locatie/omschrijving"/></td>
                    </xsl:if>
                    <xsl:if test="@type='V'">
                        <td><xsl:value-of select="//lcl/FAC/bouwlaag"/></td>
                        <td><xsl:value-of select="plaatsaanduiding"/></td>
                        <td><xsl:value-of select="regio/district/locatie/gebouw/omschrijving"/></td>
                    </xsl:if>
                    <xsl:if test="@type='R'">
                        <td><xsl:value-of select="//lcl/FAC/ruimte"/></td>
                        <td><xsl:value-of select="plaatsaanduiding"/>&#160;<xsl:value-of select="regio/district/locatie/gebouw/verdieping/ruimte/omschrijving"/></td>
                        <td><xsl:value-of select="regio/district/locatie/gebouw/omschrijving"/>
                        </td>
                    </xsl:if>
                  <td>
                    <xsl:value-of select="regio/district/locatie/adres"/>
                  </td>
                  <td>
                    <xsl:value-of select="regio/district/locatie/plaats"/>
                  </td>
                  <td style="text-align:right">
                    <xsl:call-template name="europrijs">
                    <xsl:with-param name="prijs" select="../kosten"/>
                    </xsl:call-template>
                  </td>
                </tr>
              </xsl:for-each>
            </table>
          </xsl:if>

          <xsl:if test="contract_object/srtdeel">
            <table cellspacing="1">
              <tr>
                <td>
                  <strong><xsl:value-of select="//lcl/CNT/betreft"/>:</strong>
                </td>
              </tr>
              <xsl:for-each select="contract_object/srtdeel">
                <xsl:sort select="omschrijving"/>
                <tr>
                  <td>
                    <xsl:value-of select="omschrijving"/>
                  </td>
                </tr>
              </xsl:for-each>
            </table>
          </xsl:if>
          <xsl:if test="contract_object/deel">
            <table cellspacing="1">
              <tr>
                <td>
                  <strong><xsl:value-of select="//lcl/CNT/objecten"/>:</strong>
                </td>
              </tr>
              <xsl:for-each select="contract_object/deel">
                <xsl:sort select="omschrijving"/>
                <tr>
                  <td>
                    <xsl:value-of select="omschrijving"/>
                  </td>
                </tr>
              </xsl:for-each>
            </table>
          </xsl:if>

          <!-- moet nog voor terreinen -->
          <xsl:if test="contract_onrgoed">
            <table cellspacing="1">
              <tr>
                <td>
                  <strong><xsl:value-of select="//lcl/CNT/gehuurd"/>:</strong>
                </td>
              </tr>
              <xsl:for-each select="contract_onrgoed">
                <xsl:sort select="ruimte/srtruimte/omschrijving"/>
                <tr>
                  <td>
                    <xsl:value-of select="ruimte/srtruimte/omschrijving"/>
                  </td>
                  <td>
                    <xsl:value-of select="ruimte/nr"/>
                  </td>
                  <td>
                    <xsl:value-of select="ruimte/omschrijving"/>
                  </td>
                  <td>
                    <xsl:value-of select="ruimte/prijs"/>
                  </td>
                </tr>
              </xsl:for-each>
            </table>
          </xsl:if>
        </td>
      </tr>
      <xsl:call-template name="cnt_endtext"/>
    </table>
  </xsl:template>

  <xsl:template match="contract" mode="full">
       <xsl:choose>
            <xsl:when test="$mode='summary'"></xsl:when>
       <xsl:otherwise>
    <html>
      <xsl:comment>================================ CONTRACT ==============================</xsl:comment>
      <xsl:comment>Facilitor default XSL template for contract</xsl:comment>
      <xsl:call-template name="htmlhead"/>
      <xsl:element name="body">
        <xsl:if test="$mode!='email'">
          <xsl:attribute name="onload">window.print();</xsl:attribute>
        </xsl:if>
        <xsl:call-template name="pageheader"/>
        <xsl:apply-templates select="." mode="include"/>
        <xsl:call-template name="pagefooter"/>
      </xsl:element>
    </html>
       </xsl:otherwise>
      </xsl:choose>
  </xsl:template>

  <xsl:template match="factuur" mode="fininf">
    <table border="0" cellpadding="1">
      <tr>
        <td colspan="4" >
        <xsl:value-of select="//lcl/FIN/fininf_aanhef"/>,<br/><br/>
        <xsl:value-of select="//lcl/FIN/fininf_text1"/><br/>
        <xsl:value-of select="//lcl/FIN/fininf_text2"/><br/><br/>
        <xsl:value-of select="//lcl/FIN/fininf_text3"/>
            </td>
      </tr>
            </table>
  </xsl:template>

  <xsl:template match="factuur" mode="include">
    <xsl:choose>
    <xsl:when test="$srtnotificatiecode='FININF'">
        <xsl:apply-templates select="." mode="fininf"/>
    </xsl:when>
    <xsl:otherwise>
    <table border="0" cellpadding="1">
      <xsl:if test="extra_key">
        <xsl:variable name="mx_key"><xsl:value-of select="extra_key"/></xsl:variable>
        <tr>
          <td align="right" valign="top" style="padding-top:10px;" class="label">
            <b><xsl:value-of select="//lcl/FAC/bericht"/>:</b>
          </td>
          <td colspan="3" style="padding-top:10px;" class="value">
            <xsl:call-template name="linebreaks">
                <xsl:with-param name="escaping" select="'no'"/>
              <xsl:with-param name="string" select="fclt:fclthtml(notes/note[key=$mx_key]/omschrijving)"/>
            </xsl:call-template>
          </td>
        </tr>
        <tr>
          <td colspan="4" style="padding-bottom:20px;">
            <hr/>
          </td>
        </tr>
      </xsl:if>
      <tr>
        <td colspan="4" class="caption"><strong><xsl:value-of select="//lcl/FIN/factuur"/> <xsl:value-of select="key"/></strong></td>
      </tr>
      <tr>
        <td class="label"><xsl:value-of select="//lcl/FIN/factuurnr"/></td>
        <td class="value"><xsl:value-of select="nr"/></td>
        <td colspan="2" width="50%"></td>
      </tr>
      <tr>
        <td class="label"><xsl:value-of select="//lcl/FIN/factuurdatum"/></td>
        <td class="value"><xsl:value-of select="datum/datum"/></td>
        <td class="label"><xsl:value-of select="//lcl/FIN/totaal_ex_btw"/></td>
        <td class="value" style="text-align:right">
          <xsl:call-template name="europrijs">
            <xsl:with-param name="prijs" select="totaal"/>
          </xsl:call-template>
                </td>
      </tr>
      <tr>
        <td class="label"><xsl:value-of select="//lcl/FIN/boekmaand"/></td>
        <td class="value"><xsl:value-of select="boekmaand"/></td>
        <td class="label"><xsl:value-of select="//lcl/FIN/btw"/></td>
        <td class="value" style="text-align:right">
          <xsl:call-template name="europrijs">
            <xsl:with-param name="prijs" select="totaal_btw"/>
          </xsl:call-template>
                </td>
      </tr>
      <tr>
        <td class="label"><xsl:value-of select="//lcl/FIN/kostensoort"/></td>
        <td class="value"><xsl:value-of select="kostensoort/omschrijving"/></td>
        <td class="label"><xsl:value-of select="//lcl/FIN/totaal_incl_btw"/></td>
        <td class="value" style="text-align:right">
          <xsl:call-template name="europrijs">
            <xsl:with-param name="prijs" select="totaal+totaal_btw"/>
          </xsl:call-template>
                </td>
      </tr>
      <tr>
        <td class="label"><xsl:value-of select="//lcl/FIN/debiteurnr"/></td>
        <td class="value"><xsl:value-of select="debiteurnr"/></td>
      </tr>
      <xsl:for-each select="kenmerk[count(@xmlnode)=0]">
        <xsl:sort select="@volgnummer" data-type="number"/>
        <xsl:if test=".!=''">
          <tr>
            <td class="label">
              <xsl:value-of select="@naam"/>:</td>
              <td class="value">
                <xsl:choose>
                  <xsl:when test="attachments!=''">
                    <xsl:for-each select="attachments/attachment">
                      <xsl:sort select="@volgnummer" data-type="number"/>
                      <xsl:if test="position()&gt;1">, </xsl:if><xsl:value-of select="filename"/>
                    </xsl:for-each>
                  </xsl:when>
                  <xsl:otherwise>
                    <xsl:value-of select="."/>
                  </xsl:otherwise>
                </xsl:choose>
              </td>
          </tr>
        </xsl:if>
      </xsl:for-each>
      <tr>
        <td class="label"><xsl:value-of select="//lcl/FAC/opmerking"/></td>
        <td colspan="3" class="value"><xsl:value-of select="opmerking"/></td>
      </tr>
      <tr>
        <td colspan="4" class="label"><xsl:value-of select="//lcl/FIN/regels"/>:</td>
      </tr>
      <tr><td colspan="4"><table width="90%">
        <tr>
          <th class="result"><xsl:value-of select="//lcl/FIN/nr"/></th>
          <th class="result"><xsl:value-of select="//lcl/FAC/omschrijving"/></th>
          <th class="result"><xsl:value-of select="//lcl/FIN/referentie"/></th>
          <th class="result"><xsl:value-of select="//lcl/FIN/excl_btw"/></th>
          <th class="result"><xsl:value-of select="//lcl/FIN/btw"/></th>
          <th class="result"><xsl:value-of select="//lcl/FIN/incl_btw"/></th>
          </tr>
      <xsl:for-each select="factuurregel">
        <xsl:sort select="nr" data-type="number"/>
        <tr>
          <td class="result">
            <xsl:value-of select="nr"/>
          </td>
          <td class="result">
            <xsl:value-of select="omschrijving"/>
          </td>
          <td class="result">
            <xsl:value-of select="referentie"/>
          </td>
        <td class="result" style="text-align:right">
          <xsl:call-template name="europrijs">
            <xsl:with-param name="prijs" select="totaal"/>
          </xsl:call-template>
                </td>
        <td class="result" style="text-align:right">
          <xsl:call-template name="europrijs">
            <xsl:with-param name="prijs" select="btw"/>
          </xsl:call-template>
                </td>
        <td class="result" style="text-align:right">
          <xsl:call-template name="europrijs">
            <xsl:with-param name="prijs" select="totaal+btw"/>
          </xsl:call-template>
                </td>
        </tr>
      </xsl:for-each>
        <tr>
          <th class="result"></th>
          <th class="result"></th>
          <th class="result"></th>
          <th class="result" style="text-align:right">
              <xsl:call-template name="europrijs">
                <xsl:with-param name="prijs" select="totaal"/>
              </xsl:call-template></th>
          <th class="result" style="text-align:right">
              <xsl:call-template name="europrijs">
                <xsl:with-param name="prijs" select="totaal_btw"/>
              </xsl:call-template></th>
          <th class="result" style="text-align:right">
              <xsl:call-template name="europrijs">
                <xsl:with-param name="prijs" select="totaal+totaal_btw"/>
              </xsl:call-template></th>
          </tr>
            </table></td></tr>

      <tr>
        <td colspan="4" class="caption"><xsl:value-of select="//lcl/FIN/behoort_bij_onderstaande_verplichting"/>:</td>
      </tr>
      <tr>
        <td colspan="4" align="center">
          <table width="100%" class="embed" style="background-color:#ECEDEF;border: 1px solid #ccc">
            <tr>
              <td>
                <xsl:apply-templates select="opdracht" mode="include"/>
                <xsl:apply-templates select="contract" mode="include"/>
                <xsl:apply-templates select="bestelopdracht" mode="include"/>
              </td>
            </tr>
          </table>
        </td>
      </tr>
    </table>
    </xsl:otherwise>
    </xsl:choose>
  </xsl:template>


  <xsl:template match="factuur" mode="full">
       <xsl:choose>
            <xsl:when test="$mode='summary'"></xsl:when>
       <xsl:otherwise>
    <html>
      <xsl:comment>================================ FACTUUR ==============================</xsl:comment>
      <xsl:comment>Facilitor default XSL template for factuur</xsl:comment>
      <xsl:call-template name="htmlhead"/>
      <xsl:element name="body">
        <xsl:if test="$mode!='email'">
          <xsl:attribute name="onload">window.print();</xsl:attribute>
        </xsl:if>
        <xsl:call-template name="pageheader"/>
        <xsl:apply-templates select="." mode="include"/>
        <xsl:call-template name="pagefooter"/>
      </xsl:element>
    </html>
       </xsl:otherwise>
      </xsl:choose>
  </xsl:template>

  <xsl:template match="verkoopfactuur" mode="include">
    <xsl:choose>
    <xsl:when test="$srtnotificatiecode='FININF'">
        <xsl:apply-templates select="." mode="fininf"/>
    </xsl:when>
    <xsl:otherwise>
    <table border="0" cellpadding="1">
      <tr>
        <td colspan="4" class="caption"><strong><xsl:value-of select="//lcl/FIN/verkoopfactuur"/> <xsl:value-of select="verkoopfactuurregel/id"/></strong></td>
      </tr>
      <tr>
        <td colspan="4" class="caption">This is a placeholder; the layout is to be defined.</td>
      </tr>
    </table>
    </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <xsl:template match="verkoopfactuur" mode="full">
       <xsl:choose>
            <xsl:when test="$mode='summary'"></xsl:when>
       <xsl:otherwise>
    <html>
      <xsl:comment>================================ VERKOOPFACTUUR ==============================</xsl:comment>
      <xsl:comment>Facilitor default XSL template for verkoopfactuur</xsl:comment>
      <xsl:call-template name="htmlhead"/>
      <xsl:element name="body">
        <xsl:if test="$mode!='email'">
          <xsl:attribute name="onload">window.print();</xsl:attribute>
        </xsl:if>
        <xsl:call-template name="pageheader"/>
        <xsl:apply-templates select="." mode="include"/>
        <xsl:call-template name="pagefooter"/>
      </xsl:element>
    </html>
       </xsl:otherwise>
      </xsl:choose>
  </xsl:template>

  <xsl:template match="deel" mode="include">
    <table border="0" cellpadding="1" width="100%">
      <tr>
        <td colspan="3" class="caption"><strong><xsl:value-of select="srtdeel/omschrijving"/>&#160;<xsl:value-of select="omschrijving"/></strong></td>
        <td style="text-align:right"><xsl:element name="img">
            <xsl:attribute name="width">140px</xsl:attribute>
            <xsl:attribute name="src">../../appl/shared/barcode.asp?text=<xsl:value-of select="key"/>&amp;height=50&amp;narrow=1&amp;wide=3</xsl:attribute>
          </xsl:element>
                </td>
      </tr>
      <tr>
        <td><xsl:element name="img">
            <xsl:attribute name="width">160px</xsl:attribute>
            <xsl:attribute name="frc">M=INSPHD:K=<xsl:value-of select="key"/>:R=160x160</xsl:attribute>
          </xsl:element>
        </td>
      </tr>
      <xsl:if test="extra_key">
        <xsl:variable name="dx_key"><xsl:value-of select="extra_key"/></xsl:variable>
        <tr>
          <td valign="top" style="padding-top:15px;padding-bottom:10px;">
            <b><xsl:value-of select="//lcl/FAC/bericht"/></b>
          </td>
          <td colspan="5" style="padding-top:15px;padding-bottom:10px;">
            <xsl:call-template name="linebreaks">
                <xsl:with-param name="escaping" select="'no'"/>
              <xsl:with-param name="string" select="fclt:fclthtml(notes/note[key=$dx_key]/omschrijving)"/>
            </xsl:call-template>
          </td>
        </tr>
        <tr>
          <td colspan="6" style="padding-bottom:15px;">
            <hr/>
          </td>
        </tr>
      </xsl:if>
      <tr>
        <td class="label" width="20%"><xsl:value-of select="//lcl/CNT/groep"/></td>
        <td class="value" colspan="2"><xsl:value-of select="srtdeel/srtgroep/discipline/omschrijving"/>/<xsl:value-of select="srtdeel/srtgroep/omschrijving"/></td>
        <td></td>
      </tr>
        <xsl:if test="binding='R'">
          <tr>
            <td class="label"><xsl:value-of select="//lcl/CNT/plaats"/></td>
            <td class="value" colspan="2"><xsl:value-of select="plaats/plaatsaanduiding"/>&#160;
                                      <xsl:value-of select="plaats/regio/district/locatie/gebouw/verdieping/ruimte/omschrijving"/></td>
            <td></td>
          </tr>
      </xsl:if>
        <xsl:if test="binding='T'">
          <tr>
            <td class="label"><xsl:value-of select="//lcl/CNT/plaats"/></td>
            <td class="value" colspan="2"><xsl:value-of select="terreinsector/naam"/></td>
            <td></td>
          </tr>
      </xsl:if>
        <xsl:if test="binding='P'">
          <tr>
            <td class="label"><xsl:value-of select="//lcl/CNT/eigenaar"/></td>
            <td class="value" colspan="2"><xsl:value-of select="persoon/naam_full"/></td>
            <td></td>
          </tr>
      </xsl:if>
        <xsl:if test="binding='A'">
          <tr>
            <td class="label"><xsl:value-of select="//lcl/CNT/eigenaar"/></td>
            <td class="value" colspan="2"><xsl:value-of select="afdeling/omschrijving"/></td>
            <td></td>
          </tr>
      </xsl:if>
        <xsl:if test="binding='W'">
          <tr>
            <td class="label"><xsl:value-of select="//lcl/CNT/plaats"/></td>
            <td class="value" colspan="2"><xsl:value-of select="werkplek/plaats/plaatsaanduiding"/>/<xsl:value-of select="werkplek/volgnr"/></td>
            <td></td>
          </tr>
      </xsl:if>
      <xsl:for-each select="srtdeel/kenmerk[count(@xmlnode)=0]">
        <xsl:sort select="@volgnummer" data-type="number"/>
        <xsl:if test=".!=''">
          <tr>
            <td class="label">
              <xsl:value-of select="@naam"/>:</td>
              <td class="value" colspan="2">
                <xsl:choose>
                  <xsl:when test="attachments!=''">
                    <xsl:for-each select="attachments/attachment">
                      <xsl:sort select="@volgnummer" data-type="number"/>
                      <xsl:if test="position()&gt;1">, </xsl:if><xsl:value-of select="filename"/>
                    </xsl:for-each>
                  </xsl:when>
                  <xsl:otherwise>
                    <xsl:value-of select="."/>
                  </xsl:otherwise>
                </xsl:choose>
              </td>
                <td></td>
          </tr>
        </xsl:if>
      </xsl:for-each>
      <xsl:for-each select="kenmerk[count(@xmlnode)=0]">
        <xsl:sort select="@volgnummer" data-type="number"/>
        <xsl:if test=".!=''">
          <tr>
            <td class="label">
              <xsl:value-of select="@naam"/>:</td>
            <td class="value" colspan="2">
            <xsl:choose>
              <xsl:when test="attachments!=''">
                <xsl:for-each select="attachments/attachment">
                  <xsl:sort select="@volgnummer" data-type="number"/>
                  <xsl:if test="position()&gt;1">, </xsl:if><xsl:value-of select="filename"/>
                </xsl:for-each>
              </xsl:when>
              <xsl:otherwise>
                  <xsl:call-template name="linebreaks">
                      <xsl:with-param name="string" select="."/>
                  </xsl:call-template>
              </xsl:otherwise>
            </xsl:choose>
          </td>
                <td></td>
          </tr>
        </xsl:if>
      </xsl:for-each>
            <tr><td></td><td colspan="3"><table border="1">
      <xsl:for-each select="deel">
          <xsl:apply-templates select="." mode="include"/>
      </xsl:for-each>
      </table></td></tr>
    </table>
  </xsl:template>

  <xsl:template match="deel" mode="out">
    <table border="0" cellpadding="1" width="100%">
      <tr>
        <td colspan="3" class="caption"><strong><xsl:value-of select="//lcl/INS/uitgiftebewijs"/></strong></td>
      </tr>
            <tr><td colspan="3"><xsl:value-of select="//lcl/INS/ins_lendbegintext1"/><xsl:value-of select="persoon/naam_full"/><xsl:value-of select="//lcl/INS/ins_lendbegintext2"/>
            <br/><strong><xsl:value-of select="srtdeel/omschrijving"/>&#160;<xsl:value-of select="omschrijving"/></strong><br/></td>
      </tr>
      <xsl:for-each select="kenmerk[count(@xmlnode)=0]">
        <xsl:sort select="@volgnummer" data-type="number"/>
        <xsl:if test=".!=''">
          <tr>
            <td class="label">
              <xsl:value-of select="@naam"/>:</td>
            <td class="value">
                <xsl:choose>
                  <xsl:when test="attachments!=''">
                    <xsl:for-each select="attachments/attachment">
                      <xsl:sort select="@volgnummer" data-type="number"/>
                      <xsl:if test="position()&gt;1">, </xsl:if><xsl:value-of select="filename"/>
                    </xsl:for-each>
                  </xsl:when>
                  <xsl:otherwise>
                    <xsl:value-of select="."/>
                  </xsl:otherwise>
                </xsl:choose>
              </td>
          </tr>
        </xsl:if>
      </xsl:for-each>
            <tr><td></td><td colspan="3"><table border="1">
      <xsl:for-each select="deel">
          <xsl:apply-templates select="." mode="include"/>
      </xsl:for-each>
      </table></td></tr>
            <tr><td colspan="3"><xsl:value-of select="//lcl/INS/ins_lendeindtext1"/><xsl:value-of select="//lcl/INS/ins_lendeindtext2"/></td></tr>
    </table>
  </xsl:template>


  <xsl:template match="deel" mode="full">
       <xsl:choose>
            <xsl:when test="$mode='summary'"></xsl:when>
       <xsl:otherwise>
    <html>
      <xsl:comment>================================ DEEL (OBJECT)===========================</xsl:comment>
      <xsl:comment>Facilitor default XSL template for deel</xsl:comment>
      <xsl:call-template name="htmlhead"/>
      <xsl:element name="body">
        <xsl:if test="$mode!='email'">
          <xsl:attribute name="onload">window.print();</xsl:attribute>
        </xsl:if>
        <xsl:call-template name="pageheader"/>
        <xsl:choose>
             <xsl:when test="$srtnotificatiecode = 'INSOUT'">
               <xsl:apply-templates select="." mode="out"/>
             </xsl:when>
            <xsl:otherwise>
                <xsl:apply-templates select="." mode="include"/>
             </xsl:otherwise>
            </xsl:choose>
        <xsl:call-template name="pagefooter"/>
      </xsl:element>
    </html>
       </xsl:otherwise>
      </xsl:choose>
  </xsl:template>

  <xsl:template match="/">
    <xsl:choose>
      <xsl:when test="$mode='getExtension'">
        <xsl:element name="format">
          <xsl:element name="extension">html</xsl:element>
        </xsl:element>
      </xsl:when>
      <xsl:otherwise>
        <xsl:apply-templates select="facilitor"/>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

    <xsl:template match="facilitor">
        <xsl:apply-templates select="bestelling" />
        <xsl:apply-templates select="bestelopdracht" mode="full"/>
        <xsl:apply-templates select="reservering" mode="full"/>
        <xsl:apply-templates select="afspraak" mode="full"/>
        <xsl:apply-templates select="bezoeker" mode="full"/>
        <xsl:apply-templates select="melding" mode="full"/>
        <xsl:apply-templates select="opdracht" mode="full"/>
        <xsl:apply-templates select="scenario" mode="full"/>
        <xsl:apply-templates select="message" mode="full"/>
        <xsl:apply-templates select="rapport"/>
        <xsl:apply-templates select="sysrapport"/>
        <xsl:apply-templates select="perslid" mode="full"/>
        <xsl:apply-templates select="contract" mode="full"/>
        <xsl:apply-templates select="deel" mode="full"/>
        <xsl:apply-templates select="factuur" mode="full"/>
        <xsl:apply-templates select="verkoopfactuur" mode="full"/>
        <xsl:apply-templates select="printfg"/>
        <xsl:apply-templates select="resultset"/>
        <xsl:apply-templates select="cust" mode="full"/><!--no default provided -->
        <xsl:apply-templates select="plaats"/><!--no default provided -->
        <xsl:apply-templates select="bedrijf"/><!--no default provided -->
        <xsl:apply-templates select="afdeling"/><!--no default provided -->
        <xsl:apply-templates select="kostenplaats"/><!--no default provided -->
        <xsl:apply-templates select="controle"/><!--no default provided -->
        <xsl:apply-templates select="taak"/><!--no default provided -->
        <xsl:apply-templates select="srtdeel"/><!--no default provided -->
    </xsl:template>
</xsl:stylesheet><!-- Stylus Studio meta-information - (c) 2004-2009. Progress Software Corporation. All rights reserved.

<metaInformation>
    <scenarios/>
    <MapperMetaTag>
        <MapperInfo srcSchemaPathIsRelative="yes" srcSchemaInterpretAsXML="no" destSchemaPath="" destSchemaRoot="" destSchemaPathIsRelative="yes" destSchemaInterpretAsXML="no"/>
        <MapperBlockPosition></MapperBlockPosition>
        <TemplateContext></TemplateContext>
        <MapperFilter side="source"></MapperFilter>
    </MapperMetaTag>
</metaInformation>
-->