<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xsl:stylesheet [
  <!ENTITY nbsp "&#160;">
  <!ENTITY br  "&#10;">
  <!ENTITY amp "&#38;#38;">
  <!ENTITY lt  "&#38;#60;">
  <!ENTITY gt  "&#62;">
  <!ENTITY Auml  "&#196;">
  <!ENTITY Ouml  "&#214;">
  <!ENTITY Uuml  "&#220;">
  <!ENTITY auml  "&#228;">
  <!ENTITY ouml  "&#246;">
  <!ENTITY uuml  "&#252;">
  <!ENTITY bull  "&#8226;">
]>

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" encoding="UTF-8"/>

<xsl:template match="ihknewsletter">
<html class="pl" lang="de-DE" style="margin: 0; padding: 0;">
<head>
  <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
  <meta http-equiv="Content-Style-Type" content="text/css;charset=UTF-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1" />
  <style type="text/css">
/*<![CDATA[*/
    @import url('https://fonts.googleapis.com/css2?family=Source+Sans+Pro:wght@400;600&display=swap');
    html, body {
      padding: 0;
      margin: 0;
      font-family: "Source Sans Pro", Arial, Helvetica, sans-serif;
      color: #003366;
      font-size: 18px;
      line-height: 1.4;
    }
    td {
      border: 0;
      padding: 0;
    }
    .outer {
      width: 100%;
      text-align: center;
      overflow: hidden;
    }
    .half {
      max-width: 100%;
    }
    .infobanner-outer, .chart-teaser {
      background-image: url('[%embedded-image(3565);redesign-gradient.jpg]');
      background-position: right bottom;
      background-size: cover;
    }
    .chart-teaser.half {
      background-image: url('[%embedded-image(3566);redesign-gradient-small.jpg]');
    }
    .logo {
      width: 80%;
      display: block;
      margin: 0;
    }
    @media(max-width: 630px) {
      .inner, .inner table {
        display: block;
        max-width: 100%;
      }
      .inner table.button {
        display: table;
      }
      #index {
        width: 100%;
      }
      #index .inner table {
        display: table;
        width: 100%;
      }
    }
    @media(max-width: 540px) {
      .sm-block {
        display: block;
        width: 100%;
        padding-left: 0 !important;
        padding-right: 0 !important;
      }
      .offset-large {
        height: 40px !important;
      }
      .offset-medium {
        height: 30px !important;
      }
    }
    @media(max-width: 400px) {
      .xs-block {
        display: block;
        max-width: 100%;
      }
      .issue span {
        display: block;
        text-align: left !important;
        padding-top: 12px;
        padding-left: 1px;
      }
      .h1 {
        font-size: 38px !important;
        line-height: 44px !important;
      }
      .h2 {
        font-size: 32px !important;
        line-height: 36px !important;
      }
      .h3 {
        font-size: 24px !important;
        line-height: 28px !important;
      }
      .p {
        font-size: 18px !important;
        line-height: 26px !important;
      }
      .p.title {
        padding-bottom: 6px;
        display: block;
      }
      .social {
        padding-bottom: 16px;
      }
      .social + .xs-block {
        text-align: left !important;
      }
    }
  /*]]>*/
  </style>
  <title></title>
