﻿<?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;'>
			<h3 class="ms-standardheader ms-WPTitle'">
				<xsl:value-of select='title' disable-output-escaping='yes'  />
			</h3>
			<table border='0' cellpadding='0' cellspacing='0' width='526' style='margin: 0px; padding 0px; border: 0px; width: 727px;'>
				<tbody>
					<xsl:apply-templates select='z:row'>
						<xsl:sort select="@ows_Datum" order="descending"/>
					</xsl:apply-templates>
					<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:if test="@ows_Nieuwsbriefopname = 'Kandidaat'">
			<TR>
				<xsl:variable name="rawUrl">
					<xsl:value-of select='substring-before(@ows_EncodedAbsUrl, "_.")'/>
				</xsl:variable>
				<TD valign="top" width="403" height="96" style="PADDING: 0cm; BACKGROUND: white; width: 403px; height: 96px;">
					<TABLE width="403" height="96" border="0" style="border-bottom: medium none; border-left: medium none; padding-bottom: 0px; line-height: 14px; background-color: #e9f3fd; margin: 0px; padding-left: 0px; width: 403px; padding-right: 0px; font-family: Arial, Helvetica, Sans-Serif; height: 96px; font-size: 11px; border-top: medium none; border-right: medium none; padding-top: 0px;">
						<TBODY>
							<tr>
								<td width="12" style="width: 12px;">
									<img src="/_layouts/images/void.gif" width="12"/>
								</td>
								<td valign="middle" width="403" height="96" style="width: 403px; font-size: 9pt; font-family: Arial; height: 96px; vertical-align: middle;">
									<span>
										<table border="0" cellSpacing="0" cellPadding="0" width="100%" style="background-color: transparent; margin: 0px; padding 0px; border: 0px;">
											<tr>
												<td>
													<xsl:if test="string-length(@ows_Categorie) &gt; 0">
														<span style="font-family: 'Century Gothic', 'Trebuchet MS', 'Arial'; text-transform: uppercase; color: #f7941d; font-size: 20px; border-bottom: white 6px solid;">
															<xsl:value-of select='@ows_Categorie' disable-output-escaping='yes'  />
														</span>
														<br/>
													</xsl:if>
													<span style="color: black; font-size: 9pt; font-family: Arial; font-style: normal; border-bottom: white 4px solid">
														<strong>
															<a style="color: #1994b0; font-size: 14px; font-weight: bold !important; text-decoration: none;">
																<xsl:attribute name="href">
																	<xsl:value-of select='concat(substring($rawUrl, 1, string-length($rawUrl) - string-length(string(@ows_ID))), "DispFormWindexCC.aspx?ID=", @ows_ID, "&amp;Source=/")'/>
																</xsl:attribute>
																<xsl:choose>
																	<xsl:when test="string-length(@ows_LinkTitle) &lt; 1">
																		<xsl:value-of select="substring(@ows_Body,0,$titleLimit)" disable-output-escaping='yes'/>
																	</xsl:when>
																	<xsl:otherwise>
																		<xsl:value-of select='@ows_LinkTitle' disable-output-escaping='yes'  />
																	</xsl:otherwise>
																</xsl:choose>
															</a>
														</strong>
													</span>
												</td>
												<td align="right">
													<select id="NewsWebPartOrderingSelector">
													</select>

													<select id="NewsWebPartCandidateSelector">
														<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>

										<!-- end actions -->
										<span name="NewsWebPartNewsBody" style="color: black; height: 56px !important; overflow: hidden;">
											<a style="height: 56px !important; color: black !important; text-decoration: none; font-weight: normal; font-size: 9pt; font-family: Arial, Helvetica, sans-serif;">
												<xsl:choose>
													<xsl:when test="string-length(@ows_Inleiding) &gt; 1">
														<xsl:call-template name="removeHtmlTags">
															<xsl:with-param name="html" select="@ows_Inleiding" />
														</xsl:call-template>
													</xsl:when>
													<xsl:otherwise>
														<xsl:call-template name="removeHtmlTags">
															<xsl:with-param name="html" select="@ows_Body" />
														</xsl:call-template>
													</xsl:otherwise>
												</xsl:choose>
											</a>
										</span>

										<span name="NewsWebPartCategoryLabel" style="display: none; color: white;">
											<xsl:value-of select="concat(@ows_Nieuwsbriefcategorie, ';#')" disable-output-escaping='yes'  />
										</span>
									</span>
								</td>
								<td width="5" style="width: 5px;">
									<img src="/_layouts/images/void.gif" width="5"/>
								</td>
							</tr>
						</TBODY>
					</TABLE>
					<br/>
				</TD>
				<td>
					<a style="color: #1c8d1b; font-size: 15px; font-weight: bold; text-decoration: none;">
						<xsl:attribute name="href">
							<xsl:value-of select='concat(substring($rawUrl, 1, string-length($rawUrl) - string-length(string(@ows_ID))), "DispFormWindexCC.aspx?ID=", @ows_ID, "&amp;Source=/")'/>
						</xsl:attribute>
						<img border="1" style="border: 1px solid #1c8d1b;">
							<xsl:attribute name="src">
								<xsl:value-of select="substring-before(@ows_Nieuwsbriefafbeelding, ',')"/>
							</xsl:attribute>
						</img>
					</a>
					<br/>
					<br/>
				</td>
			</TR>
		</xsl:if>
	</xsl:template>

	<xsl:template name="removeHtmlTags">
		<xsl:param name="html"/>
		<xsl:choose>
			<xsl:when test="contains($html, '&lt;')">
				<xsl:value-of select="substring-before($html, '&lt;')"/>
				<!-- Recurse through HTML -->
				<xsl:call-template name="removeHtmlTags">
					<xsl:with-param name="html" select="substring-after($html, '&gt;')"/>
				</xsl:call-template>
			</xsl:when>
			<xsl:otherwise>
				<xsl:value-of select="$html"/>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>
</xsl:stylesheet>
