﻿<?xml version='1.0' encoding='utf-8'?>
<xsl:stylesheet
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:rs='urn:schemas-microsoft-com:rowset'
 	 xmlns:z='#RowsetSchema'
	xmlns:date="http://www.ora.com/XSLTCookbook/NS/dates"
   xml:space="default"
	version="1.0">

	<xsl:param name="limit" select="100"/>
	<xsl:param name="titleLimit" select="30"/>
	<xsl:strip-space elements="true"/>
	<xsl:output omit-xml-declaration="yes" />

	<xsl:template match='//rs:data'>
		<div style='display: none;'>
			<table border="0" cellpadding="0" cellspacing="0" width="777" style="border: none;
	color: #003366; font-family: Arial !important;
	font-size: 12px; margin: 0px; padding: 0px; width: 777px;">
				<tbody>
					<xsl:apply-templates select='z:row'/>
					<xsl:variable name="rows" select="z:row" />
					<xsl:if test="count($rows) &lt; 1">
						<div style="padding:10px;">Er zijn geen kandidaat-nieuwsberichten aanwezig in deze categorie.</div>
					</xsl:if>
				</tbody>
			</table>
		</div>
	</xsl:template>

	<xsl:template match='z:row'>
		<xsl:variable name="rawUrl">
			<xsl:value-of select='substring-before(@ows_EncodedAbsUrl, "_.")'/>
		</xsl:variable>
		<xsl:variable name="link">
			<xsl:value-of select='concat(substring($rawUrl, 1, string-length($rawUrl) - string-length(string(@ows_ID))), "DispFormWindexCC.aspx?ID=", @ows_ID, "&amp;Source=/")'/>
		</xsl:variable>
		<TR>
			<TD colspan="5" valign="top" width="415" style="PADDING: 0cm; BACKGROUND: white; width: 415px">
				<a name="Nieuwsbrief">
					<TABLE>
						<TBODY>
							<tr>
								<td valign="top">
									<table cellpadding="0" cellspacing="0" style="border: none; background-color: #003366; width: 280px">
										<tr>
											<td>
												<img>
													<xsl:attribute name="src">
														<xsl:choose>
															<xsl:when test="substring-before(@ows_NieuwsflitsAfbeelding, ',') != ''">
																<xsl:value-of select="substring-before(@ows_NieuwsflitsAfbeelding, ',')"/>
															</xsl:when>
															<xsl:otherwise>http://www.vno-ncwmidden.nl/Nieuwsflits/VNO-NCW%20Midden%20Nieuwsflits%20-%20Basisfoto.jpg</xsl:otherwise>
														</xsl:choose>
													</xsl:attribute>
													<xsl:attribute name="alt">
														<xsl:value-of select="substring-after(@ows_NieuwsflitsAfbeelding, ',')"/>
													</xsl:attribute>
												</img>
											</td>
											<td style="background: #003366;">
												<img src="/_layouts/images/void.gif" width="20"/>
											</td>
										</tr>
									</table>
								</td>
								<td>
									<img src="/_layouts/images/void.gif" width="35"/>
								</td>
								<td valign="top">
									<span>

										<table border="0" cellpadding="0" cellspacing="0" width="385" style="border: none;
				font-family: Arial !important; font-size: 12px; margin: 0px; padding: 0px; width: 385px;">
											<tr>
												<td style="border-bottom: 12px solid white; color: #003366; font-size: 18px; font-weight: bold;
						text-transform: uppercase; font-family: Arial !important;">
													<a style="color: #003366; font-size: 18px; font-family: Arial !important;">
														<xsl:attribute name="href">
															<xsl:value-of select='$link'/>
														</xsl:attribute>
														<font face="Arial">
															<xsl:if test="@ows_LinkTitle != ''">
																<xsl:value-of select='@ows_LinkTitle' disable-output-escaping='yes'  />
															</xsl:if>
														</font>
													</a>
												</td>
												<td align="right">
													<select>
														<xsl:attribute name="name">NewsWebPartOrderingSelector</xsl:attribute>
													</select>

													<select>
														<xsl:attribute name="name">NewsWebPartCandidateSelector</xsl:attribute>
														<option value="Kandidaat">Kandidaat</option>
														<option value="Geplaatst" selected="selected">Plaatsen</option>
														<option value="Niet geplaatst">Niet plaatsen</option>
													</select>
												</td>
											</tr>
										</table>
										<a style="color: #999;">
											<xsl:attribute name="href">
												<xsl:value-of select='source/@url'/>
											</xsl:attribute>
											<xsl:value-of select='source'/>
										</a>
										<xsl:text disable-output-escaping="yes"> </xsl:text>

										<div style="text-align: right; color: black; font-family: Arial, Helvetica, Sans-Serif; font-size: 11px; text-align: right; border-top: 7px solid white;">
											<xsl:call-template name="date:calculate-day-of-the-week">
												<xsl:with-param name="year" select='substring(@ows_Datum,1,4)'/>
												<xsl:with-param name="month" select='substring(@ows_Datum,6,2)'/>
												<xsl:with-param name="day" select='substring(@ows_Datum,9,2)'/>
											</xsl:call-template>
											<xsl:value-of select='number(substring(@ows_Datum,9,2))'/>
											<xsl:variable name="mo">
												<xsl:value-of select='substring(@ows_Datum,6,2)'/>
											</xsl:variable>
											<xsl:choose>
												<xsl:when test="$mo = '01'"> januari </xsl:when>
												<xsl:when test="$mo = '02'"> februari </xsl:when>
												<xsl:when test="$mo = '03'"> maart </xsl:when>
												<xsl:when test="$mo = '04'"> april </xsl:when>
												<xsl:when test="$mo = '05'"> mei </xsl:when>
												<xsl:when test="$mo = '06'"> juni </xsl:when>
												<xsl:when test="$mo = '07'"> juli </xsl:when>
												<xsl:when test="$mo = '08'"> augustus </xsl:when>
												<xsl:when test="$mo = '09'"> september </xsl:when>
												<xsl:when test="$mo = '10'"> oktober </xsl:when>
												<xsl:when test="$mo = '11'"> november </xsl:when>
												<xsl:when test="$mo = '12'"> december </xsl:when>
											</xsl:choose>
											<xsl:value-of select='substring(@ows_Datum,1,4)'/>
										</div>
										
										<!-- end actions -->
										<span align="justify" name="NewsWebPartNewsBody" style="overflow: hidden; font-family: Arial !important; font-size: 12px; text-align: justify;">
											<font face="Arial">
												<xsl:if test="@ows_Inleiding_x0020_nieuwsflits != ''">
													<xsl:value-of select='@ows_Inleiding_x0020_nieuwsflits' disable-output-escaping='yes'  />
												</xsl:if>
											</font>
											<xsl:if test="@ows_Body != ''">
												<a title="Klik voor het volledige bericht" href="http://www.vno-ncwwest.nl"
   style="color: #003366; text-decoration: none; font-weight: normal; font-family: Arial !important; font-size: 12px; line-height: 18px;">
												<xsl:attribute name="href">
													<xsl:value-of select='$link'/>
												</xsl:attribute>
												<font face="Arial">
													Lees verder >
												</font>
												</a>
											</xsl:if>
										</span>

										<span name="NewsWebPartCategoryLabel" style="display: none; color: white;">
											<xsl:value-of select="concat(@ows_Nieuwsbriefcategorie, ';#')" disable-output-escaping='yes'  />
										</span>
									</span>
								</td>
							</tr>
						</TBODY>
					</TABLE>
				</a>
			</TD>
		</TR>
	</xsl:template>
	<xsl:template name="date:calculate-day-of-the-week">
		<xsl:param name="date-time"/>
		<xsl:param name="date" select="substring-before($date-time,'T')"/>
		<xsl:param name="year" select="substring-before($date,'-')"/>
		<xsl:param name="month"
				  select="substring-before(substring-after($date,'-'),'-')"/>
		<xsl:param name="day" select="substring-after(substring-after($date,'-'),'-')"/>

		<xsl:variable name="a" select="floor((14 - $month) div 12)"/>
		<xsl:variable name="y" select="$year - $a"/>
		<xsl:variable name="m" select="$month + 12 * $a - 2"/>

		<xsl:variable name="d" select="($day + $y + floor($y div 4) - floor($y div 100) 
    + floor($y div 400) + floor((31 * $m) div 12)) mod 7"/>
		<xsl:choose>
			<xsl:when test="$d = 1">maandag </xsl:when>
			<xsl:when test="$d = 2">dinsdag </xsl:when>
			<xsl:when test="$d = 3">woensdag </xsl:when>
			<xsl:when test="$d = 4">donderdag </xsl:when>
			<xsl:when test="$d = 5">vrijdag </xsl:when>
			<xsl:when test="$d = 6">zaterdag </xsl:when>
			<xsl:when test="$d = 0">zondag </xsl:when>
		</xsl:choose>
	</xsl:template>
</xsl:stylesheet>