</head>
<body style="margin: 0; padding: 0;">
  <a name="top" id="top"></a>
  <center><p style="font-size:12px; color:#333333; margin:0 0 8px 0; padding:0; font-family:Arial, Helvetica, sans-serif;"><font color="#003366">Wenn dieser Newsletter nicht richtig angezeigt wird, klicken Sie bitte</font>&nbsp;<a style="color:#003366; text-decoration:underline;" href="[%application-url]/html_mail.jsp?params=[%online_params]" target="_blank"><font color="#003366">hier</font></a>.</p></center>
  <table id="header" class="outer" width="100%" style="table-layout: fixed; border-collapse: collapse; border-spacing: 0;">
    <tr>
      <td width="15" style="border-bottom: 1px solid #ccd6e0;"></td>
      <td align="center" style="border-bottom: 1px solid #ccd6e0;">
        <table class="inner" width="600" style="table-layout: fixed; border-collapse: collapse; border-spacing: 0; width: 600px; max-width: 100%;">
          <tr>
            <td height="20"></td>
          </tr>
          <tr>
            <xsl:if test="string-length(salutation/issue) > 0">
              <td width="300" class="xs-block">
                <xsl:call-template name="logo"/>
              </td>
              <td width="300" class="xs-block" valign="top" align="right" style="padding-top: 6px;">
                <font color="#003366">
                  <xsl:value-of select="salutation/issue"/>
                </font>
              </td>
            </xsl:if>
            <xsl:if test="string-length(salutation/issue) = 0">
              <td width="300" class="xs-block">
                <xsl:call-template name="logo"/>
              </td>
            </xsl:if>
          </tr>
          <tr>
            <td height="20"></td>
          </tr>
        </table>
      </td>
      <td width="15" style="border-bottom: 1px solid #ccd6e0;"></td>
    </tr>
  </table>

  <table id="salutation" class="outer" width="100%" style="table-layout: fixed; border-collapse: collapse; border-spacing: 0;">
    <tr>
      <td width="15"></td>
      <td align="center">
        <table class="inner" width="600" style="table-layout: fixed; border-collapse: collapse; border-spacing: 0; width: 600px; max-width: 100%;">
          <tr>
            <td height="50" class="offset-large"></td>
          </tr>
          <tr>
            <td>
              <span style="font-size: 20px; line-height: 30px;" class="p">
                <font color="#003366">
                  <xsl:call-template name="salutation"/>
                </font>
              </span>
            </td>
          </tr>
          <tr>
            <td height="50" class="offset-large"></td>
          </tr>
        </table>
      </td>
      <td width="15"></td>
    </tr>
  </table>

  <table id="title" class="outer" width="100%" style="table-layout: fixed; border-collapse: collapse; border-spacing: 0; overflow: hidden;">
    <tr>
      <td width="15"></td>
      <td align="center">
        <table class="inner" width="600" style="table-layout: fixed; border-collapse: collapse; border-spacing: 0; width: 600px; max-width: 100%;">
          <tr>
            <td>
              <span style="font-size: 48px; line-height: 54px;" class="h1"><font color="#003366">
                <xsl:choose>
                  <xsl:when test="//ihknewsletter/header/newsletter_title and string-length(//ihknewsletter/header/newsletter_title) > 0">
                    <xsl:value-of select="//ihknewsletter/header/newsletter_title" />
                  </xsl:when>
                  <xsl:otherwise>
                    Newsletter
                  </xsl:otherwise>
                </xsl:choose>
              </font></span>
            </td>
          </tr>
          <tr>
            <td height="20"></td>
          </tr>
          <tr>
            <td height="8">
              <span bgcolor="#afcc7a;" style="position: relative; display: block; height: 8px; width: 100%; background-color: #afcc7a;">
                <span class="green" style="position: absolute; width: 300%; height: 8px; background-color: #afcc7a;"></span>
                <img height="8" width="600" alt="Trennlinie" style="position: relative; margin: 0; display: block; height: 8px; width: 600px; max-width: 100%;">
                  <xsl:attribute name="src"><xsl:value-of select="//ihknewsletter/header/trenner_verlauf"/></xsl:attribute>
                </img>
              </span>
            </td>
          </tr>
        </table>
      </td>
      <td width="15"></td>
    </tr>
  </table>

  <xsl:if test="allg_Infos/index_show = 'ja'">
    <table id="index" class="outer" width="100%" style="table-layout: fixed; border-collapse: collapse; border-spacing: 0;">
      <tr>
        <td width="15"></td>
        <td align="center">
          <table class="inner" width="600" style="table-layout: fixed; border-collapse: collapse; border-spacing: 0; width: 600px; max-width: 100%;">
            <tr>
              <td height="50" class="offset-large"></td>
            </tr>
            <tr>
              <td>
                <table width="600" style="table-layout: fixed; border-collapse: collapse; border-spacing: 0;">
                  <xsl:call-template name="index"/>
                </table>
              </td>
            </tr>
            <tr>
              <td height="30"></td>
            </tr>
          </table>
        </td>
        <td width="15"></td>
      </tr>
    </table>
  </xsl:if>


  <table id="news" class="outer" width="100%" style="table-layout: fixed; border-collapse: collapse; border-spacing: 0;">
    <tr>
      <td width="15"></td>
      <td align="center">
        <table class="inner" width="600" style="table-layout: fixed; border-collapse: collapse; border-spacing: 0; max-width: 100%; width: 600px;">
          <!--xsl:call-template name="buildNews">
            <xsl:with-param name="i" select="3" />
          </xsl:call-template-->

          <xsl:for-each select="news">
            <xsl:call-template name="newstitle"/>

            <xsl:variable name="isBig">
              <xsl:choose>
                <xsl:when test="string-length(//ihknewsletter/allg_Infos/one_row) > 0">
                  <xsl:value-of select="//ihknewsletter/allg_Infos/one_row"/>
                </xsl:when>
                <xsl:otherwise>
                  <xsl:value-of select="one_row_article"/>
                </xsl:otherwise>
              </xsl:choose>
            </xsl:variable>

            <xsl:choose>
              <xsl:when test="is_infobanner = 'ja'">
                <!-- Infobanner -->
                <xsl:call-template name="infobanner" />
              </xsl:when>

              <xsl:when test="$isBig = 'ja'">
                <!-- Einspalter -->
                <tr>
                  <td>
                    <xsl:call-template name="news">
                      <xsl:with-param name="coltype" select="'full'" />
                    </xsl:call-template>
                  </td>
                </tr>
              </xsl:when>

              <xsl:otherwise>
                <!-- Zweispalter -->
                <xsl:variable name="lastBig">
                  <xsl:choose>
                    <xsl:when test="count(preceding-sibling::news[one_row_article = 'ja' or title_show = 'ja' or is_infobanner = 'ja']) = 0">
                      <xml:text>0</xml:text>
                    </xsl:when>
                    <xsl:otherwise>
                      <xsl:call-template name="getLastBigIndex">
                        <xsl:with-param name="i" select="position()" />
                      </xsl:call-template>
                    </xsl:otherwise>
                  </xsl:choose>
                </xsl:variable>
                <xsl:variable name="isFirst" select="(position() - $lastBig) mod 2" />
                <xsl:if test="$isFirst = 1">
                  <xsl:choose>
                    <xsl:when test="position() = last() or following-sibling::news[1]/one_row_article = 'ja' or following-sibling::news[1]/title_show = 'ja' or following-sibling::news[1]/is_infobanner = 'ja'">
                      <!-- Erste und letzte Zeile -->
                      <tr>
                        <td>
                          <xsl:call-template name="news">
                            <xsl:with-param name="coltype" select="'full'" />
                          </xsl:call-template>
                        </td>
                      </tr>
                    </xsl:when>
                    <xsl:otherwise>
                      <!-- Erste Zeile -->
                      <xsl:call-template name="leftCol">
                        <xsl:with-param name="lastBig" select="$lastBig" />
                        <xsl:with-param name="pos" select="position()" />
                      </xsl:call-template>
                    </xsl:otherwise>
                  </xsl:choose>
                </xsl:if>
                <xsl:if test="$isFirst = 0">
                  <!-- Zweite Zeile -->
                  <xsl:call-template name="rightCol">
                    <xsl:with-param name="lastBig" select="$lastBig" />
                    <xsl:with-param name="pos" select="position()" />
                  </xsl:call-template>
                </xsl:if>
              </xsl:otherwise>

            </xsl:choose>
          </xsl:for-each>

          <tr>
            <td height="80" class="offset-large"></td>
          </tr>
        </table>
      </td>
      <td width="15"></td>
    </tr>
  </table>



  <table id="footer" class="outer" width="100%" bgcolor="#e3ebf5" style="table-layout: fixed; border-collapse: collapse; border-spacing: 0; background-color: #e3ebf5;">
    <tr>
      <td width="15" style="border-bottom: 8px solid #003366;"></td>
      <td align="center" style="border-bottom: 8px solid #003366;">
        <table class="inner" width="600" style="table-layout: fixed; border-collapse: collapse; border-spacing: 0; width: 600px; max-width: 100%;">
          <tr>
            <td height="40" class="offset-medium"></td>
          </tr>
          <tr>
            <td>
              <span style="font-size: 38px;" class="h2"><font color="#003366">Impressum</font></span>
            </td>
          </tr>
          <tr>
            <td height="25"></td>
          </tr>
          <xsl:apply-templates select="imprint"/>
          <tr>
            <td height="30"></td>
          </tr>
          <tr>
            <td>
              <table width="100%" style="table-layout: fixed; border-collapse: collapse; border-spacing: 0; max-width: 100%; display: block;">
                <tr>
                  <td width="240" class="xs-block social">
                    <a href="https://www.facebook.com/ihkaachen" class="fb" target="_blank" title="Facebook">
                      <img src="[%embedded-image(3555);redesign-facebook.png]" alt="Facebook" width="50" height="50" border="0" />
                    </a>&nbsp;
                    <a href="https://www.youtube.com/user/ihkacvidpub" class="yt" target="_blank" title="Youtube">
                      <img src="[%embedded-image(3554);redesign-youtube.png]" alt="Youtube" width="50" height="50" border="0" />
                    </a>&nbsp;
                    <a href="https://twitter.com/ihkaachen" class="tw" target="_blank" title="Twitter">
                      <img src="[%embedded-image(3553);redesign-twitter.png]" alt="Twitter" width="50" height="50" border="0" />
                    </a>
                  </td>
                  <td width="360" valign="bottom" align="right" style="padding-bottom: 3px;" class="xs-block">
                    <a href="[%application-url]/benutzerprofil.jsp?email=[email]&amp;id=[%id]" style="display: inline-block; color: #003366; text-decoration: underline;"><font color="#003366">Abonnement ändern</font></a>
                    <span style="display: inline-block; color: #003366; text-decoration: underline; margin-left: 15px;">
                      <font color="#003366">
                        <xsl:value-of disable-output-escaping="yes" select="footer/unsubscribe"/>
                      </font>
                    </span>
                  </td>
                </tr>
              </table>
            </td>
          </tr>
          <tr>
            <td height="30" style="border-bottom: 1px solid #B0C4D6"></td>
          </tr>
          <tr>
            <td height="30" style="border-top: 1px solid #B0C4D6"></td>
          </tr>
          <tr>
            <td>
              <span style="font-size: 18px; line-height: 24px;">
                <font color="#003366">
                  <xsl:apply-templates select="footer"/>
                </font>
              </span>
            </td>
          </tr>
          <tr>
            <td height="40"></td>
          </tr>
        </table>
      </td>
      <td width="15" style="border-bottom: 8px solid #003366;"></td>
    </tr>
  </table>


