<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template match="/">
  
  <html>
  <head>
  
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>
<xsl:choose>
	<xsl:when test="count(credcheck/parameter) &gt; 55">
	   Stor kreditupplysning
	</xsl:when>
	<xsl:when test="count(credcheck/parameter) &gt; 40">
	   Enkel kreditupplysning
	</xsl:when>
	<xsl:otherwise>
	   Anmärkningskontroll
	</xsl:otherwise>
</xsl:choose>
</title></head>
<body style="background-color: #FFFFFF">
<table width="580" border="0" cellpadding="1" cellspacing="0" style="background-color: #000000; font-family: Arial, Helvetica, sans-serif">
  <tr>
    <td>
      <table border="0" cellpadding="0" cellspacing="8" width="100%" style="background-color: #FFFFFF;">
        <tr> 
          <td valign="top"> 
            <table width="100%" border="0" cellpadding="1" cellspacing="0" style="font-size: 12px">
              <tr> 
                <td colspan="2" style="font-weight: bold; font-size: 14px">
               <xsl:choose>
	    	<xsl:when test="count(credcheck/parameter) &gt; 55">
	            Stor kreditupplysning
	         </xsl:when>
	        <xsl:when test="count(credcheck/parameter) &gt; 40">
	            Enkel kreditupplysning
	         </xsl:when>
	          <xsl:otherwise>
	            Anmärkningskontroll
	          </xsl:otherwise>
	       </xsl:choose>  
                <br />
                  <xsl:value-of select="credcheck/parameter[name='Datum kreditupplysning']/value" />
                  <br /><br />
                 </td>
              </tr>
              <tr> 
                <td colspan="2">
	<xsl:choose>
	    	<xsl:when test="starts-with(credcheck/parameter[name='Rating kod']/value,'Ingen')">
	          </xsl:when>
	    	<xsl:when test="count(credcheck/parameter) &gt; 40 and credcheck/parameter[name='Rating kod']/value &gt; 79">
	            <img border="0" src="../system/bmp/cstat4.gif" />
	         </xsl:when>
	        <xsl:when test="count(credcheck/parameter) &gt; 40 and credcheck/parameter[name='Rating kod']/value &gt; 59">
	            <img border="0" src="../system/bmp/cstat3.gif" />
	         </xsl:when>
	        <xsl:when test="count(credcheck/parameter) &gt; 40 and credcheck/parameter[name='Rating kod']/value &gt; 39">
	            <img border="0" src="../system/bmp/cstat2.gif" />
	         </xsl:when>
	        <xsl:when test="count(credcheck/parameter) &gt; 40 and credcheck/parameter[name='Rating kod']/value &gt; 14">
	            <img border="0" src="../system/bmp/cstat1.gif" />
	         </xsl:when>   
	          <xsl:when test="count(credcheck/parameter) &gt; 40">
	            <img border="0" src="../system/bmp/cstat0.gif" />
	          </xsl:when>   
        </xsl:choose>
				</td>
              </tr>
             <xsl:if test="count(credcheck/parameter) &gt; 40">
              <tr> 
                <td><xsl:value-of select="credcheck/parameter[name='Rating text']/value" /></td>
                <td>Poäng:&#032;<xsl:value-of select="credcheck/parameter[name='Rating kod']/value" /></td>
              </tr>
             </xsl:if>
            </table>
          </td>
          <td width="10%">&#032;</td>
          <td valign="top" align="right"> 
            <table width="100%" border="0" cellpadding="1" cellspacing="0" style="font-size: 12px">
              <tr> 
                <td><xsl:value-of select="credcheck/parameter[name='Organisationsnr']/value" /></td>
              </tr>
              <tr> 
                <td style="font-weight: bold; font-size: 14px"><xsl:value-of select="credcheck/parameter[name='Företagets namn']/value" /></td>
              </tr>
              <tr> 
                <td><xsl:value-of select="credcheck/parameter[name='Utdelningsadress']/value" /></td>
              </tr>
              <tr> 
               <td><xsl:value-of select="credcheck/parameter[name='Postnr']/value" />&#032;<xsl:value-of select="credcheck/parameter[name='Postort']/value" /></td>
              </tr>
              <tr> 
                <td>Regdatum:&#032;<xsl:value-of select="credcheck/parameter[name='Registreringsdatum']/value" />
                <br /><br />
                </td>
              </tr>
            </table>
          </td>
        </tr>
        <tr> 
          <td colspan="3"> 
            <table width="100%" border="0" cellpadding="1" cellspacing="0" style="font-size: 12px">
              <tr> 
                <td>Betalningsanmärkningar</td>
                <td>Antal:&#032;<xsl:value-of select="credcheck/parameter[name='Betalningsanmärkningar antal']/value" /></td>
                <td>SEK:&#032;<xsl:value-of select="credcheck/parameter[name='Betalningsanmärkningar SEK']/value" /></td>
              	<td width="40%"></td>
              </tr>
              <tr> 
                <td>Betalningsansökan</td>
                <td>Antal:&#032;<xsl:value-of select="credcheck/parameter[name='Betalningsansökan antal']/value" /></td>
                <td>SEK:&#032;<xsl:value-of select="credcheck/parameter[name='Betalningsansökan SEK']/value" /></td>
              	<td width="40%"></td>
              </tr>
              <tr> 
                <td>Skuldsaldo</td>
                <td>Datum:&#032;<xsl:value-of select="credcheck/parameter[name='Skuldsaldo datum']/value" /></td>
                <td>SEK:&#032;<xsl:value-of select="credcheck/parameter[name='Skuldsaldo totalt SEK']/value" /></td>
              	<td width="40%"></td>
              </tr>
            </table>
          </td>
        </tr>
        <tr> 
          <td colspan="3">
            <table width="100%" border="0" cellpadding="1" cellspacing="0" style="font-size: 12px">
              <tr> 
                <td>Rörelsens intäkter&#032;(kkr):&#032;<xsl:value-of select="credcheck/parameter[starts-with(name,'Rörelsens intäkter')]/value" /></td>
                <td>Nettoresultat&#032;(kkr):&#032;<xsl:value-of select="credcheck/parameter[starts-with(name,'Nettoresultat')]/value" /></td>
                <td>Soliditet:&#032;<xsl:value-of select="credcheck/parameter[starts-with(name,'Soliditet')]/value" /></td>
              </tr>
            </table>
          </td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<br />
  
    
<table border="1" width="580" style="border-color: #000000; font-family: Arial, Helvetica, sans-serif; font-size: 10px">
  <tr>
      <td align="left" style="background-color: #0099CC; color: #FFFFFF; font-weight: bold; font-size: 12px">Parameter</td>    
      <td align="left" style="background-color: #0099CC; color: #FFFFFF; font-weight: bold; font-size: 12px">Värde</td>
    </tr>
    
    <xsl:for-each select="credcheck/parameter">
    <tr>
      <td><xsl:value-of select="name"/></td>
      <td>
      <xsl:if test="value = ''">---</xsl:if>
      <xsl:value-of select="value"/></td>
    </tr>
    </xsl:for-each>
    </table>
  </body>
  </html>
</xsl:template>
</xsl:stylesheet>

