<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="category"></xsl:param>
    <xsl:param name="title"></xsl:param>
    <xsl:param name="path"></xsl:param>
    <xsl:param name="url"></xsl:param>
    <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'>
        <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 nieuwsberichten aanwezig in deze categorie.</div>
        </xsl:if>
    </xsl:template>

    <xsl:template match='z:row'>
        <div id="wxPageHeader">
            <xsl:attribute name="style">
                <xsl:variable name="quot">'</xsl:variable>
                <xsl:variable name="url">
                    <xsl:call-template name="all-before-last-comma">
                        <xsl:with-param name="str" select="@ows_Afbeelding"/>
                    </xsl:call-template>
                </xsl:variable>
                <xsl:value-of select="concat('background-image: url(', $quot, $url, $quot, ');')"/>
            </xsl:attribute>
            <div id="wxPageHeaderTitle">
                <xsl:value-of select="@ows_LinkTitle"/>
            </div>
        </div>
    </xsl:template>

    <xsl:template name="all-before-last-comma">
        <xsl:param name="str"/>
        <xsl:if test="contains($str, ',')">
            <xsl:value-of select="substring-before($str, ',')"/>
            <xsl:if test="contains(substring-after($str, ','), ',')">
                <xsl:text>,</xsl:text>
            </xsl:if>
            <xsl:call-template name="all-before-last-comma">
                <xsl:with-param name="str" select="substring-after($str, ',')"/>
            </xsl:call-template>
        </xsl:if>
    </xsl:template>
</xsl:stylesheet>