</body>
</html>
</xsl:template>



<xsl:template name="infobanner">
  <xsl:variable name="haslink" select="link and string-length(link) > 0"></xsl:variable>
  <tr>
    <td height="30"></td>
  </tr>
  <tr>
    <xsl:text disable-output-escaping="yes">&lt;td bgcolor="#003366" background="</xsl:text>[%embedded-image(3565);redesign-gradient.jpg]<xsl:text disable-output-escaping="yes">" style="background-image: url('</xsl:text>[%embedded-image(3565);redesign-gradient.jpg]<xsl:text disable-output-escaping="yes">'); background-position: right bottom; background-size: cover; max-width: 100%; padding: 15px 20px 20px" class="infobanner-outer"&gt;</xsl:text>
      <table style="table-layout: fixed; border-collapse: collapse; border-spacing: 0;">
        <tr>
          <td style="color: #ffffff">
            <span class="dachzeile" style="display: block; text-transform: uppercase; font-size: 16px; line-height: 20px;">
              <font color="white">
                <xsl:value-of select="headline"/>
              </font>
            </span>
          </td>
        </tr>
        <tr>
          <td>
            <xsl:choose>
              <xsl:when test="$haslink">
                <xsl:text disable-output-escaping="yes">&lt;a href="</xsl:text>
                  <xsl:call-template name="tracklinktitle">
                    <xsl:with-param name="url" select="link" />
                  </xsl:call-template>
                <xsl:text disable-output-escaping="yes">" style="display: block; font-size: 32px; line-height: 40px; color: #ffffff; text-decoration: underline;" class="h3"&gt;</xsl:text>
                  <xsl:value-of select="title" />
                <xsl:text disable-output-escaping="yes">&lt;/a&gt;</xsl:text>
              </xsl:when>
              <xsl:otherwise>
                <xsl:text disable-output-escaping="yes">&lt;span style="display: block; font-size: 32px; line-height: 40px; color: #ffffff; text-decoration: underline;" class="h3"&gt;</xsl:text>
                  <xsl:value-of select="title" />
                <xsl:text disable-output-escaping="yes">&lt;/span&gt;</xsl:text>
              </xsl:otherwise>
            </xsl:choose>
          </td>
        </tr>
        <tr>
          <td height="8"></td>
        </tr>
        <tr>
          <td>
            <xsl:for-each select="paragraph">
              <xsl:text disable-output-escaping="yes">&lt;span style="display: block; color: #ffffff; font-size: 18px; line-height: 26px;" class="p"&gt;</xsl:text>
                <xsl:variable name="p" select="." />
                <xsl:value-of select="$p" />
              <xsl:text disable-output-escaping="yes">&lt;/span&gt;</xsl:text>
              <xsl:if test="position() != last()">
                <br/>
              </xsl:if>
            </xsl:for-each>
          </td>
        </tr>
        <xsl:if test="$haslink">
          <tr>
            <td height="25"></td>
          </tr>
          <tr>
            <td align="right">
              <table style="table-layout: fixed; border-collapse: collapse; border-spacing: 0;" class="button">
                <tr>
                  <td width="25" height="60">
                    <xsl:text disable-output-escaping="yes">&lt;a href="</xsl:text>
                    <xsl:call-template name="tracklinktitle">
                      <xsl:with-param name="url" select="link" />
                    </xsl:call-template>
                    <xsl:text disable-output-escaping="yes">"&gt;</xsl:text>
                    <!--img src="img/button-left.png" alt="Button links" width="25" height="60" border="0" style="display: block;" /-->
                    <img src="[%embedded-image(3562);button-left.png]" alt="Button links" width="25" height="60" border="0" style="display: block;" />
                    <xsl:text disable-output-escaping="yes">&lt;/a&gt;</xsl:text>
                  </td>
                  <td bgcolor="white" height="60">
                    <xsl:text disable-output-escaping="yes">&lt;a href="</xsl:text>
                      <xsl:call-template name="tracklinktitle">
                        <xsl:with-param name="url" select="link" />
                      </xsl:call-template>
                    <xsl:text disable-output-escaping="yes">" style="display: block; white-space: nowrap; font-size: 20px; padding: 15px 0; line-height: 30px; color: #003366; text-decoration: none;" &gt;</xsl:text>
                      <xsl:choose>
                        <xsl:when test="infobanner_cta_text and string-length(infobanner_cta_text) > 0">
                          <font color="#003366">
                            <xsl:value-of select="infobanner_cta_text" />
                          </font>
                        </xsl:when>
                        <xsl:otherwise>
                          <font color="#003366">
                            <xsl:text>Mehr erfahren</xsl:text>
                          </font>
                        </xsl:otherwise>
                      </xsl:choose>
                    <xsl:text disable-output-escaping="yes">&lt;/a&gt;</xsl:text>
                  </td>
                  <td width-="50" height="60">
                    <xsl:text disable-output-escaping="yes">&lt;a href="</xsl:text>
                    <xsl:call-template name="tracklinktitle">
                      <xsl:with-param name="url" select="link" />
                    </xsl:call-template>
                    <xsl:text disable-output-escaping="yes">"&gt;</xsl:text>
                    <!--img src="img/button-right.png" alt="Button rechts" width="50" height="60" border="0" style="display: block;" /-->
                    <img src="[%embedded-image(3564);button-right.png]" alt="Button rechts" width="50" height="60" border="0" style="display: block;" />
                    <xsl:text disable-output-escaping="yes">&lt;/a&gt;</xsl:text>
                  </td>
                </tr>
              </table>
            </td>
          </tr>
        </xsl:if>
      </table>
    <xsl:text disable-output-escaping="yes">&lt;/td&gt;</xsl:text>
  </tr>
  <tr>
    <td height="30"></td>
  </tr>
