<?xml version='1.0' encoding='ISO-8859-1'?> 
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:date="uri.any" version='1.0' >
  <!--xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:user="my">-->

  <!--<xsl:script implements-prefix="date" language="java" src="java:com.example.datestuff.DateRoutines"/>-->
  <msxsl:script language="CSharp" implements-prefix="date">

    public String c(int count)
    {String lopnummer = "";
    if(count &lt; 10)
    lopnummer = "000"+count.ToString();
    else if(count &lt; 100 &amp;&amp; count &gt; 10)
    lopnummer = "00"+count.ToString();
    else if(count &lt; 1000 &amp;&amp; count &gt; 100)
    lopnummer = "0"+count.ToString();
    else
    lopnummer = count.ToString();
    return lopnummer;
    }
  </msxsl:script>

  <!--<xsl:function name="my:add">
  <xsl:param name="val1" as="xs:integer"/>
  <xsl:result select="$val1 + 1" as="xs:integer"/>
</xsl:function>-->
  <xsl:variable name="counter" select="0" />
  <xsl:template match="/">
    <!-- exclude-result-prefixes="my"-->

    <html>
      <head>
      </head>
      <body>


        <!--<xsl:variable name="x">\\</xsl:variable>
<xsl:value-of select="$x"/>
<xsl:variable name="val1" as="xs:integer">-->

        <xsl:variable name="val1"/>
        <h2>ORDERS</h2>
        <table border="1">
          <tr bgcolor="#9acd32">
            <th align="left">Ftg</th>
            <th align="left">Säljare lgh</th>
            <th align="left">Order</th>
            <th align="left">Namn</th>
            <th align="left">Personnr</th>
            <th align="left">ev c/o</th>
            <th align="left">Adress</th>
            <th align="left">Postadress</th>
            <th align="left">Ort</th>
            <th align="left">Telefonnummer</th>
            <th align="left">Säljdatum</th>
            <th align="left">Leverans datum</th>
            <th align="left">Leveransstopp</th>
            <th align="left">kwh/år</th>
            <th align="left">Nätbolag</th>
            <th align="left">NÄT ID</th>
            <th align="left">Anläggnings ID nr</th>
            <th align="left">Anläggningsadress</th>
            <th align="left">Lghnr</th>
            <th align="left">Diverse kommentarer</th>
            <th align="left">Avtal</th>
            <th align="left">Näringsidkare</th>
            <th align="left">Ljudfilsnamn</th>
            <th align="left">Ljudfilsnamn2</th>
          </tr>
          <xsl:for-each select="orders/orders_som_ar_lika/orderrad">
            <!--orders/orders_som_ar_lika/orderrad-->
            <tr>
              <!--<td>
                <xsl:value-of select="date:book(leads.last_emp_login)"/>
              </td>-->
              <td>
                <xsl:choose>
                  <xsl:when test="system-property('xsl:vendor-url')='http://www.saxonica.com/'">
                    Running under Saxon 8
                  </xsl:when>
                  <xsl:when test="system-property('xsl:vendor-url')='http://saxon.sf.net/'">
                    Running under Saxon 6
                  </xsl:when>
                  <xsl:when test="system-property('xsl:vendor-url')='http://xml.apache.org/xalan-j'">
                    Running under Xalan-J
                  </xsl:when>
                  <xsl:when test="system-property('xsl:vendor-url')='http://www.microsoft.com'">
                    Running under MSXSL
                  </xsl:when>
                  <xsl:otherwise>
                    <xsl:message terminate="yes">
                      <xsl:text>Unsupported processor</xsl:text>
                    </xsl:message>
                  </xsl:otherwise>
                </xsl:choose>
              </td>
              <td>
                <xsl:value-of select="leads.last_emp_login"/>
              </td>
              <td>
                Ja
              </td>
              <td>
                <xsl:value-of select="agent_input.agent_input2"/>, <xsl:value-of select="agent_input.agent_input1"/>
              </td>
              <td>
                <xsl:value-of select="substring(agent_input.agent_input10, 1, 6)"/>-<xsl:value-of select="substring(agent_input.agent_input10, 7)"/>
              </td>
              <td>
              </td>
              <td>
                <xsl:value-of select="agent_input.agent_input3"/>
              </td>
              <td>
                <xsl:value-of select="agent_input.agent_input5"/>
              </td>
              <td>
                <xsl:value-of select="agent_input.agent_input6"/>
              </td>
              <td>
                <xsl:value-of select="leads.lead_profile5"/>
              </td>
              <td>
                <xsl:value-of select="substring(last_call_date,1,10)"/>
              </td>
              <!--<xsl:when test="(string-length($txt) &amp;lt; $linelen) or not(contains($txt,' '))">-->
              <td>2006-04-01</td>
              <xsl:choose>
                <xsl:when test="substring(leads.campaign, 1,3) = 'L16'">
                  <!--leads.campaign = 'L09*'">-->
                  <td>
                    2007-02-28
                  </td>
                </xsl:when>
                <xsl:otherwise>
                  <td>
                  </td>
                </xsl:otherwise>
              </xsl:choose>
              <td>  </td>
              <td>
                <xsl:value-of select="agent_input.agent_input7"/>
              </td>
              <td>
                <xsl:value-of select="agent_input.agent_input8"/>
              </td>
              <td>
                '<xsl:value-of select="agent_input.agent_input11"/>
              </td>
              <td>
                <xsl:value-of select="agent_input.agent_input3"/>
              </td>
              <td></td>
              <!--<td><xsl:value-of select="substring-after(leads.campaign,'L')"/></td>-->
              <td>
                K<xsl:value-of select="substring(leads.campaign, 1,3)"/>_<xsl:value-of select="substring(last_call_date,4,1)"/><xsl:value-of select="substring(last_call_date,6,2)"/><xsl:value-of select="substring(last_call_date,9,2)"/><xsl:value-of select="date:c(position())"/>:<xsl:value-of select="agent_input.agent_input13"/>
              </td>
              <td></td>
              <td></td>
              <td>
                <xsl:value-of select="substring(agent_input.agent_input19, 42,100)"/>.mp3
              </td>
              <td>
                <xsl:value-of select="agent_input.agent_input19"/>.mp3
              </td>
              <!--<td><xsl:value-of select="val1"/></td>
      <td><xsl:value-of select="my:add(1)" /></td>-->
              <!--<td><xsl:value-of select="user:circumference(4)"/></td>-->

            </tr>
          </xsl:for-each>
        </table>
      </body>
    </html>
  </xsl:template>
</xsl:stylesheet>