</xsl:template>

<xsl:template name="getLastBigIndex">
  <xsl:param name="i" select="1" />

  <xsl:choose>
    <xsl:when test="(not(/ihknewsletter/news[$i]/one_row_article) or /ihknewsletter/news[$i]/one_row_article != 'ja') and /ihknewsletter/news[$i]/title_show = 'ja'">
      <xsl:value-of select="$i - 1" />
    </xsl:when>
    <xsl:when test="/ihknewsletter/news[$i]/one_row_article = 'ja' or /ihknewsletter/news[$i]/title_show = 'ja' or /ihknewsletter/news[$i]/is_infobanner">
      <xsl:value-of select="$i" />
    </xsl:when>
    <xsl:otherwise>
      <xml:if test="$i > 1">
        <xsl:call-template name="getLastBigIndex">
          <xsl:with-param name="i" select="$i - 1" />
        </xsl:call-template>
      </xml:if>
    </xsl:otherwise>
  </xsl:choose>
</xsl:template>


<xsl:template name="leftCol">
  <xsl:text disable-output-escaping="yes">&lt;tr&gt;</xsl:text>
  <xsl:text disable-output-escaping="yes">&lt;td&gt;</xsl:text>
  <xsl:text disable-output-escaping="yes">&lt;table style="table-layout: fixed; border-collapse: collapse; border-spacing: 0;"&gt;</xsl:text>
  <xsl:text disable-output-escaping="yes">&lt;tr&gt;</xsl:text>
  <xsl:text disable-output-escaping="yes">&lt;td width="300" valign="top" style="padding-right: 15px;" class="col-left sm-block"&gt;</xsl:text>
  <xsl:text disable-output-escaping="yes">&lt;table style="table-layout: fixed; border-collapse: collapse; border-spacing: 0;"&gt;</xsl:text>
  <xsl:call-template name="news">
    <xsl:with-param name="coltype" select="'half'" />
  </xsl:call-template>
  <xsl:text disable-output-escaping="yes">&lt;/table&gt;</xsl:text>
  <xsl:text disable-output-escaping="yes">&lt;/td&gt;</xsl:text>
</xsl:template>

<xsl:template name="rightCol">
  <xsl:text disable-output-escaping="yes">&lt;td width="300" valign="top" style="padding-left: 15px;" class="col-right sm-block"&gt;</xsl:text>
  <xsl:text disable-output-escaping="yes">&lt;table style="table-layout: fixed; border-collapse: collapse; border-spacing: 0;"&gt;</xsl:text>
  <xsl:call-template name="news">
    <xsl:with-param name="coltype" select="'half'" />
  </xsl:call-template>
  <xsl:text disable-output-escaping="yes">&lt;/table&gt;</xsl:text>
  <xsl:text disable-output-escaping="yes">&lt;/td&gt;</xsl:text>
  <xsl:text disable-output-escaping="yes">&lt;/tr&gt;</xsl:text>
  <xsl:text disable-output-escaping="yes">&lt;/table&gt;</xsl:text>
  <xsl:text disable-output-escaping="yes">&lt;/td&gt;</xsl:text>
  <xsl:text disable-output-escaping="yes">&lt;/tr&gt;</xsl:text>
</xsl:template>

<xsl:template name="targets">
  <xsl:text>[%if </xsl:text>
  <xsl:for-each select="news">
    <xsl:if test="position()!=1">
      <xsl:text> AND </xsl:text>
    </xsl:if>
    <xsl:choose>
      <xsl:when test="target">
        <xsl:for-each select="target">
          <xsl:if test="position()!=1">
            <xsl:text> AND </xsl:text>
          </xsl:if>
          <xsl:choose>
            <xsl:when test="string-length(.) > 0">
              <xsl:text>BelongsNotToGroup("</xsl:text><xsl:value-of disable-output-escaping="yes" select="."/><xsl:text>")</xsl:text>
            </xsl:when>
            <xsl:otherwise>
              <xsl:text> FALSE </xsl:text>
            </xsl:otherwise>
          </xsl:choose>
        </xsl:for-each>
      </xsl:when>
      <xsl:otherwise>
        <xsl:text> FALSE </xsl:text>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:for-each>
  <xsl:text>] [%no-mail] </xsl:text>
  <xsl:text> [%endif] </xsl:text>
</xsl:template>


<xsl:template name="logo">
  <xsl:if test="string-length(header/logo) > 0">
    <xsl:choose>
      <xsl:when test="string-length(//ihknewsletter/imprint/website) > 0">
        <a>
          <xsl:attribute name="href">http://<xsl:value-of select="//ihknewsletter/imprint/website"/></xsl:attribute>
          <img alt="Logo" class="logo" width="108" height="54" border="0">
            <xsl:attribute name="src"><xsl:value-of select="header/logo"/></xsl:attribute>
          </img>
        </a>
      </xsl:when>
      <xsl:otherwise>
        <img alt="Logo" calss="logo" width="108" height="54" border="0">
          <xsl:attribute name="src"><xsl:value-of select="header/logo"/></xsl:attribute>
        </img>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:if>
</xsl:template>


<xsl:template name="salutation">
  <xsl:value-of select="salutation/address"/><br /><br />
  <xsl:if test="string-length(salutation/paragraph) > 0">
    <xsl:for-each select="salutation/paragraph">
      <xsl:call-template name="render_text">
        <xsl:with-param name="text" select="."/>
      </xsl:call-template>
      <br /><br />
    </xsl:for-each>
  </xsl:if>
  <xsl:if test="string-length(salutation/greeting) > 0">
    <xsl:value-of select="salutation/greeting"/><br />
  </xsl:if>
  <xsl:if test="string-length(salutation/sig_name) > 0">
    <xsl:value-of select="salutation/sig_name"/>
  </xsl:if>
</xsl:template>


<xsl:template name="index">
  <xsl:for-each select="news">
    <xsl:variable name="feld">
      <xsl:choose>
        <xsl:when test="string-length(//ihknewsletter/all_gesch_feld/gesch_feld) > 0">
          <xsl:value-of select="//ihknewsletter/all_gesch_feld/gesch_feld"/>
        </xsl:when>
        <xsl:otherwise>
          <xsl:value-of select="news_gesch_feld"/>
        </xsl:otherwise>
      </xsl:choose>
    </xsl:variable>

    <xsl:if test="target">
      <xsl:call-template name="start_target"/>
    </xsl:if>
    <xsl:choose>
      <xsl:when test="//ihknewsletter/allg_Infos/index_only_themes = 'ja'">
        <xsl:if test="title_show = 'ja'">
          <xsl:if test="string-length($feld) > 0">
            <tr>
              <td width="40" height="60" style="border-bottom: 1px solid #ccd6e0; border-top: 1px solid #ccd6e0;">
                <img src="[%embedded-image(3557);redesign-anchor.png]" width="30" height="30" border="0" style="display: block;" />
              </td>
              <td style="border-bottom: 1px solid #ccd6e0; border-top: 1px solid #ccd6e0;">
                <a style="display: block; font-size: 18px; line-height: 22px; text-decoration: underline; color: #003366; padding: 8px 0">
                <xsl:attribute name="href">#anchor<xsl:value-of select="position()"/></xsl:attribute>
                <xsl:attribute name="title"><xsl:value-of select='normalize-space($feld)'/></xsl:attribute>
                  <font color="#003366">
                    <xsl:value-of select='normalize-space($feld)'/>
                  </font>
                </a>
              </td>
            </tr>
          </xsl:if>
        </xsl:if>
      </xsl:when>
      <xsl:otherwise>
        <tr>
          <td width="40" height="60" style="border-bottom: 1px solid #ccd6e0; border-top: 1px solid #ccd6e0;">
            <img src="[%embedded-image(3557);redesign-anchor.png]" width="30" height="30" border="0" style="display: block;" />
          </td>
          <td style="border-bottom: 1px solid #ccd6e0; border-top: 1px solid #ccd6e0;">
            <a style="display: block; font-size: 18px; line-height: 22px; text-decoration: underline; color: #003366; padding: 8px 0">
            <xsl:attribute name="href">#anchor<xsl:value-of select="position()"/></xsl:attribute>
            <xsl:attribute name="title"><xsl:value-of select='normalize-space(title)'/></xsl:attribute>
              <font color="#003366">
                <xsl:value-of select='normalize-space(title)'/>
              </font>
            </a>
          </td>
        </tr>
      </xsl:otherwise>
    </xsl:choose>
    <xsl:if test="target">
      <xsl:call-template name="end_target"/>
    </xsl:if>
  </xsl:for-each>
</xsl:template>


<xsl:template name="newstitle">
  <xsl:variable name="feld">
    <xsl:choose>
      <xsl:when test="string-length(//ihknewsletter/all_gesch_feld/gesch_feld) > 0">
        <xsl:value-of select="//ihknewsletter/all_gesch_feld/gesch_feld"/>
      </xsl:when>
      <xsl:otherwise>
        <xsl:value-of select="news_gesch_feld"/>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:variable>

  <xsl:if test="title_show = 'ja'">
    <xsl:if test="string-length($feld) > 0">
      <xsl:if test="target">
        <xsl:call-template name="start_target"/>
      </xsl:if>

      <tr>
        <td height="40" class="offset-medium"></td>
      </tr>
      <tr>
        <td width="600" style="border-bottom: 4px solid #56BD66; max-width: 100%;">
          <span style="display: block; font-size: 42px; line-height: 48px; padding-bottom: 10px;" class="h2">
            <xsl:value-of select="$feld"/>
          </span>
        </td>
      </tr>
      <tr>
        <td height="20"></td>
      </tr>

      <xsl:if test="target">
        <xsl:call-template name="end_target"/>
      </xsl:if>

      <xsl:if test="target">
        <xsl:call-template name="start_target"/>
      </xsl:if>

      <xsl:if test="target">
        <xsl:call-template name="end_target"/>
      </xsl:if>
    </xsl:if>
  </xsl:if>
</xsl:template>


<xsl:template name="news">
  <xsl:param name="coltype" />

  <xsl:variable name="fontStyle">
    <xsl:choose>
      <xsl:when test="$coltype = 'full'">
        <xsl:text>font-size: 20px; line-height: 30px;</xsl:text>
      </xsl:when>
      <xsl:otherwise>
        <xsl:text>font-size: 18px; line-height: 26px;</xsl:text>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:variable>
  <xsl:variable name="headlineStyle">
    <xsl:choose>
      <xsl:when test="$coltype = 'full'">
        <xsl:text>font-size: 32px; line-height: 40px;</xsl:text>
      </xsl:when>
      <xsl:otherwise>
        <xsl:text>font-size: 24px; line-height: 30px;</xsl:text>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:variable>
  <xsl:variable name="imageWidth">
    <xsl:choose>
      <xsl:when test="$coltype = 'full'">
        <xsl:text>600</xsl:text>
      </xsl:when>
      <xsl:otherwise>
        <xsl:text>285</xsl:text>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:variable>
  <xsl:variable name="imageHeight">
    <xsl:choose>
      <xsl:when test="$coltype = 'full'">
        <xsl:text>400</xsl:text>
      </xsl:when>
      <xsl:otherwise>
        <xsl:text>190</xsl:text>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:variable>
  <xsl:variable name="haslink" select="link and string-length(link) > 0"></xsl:variable>

  <xsl:if test="target">
    <xsl:call-template name="start_target"/>
  </xsl:if>
  <a>
    <xsl:attribute name="id">anchor<xsl:value-of select="position()"/></xsl:attribute>
    <xsl:attribute name="name">anchor<xsl:value-of select="position()"/></xsl:attribute>
  </a>
  <tr>
    <td height="20"></td>
  </tr>
  <tr>
    <td>
      <span class="dachzeile" style="display: block; text-transform: uppercase; font-size: 16px; line-height: 20px;">
        <font color="#003366">
          <xsl:value-of select="headline"/>
        </font>
      </span>
    </td>
  </tr>
  <tr>
    <td height="10"></td>
  </tr>

  <xsl:choose>
    <xsl:when test="is_chart_teaser = 'ja'">
      <xsl:variable name="chartImage">
        <xsl:choose>
          <xsl:when test="$coltype = 'full'">
            <xsl:text>[%embedded-image(3565);redesign-gradient.jpg]</xsl:text>
          </xsl:when>
          <xsl:otherwise>
            <xsl:text>[%embedded-image(3566);redesign-gradient-small.jpg]</xsl:text>
          </xsl:otherwise>
        </xsl:choose>
      </xsl:variable>
      <tr>
        <xsl:text disable-output-escaping="yes">&lt;td bgcolor="#003366" valign="middle" align="center" background="</xsl:text><xsl:value-of select="$chartImage" /><xsl:text disable-output-escaping="yes">" height="</xsl:text><xsl:value-of select="$imageHeight" /><xsl:text disable-output-escaping="yes">" class="chart-teaser</xsl:text><xsl:if test="$coltype != 'full'"> half</xsl:if><xsl:text disable-output-escaping="yes">" style="border-bottom: 8px solid #56BD66; font-weight: 600; padding: 0 20px; background-size: cover; background-position: right bottom; </xsl:text><xsl:value-of select="$headlineStyle" /><xsl:text disable-output-escaping="yes">"&gt;</xsl:text>
          <font color="#ffffff">
            <xsl:value-of select="chart_teaser_text" />
          </font>
        <xsl:text disable-output-escaping="yes">&lt;/td&gt;</xsl:text>
      </tr>
      <tr>
        <td height="20"></td>
      </tr>
    </xsl:when>
    <xsl:otherwise>
      <xsl:if test="group_picture">
        <tr>
          <td>
            <xsl:call-template name="picture">
              <xsl:with-param name="source" select="group_picture/picture"/>
              <xsl:with-param name="alt" select="group_picture/picture_alt"/>
              <xsl:with-param name="copyright" select="group_picture/picture_copyright"/>
              <xsl:with-param name="width"><xsl:value-of select="$imageWidth"/></xsl:with-param>
              <xsl:with-param name="height"><xsl:value-of select="$imageHeight"/></xsl:with-param>
            </xsl:call-template>
          </td>
        </tr>
      </xsl:if>
    </xsl:otherwise>
  </xsl:choose>

  <tr>
    <td>
      <xsl:choose>
        <xsl:when test="$haslink">
          <xsl:text disable-output-escaping="yes">&lt;a href="</xsl:text>
            <xsl:call-template name="tracklinktitle">
              <xsl:with-param name="url" select="link" />
            </xsl:call-template>
          <xsl:text disable-output-escaping="yes">" style="display: block; </xsl:text>
          <xsl:value-of select="$headlineStyle" />
          <xsl:text disable-output-escaping="yes"> color: #003366; text-decoration: underline;" class="h3"&gt;&lt;font color="#003366"&gt;</xsl:text>
            <xsl:value-of select="title" />
          <xsl:text disable-output-escaping="yes">&lt;/font&gt;&lt;/a&gt;</xsl:text>
        </xsl:when>
        <xsl:otherwise>
          <xsl:text disable-output-escaping="yes">&lt;span style="display: block; </xsl:text>
          <xsl:value-of select="$headlineStyle" />
          <xsl:text disable-output-escaping="yes"> color: #003366; text-decoration: underline;" class="h3"&gt;&lt;font color="#003366"&gt;</xsl:text>
            <xsl:value-of select="title" />
          <xsl:text disable-output-escaping="yes">&lt;/font&gt;&lt;/span&gt;</xsl:text>
        </xsl:otherwise>
      </xsl:choose>
    </td>
  </tr>

  <tr>
    <td height="20"></td>
  </tr>
  <tr>
    <td>
      <xsl:for-each select="paragraph">
        <xsl:text disable-output-escaping="yes">&lt;span style="</xsl:text>
        <xsl:value-of select="$fontStyle" />
        <xsl:text disable-output-escaping="yes"> display: inline;" class="p"&gt;&lt;font color="#003366"&gt;</xsl:text>
          <xsl:variable name="p" select="." />
          <xsl:value-of select="$p" />
        <xsl:text disable-output-escaping="yes">&lt;/font&gt;&lt;/span&gt;</xsl:text>
        <xsl:if test="position() = last()">
          <xsl:if test="$haslink">
            <xsl:text disable-output-escaping="yes">&nbsp; &lt;a href="</xsl:text>
            <xsl:call-template name="tracklinktitle">
              <xsl:with-param name="url" select="link" />
            </xsl:call-template>
            <xsl:text disable-output-escaping="yes">" style="</xsl:text>
            <xsl:value-of select="$fontStyle" />
            <xsl:text disable-output-escaping="yes"> color: #003366; text-decoration: underline;" class="p"&gt;&lt;font color="#003366"&gt;Weiterlesen&lt;/font&gt;&lt;/a&gt;</xsl:text>
          </xsl:if>
        </xsl:if>
        <xsl:if test="position() != last()">
          <br/>
        </xsl:if>
      </xsl:for-each>
    </td>
  </tr>
  <tr>
    <td height="20"></td>
  </tr>

  <xsl:if test="target">
    <xsl:call-template name="end_target"/>
  </xsl:if>
</xsl:template>


<xsl:template name="news_title">

</xsl:template>


<xsl:template match="imprint">
  <tr>
    <td>
      <table style="table-layout: fixed; border-collapse: collapse; border-spacing: 0;">
        <tr>
          <td width="240" valign="top" class="sm-block">
            <span style="font-weight: 600; font-size: 20px; line-height: 30px;" class="p title"><font color="#003366">Herausgeber</font></span>
          </td>
          <td width="360" valign="top" class="sm-block">
            <span style="font-size: 20px; line-height: 30px;" class="p">
              <font color="#003366">
                <xsl:value-of select="name"/><br />
                <xsl:value-of select="street"/><br />
                <xsl:value-of select="city"/>
              </font>
            </span>
          </td>
        </tr>
      </table>
    </td>
  </tr>
  <tr>
    <td height="20"></td>
  </tr>
  <tr>
    <td>
      <table style="table-layout: fixed; border-collapse: collapse; border-spacing: 0;">
        <tr>
          <td width="240" valign="top" class="sm-block">
            <span style="font-weight: 600; font-size: 20px; line-height: 30px;" class="p title"><font color="#003366">Redaktion &amp; Inhalt</font></span>
          </td>
          <td width="360" valign="top" class="sm-block">
            <table>
              <tr>
                <td valign="middle" width="40">
                  <img src="[%embedded-image(3559);redesign-mail.png]" width="30" height="30" border="0" style="display: inline-block; vertical-align: middle; margin-right: 7px; margin-bottom: 6px;" />
                </td>
                <td valign="middle">
                  <a href="mailto:{email}" style="font-size: 20px; line-height: 30px; color: #003366; text-decoration: underline; display: inline-block; vertical-align: middle; margin-bottom: 6px;" class="p"><font color="#003366">E-Mail schreiben</font></a>
                </td>
              </tr>
              <xsl:if test="phone and string-length(phone) > 0">
                <tr>
                  <td valign="middle" width="40">
                    <img src="[%embedded-image(3560);redesign-phone.png]" width="30" height="30" border="0" style="display: inline-block; vertical-align: middle; margin-right: 7px; margin-bottom: 6px;" />
                  </td>
                  <td valign="middle">
                    <a href="tel:{phone}" style="font-size: 20px; line-height: 30px; color: #003366; text-decoration: underline; display: inline-block; vertical-align: middle; margin-bottom: 6px;" class="p">
                      <font color="#003366">
                        <xsl:value-of select="phone"/>
                      </font>
                    </a>
                  </td>
                </tr>
              </xsl:if>
              <xsl:if test="fax and string-length(fax) > 0">
                <tr>
                  <td valign="middle" width="40">
                    <img src="[%embedded-image(3558);redesign-fax.png]" width="30" height="30" border="0" style="display: inline-block; vertical-align: middle; margin-right: 7px; margin-bottom: 6px;" />
                  </td>
                  <td valign="middle">
                    <span style="font-size: 20px; line-height: 30px; color: #003366; text-decoration: underline; display: inline-block; vertical-align: middle; margin-bottom: 6px;" class="p">
                      <font color="#003366">
                        <xsl:value-of select="fax"/>
                      </font>
                    </span>
                  </td>
                </tr>
              </xsl:if>
            </table>
          </td>
        </tr>
      </table>
    </td>
  </tr>
  <tr>
    <td height="20"></td>
  </tr>
  <xsl:if test="editorial_office and string-length(editorial_office) > 0">
    <tr>
      <td>
        <table style="table-layout: fixed; border-collapse: collapse; border-spacing: 0;">
          <tr>
            <td width="240" valign="top" class="sm-block">
              <span style="font-weight: 600; font-size: 20px; line-height: 30px;" class="p title"><font color="#003366">Vertretungsberechtigte</font></span>
            </td>
            <td width="360" valign="top" class="sm-block">
              <span style="font-size: 20px; line-height: 30px;" class="p">
                <font color="#003366">
                  <xsl:value-of select="editorial_office"/>
                </font>
              </span>
            </td>
          </tr>
        </table>
      </td>
    </tr>
  </xsl:if>
</xsl:template>


<xsl:template match="footer">
  <xsl:for-each select="paragraph">
    <xsl:call-template name="insert_break">
      <xsl:with-param name="text" select="."/>
    </xsl:call-template>
    <br /><br />
  </xsl:for-each>
  <xsl:call-template name="insert_break">
    <xsl:with-param name="text" select="copyright"/>
  </xsl:call-template>
</xsl:template>


<xsl:template name="picture">
  <xsl:param name="source"></xsl:param>
  <xsl:param name="alt"></xsl:param>
  <xsl:param name="copyright"><xsl:text></xsl:text></xsl:param>
  <xsl:param name="width">280</xsl:param>
  <xsl:param name="height">186</xsl:param>

  <xsl:text disable-output-escaping="yes">&lt;span class="image-box" style="display: block; border-bottom: 8px solid #56BD66;"&gt;&lt;img src="</xsl:text>
    <xsl:if test="not(contains($source, '[%embedded-image'))">
      <xsl:value-of disable-output-escaping="yes" select="$source"/>
    </xsl:if>
    <xsl:if test="contains($source, '[%embedded-image')">
      <xsl:variable name="embed_part" select="substring-after($source, 'src=')"/>
      <xsl:variable name="embed" select="substring-before($embed_part, 'alt=')"/>
      <xsl:value-of select="$embed"/>
    </xsl:if>
   " border="0" alt="<xsl:value-of select="$alt"/>" width="<xsl:value-of select="$width"/>" height="<xsl:value-of select="$height"/>" style="display: block; margin: 0; max-width: 100%; width: 100%;"<xsl:text disable-output-escaping="yes">/&gt;&lt;/span&gt;</xsl:text>
  <xsl:choose>
    <xsl:when test="string-length($copyright) > 0">
      <tr>
        <td class="copyright" valign="top" height="20" style="font-size: 14px; color: #003366; text-align: right; height: 20px; padding-bottom: 10px;">
          <xsl:value-of select="$copyright" />
        </td>
      </tr>
    </xsl:when>
    <xsl:otherwise>
      <tr>
        <td height="20"></td>
      </tr>
    </xsl:otherwise>
  </xsl:choose>

</xsl:template>


<xsl:template name="insert_break">
  <xsl:param name="text"/>
   <xsl:choose>
    <xsl:when test="contains($text,'&#10;')">
      <xsl:value-of select="substring-before($text,'&#10;')"/>
      <xsl:text>&lt;br&gt;</xsl:text>
      <xsl:call-template name="insert_break">
        <xsl:with-param name="text" select="substring-after($text,'&#10;')"/>
      </xsl:call-template>
    </xsl:when>
    <xsl:otherwise>
      <xsl:value-of select="$text"/>
    </xsl:otherwise>
  </xsl:choose>
</xsl:template>


<xsl:template name="render_text">
  <xsl:param name="text"/>
  <font color="#003366">
    <xsl:value-of select="$text"/>
  </font>
</xsl:template>


<xsl:template name="tracklinktitle">
  <xsl:param name="url" />
  <xsl:param name="title">
  </xsl:param>
  <xsl:value-of select="substring-before($url,']')" /><xsl:text>; "</xsl:text>
  <xsl:value-of select="$title"/>
  <xsl:text>"]</xsl:text>
</xsl:template>


<xsl:template name="start_target">
  <xsl:variable name="ending">
    <xsl:for-each select="target">
      <xsl:sort select="." data-type="text" order="descending" />
      <xsl:if test="position()=1">
        <xsl:if test="string-length(.) > 0">]
        </xsl:if>
      </xsl:if>
    </xsl:for-each>
  </xsl:variable>
  <xsl:for-each select="target">
    <xsl:sort select="." data-type="text" order="descending" />
    <xsl:if test="string-length(.) > 0">
      <xsl:if test="position() = 1">
        <xsl:text>
[%if </xsl:text>
      </xsl:if>
      <xsl:if test="position() != 1">
        <xsl:text> OR </xsl:text>
      </xsl:if>
      <xsl:text>BelongsToGroup("</xsl:text><xsl:value-of disable-output-escaping="yes" select="."/><xsl:text>")</xsl:text>
    </xsl:if>
    <xsl:if test="position()=last()">
      <xsl:value-of select="$ending"/>
    </xsl:if>
  </xsl:for-each>
</xsl:template>


<xsl:template name="end_target">
  <xsl:for-each select="target">
    <xsl:sort select="." data-type="text" order="descending" />
    <xsl:if test="string-length(.) > 0">
      <xsl:if test="position() = 1">
        <xsl:text>
[%endif]
</xsl:text>
      </xsl:if>
    </xsl:if>
  </xsl:for-each>
</xsl:template>

</xsl:stylesheet>
