<?xml version="1.0" ?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:simple="http://my.netscape.com/rdf/simple/0.9/" xmlns:rss="http://purl.org/rss/1.0/"
    xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dcterms="http://purl.org/dc/terms/"
    xmlns:content="http://purl.org/rss/1.0/modules/content/"
    xmlns:syn="http://purl.org/rss/1.0/modules/syndication/" xmlns:atom="http://purl.org/atom/ns#"
    xmlns:atom1="http://www.w3.org/2005/Atom" xmlns:foaf="http://xmlns.com/foaf/0.1/"
    xmlns:admin="http://webns.net/mvcb/" xmlns:icbm="http://postneo.com/icbm"
    xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#"
    xmlns:enc="http://purl.oclc.org/net/rss_2.0/enc#"
    xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:unic="http://www.uni-c.dk/namespace/"
    exclude-result-prefixes="rdf simple rss dc dcterms content syn atom atom1 foaf admin icbm geo enc wfw unic">
    <xsl:output method="html"/>


    <xsl:param name="RandomVal">46</xsl:param>
    <!-- 0 indicates no Random -->
    <xsl:param name="Show">All</xsl:param>
    <!-- 'Item' indicates whole item with title -->
    <!-- 'Short' indicates short item with title -->
    <!-- 'Title' indicates title only with link-->
    <!-- 'All' indicates title with link, whole item and image-->
    <!-- 'fArT' indicates title with link, whole item and image-->
    <!-- 'EUB' special EUB processing-->
    <!-- 'EMUcal' special formating of EMU calender-->
    <xsl:param name="Date">no</xsl:param>
    <!-- 'afterTitle' indicates item date should be included after Title -->
    <!-- 'beforeTitle' indicates item date should be included before Title -->
    <!-- 'afterItem' indicates item date should be included after Item -->
    <!-- 'no' indicates item date should not be included -->
    <xsl:param name="Source">Hide</xsl:param>
    <!-- 'Show'/'ShowP'/'Hide' channel-link -->
    <xsl:param name="Random">0</xsl:param>
    <!-- 0 indicates no Random -->
    <!-- 1 indicates a random item selected by RandomVal -->
    <!-- 2 indicates all items -->
    <xsl:param name="First">1</xsl:param>
    <!-- 0 indicates no UseFirst -->
    <xsl:param name="Last">10</xsl:param>
    <!-- 0 indicates no UseLast -->

    <xsl:param name="Lang">da</xsl:param>
    <!-- default da other possibilities: en -->

    <xsl:variable name="UseFirst">
        <xsl:choose>
            <xsl:when test="$Random = 2">1</xsl:when>
            <!-- all -->
            <xsl:otherwise>
                <xsl:value-of select="$First"/>
            </xsl:otherwise>
        </xsl:choose>
    </xsl:variable>
    <xsl:variable name="UseLast">
        <xsl:choose>
            <xsl:when test="$Random = 2">99</xsl:when>
            <!-- all -->
            <xsl:otherwise>
                <xsl:value-of select="$Last"/>
            </xsl:otherwise>
        </xsl:choose>
    </xsl:variable>
    <xsl:variable name="h2Class">
        <xsl:choose>
            <xsl:when test="$Source = 'Hide'">displayNone</xsl:when>
            <xsl:otherwise>rssFeedTitle</xsl:otherwise>
        </xsl:choose>
    </xsl:variable>
    <xsl:variable name="SourceClass">
        <xsl:choose>
            <xsl:when test="$Source = 'Hide'">displayNone</xsl:when>
            <xsl:otherwise>rssFeedSource</xsl:otherwise>
        </xsl:choose>
    </xsl:variable>
    <xsl:variable name="Single">
        <xsl:choose>
            <xsl:when test="$UseFirst = $UseLast">
                <xsl:value-of select="$UseFirst"/>
            </xsl:when>
            <xsl:otherwise>0</xsl:otherwise>
        </xsl:choose>
    </xsl:variable>
    <xsl:variable name="UseItemLink">
        <xsl:choose>
            <xsl:when test="$Show = 'All'">no</xsl:when>
            <xsl:when test="$Show = 'fArT'">no</xsl:when>
            <xsl:when test="$Source = 'Hide'">no</xsl:when>
            <xsl:when test="$Random = 1">yes</xsl:when>
            <xsl:when test="$Single != 0">yes</xsl:when>
            <xsl:otherwise>no</xsl:otherwise>
        </xsl:choose>
    </xsl:variable>
    <xsl:variable name="LaesMere">
        <xsl:choose>
            <xsl:when test="$Lang = 'en'">Read more</xsl:when>
            <xsl:otherwise>L&#230;s mere</xsl:otherwise>
        </xsl:choose>
    </xsl:variable>
    <xsl:variable name="LaesMereI">
        <xsl:choose>
            <xsl:when test="$Lang = 'en'">Read more in</xsl:when>
            <xsl:otherwise>L&#230;s mere i</xsl:otherwise>
        </xsl:choose>
    </xsl:variable>
    <xsl:variable name="Kilde">
        <xsl:choose>
            <xsl:when test="$Lang = 'en'">Source</xsl:when>
            <xsl:otherwise>Kilde</xsl:otherwise>
        </xsl:choose>
    </xsl:variable>

    <xsl:template match="/">
        <xsl:apply-templates select="/rdf:RDF[rss:channel or simple:channel]"/>
        <xsl:apply-templates select="/rss[@version]/channel"/>
        <xsl:apply-templates select="/redirect/newLocation"/>
        <xsl:apply-templates select="/atom:feed[@version='0.3']"/>
        <xsl:apply-templates select="/atom1:feed"/>
    </xsl:template>

    <xsl:template match="rss/channel">
        <xsl:choose>
            <xsl:when test="$Show = 'EUB'">
                <xsl:call-template name="listEUB"/>
            </xsl:when>
            <xsl:when test="$Show = 'EMUcal'">
                <xsl:call-template name="listCalendar"/>
            </xsl:when>
            <xsl:otherwise>
                <xsl:call-template name="listNormal"/>
            </xsl:otherwise>
        </xsl:choose>
    </xsl:template>

    <xsl:template name="listNormal">
        <xsl:variable name="GlobalLink" select="/rss/channel/link"/>
        <xsl:variable name="GlobalLink1">
            <xsl:value-of select="substring-after($GlobalLink, 'http://')"/>
        </xsl:variable>
        <xsl:variable name="GlobalLink2">
            <xsl:value-of select="substring-before($GlobalLink1, '/')"/>
        </xsl:variable>
        <xsl:variable name="GlobalDomain">
            <xsl:value-of select="substring-after($GlobalLink2, '.')"/>
        </xsl:variable>

        <xsl:variable name="rssTitle">
           <xsl:value-of select="title"/>
        </xsl:variable>

        <div class="box norm">
            <div class="box-i">
                <xsl:call-template name="mainTitle">
                    <xsl:with-param name="title" select="$rssTitle"/>
                </xsl:call-template>
                <xsl:call-template name="listItem">
                    <xsl:with-param name="GlobalDomain" select="$GlobalDomain"/>
                    <xsl:with-param name="title" select="$rssTitle"/>
                    <xsl:with-param name="href" select="link"/>
                </xsl:call-template>
                <xsl:call-template name="box-f">
                    <xsl:with-param name="title" select="$rssTitle"/>
                    <xsl:with-param name="href" select="link"/>
                </xsl:call-template>
            </div>
        </div>
    </xsl:template>

    <xsl:template name="listEUB">
        <xsl:variable name="antal_kurser" select="count(item)"/>
        <div class="box norm">
            <div class="box-i">
                <h2 class="dt">Efteruddannelseskataloget</h2>
                <xsl:choose>
                    <xsl:when test="$antal_kurser = 0">
                        <p>Der er ingen aktuelle tilbud i dette udtr&#230;k fra
                            Efteruddannelseskataloget for de gymnasiale uddannelser.<br/> Se alle
                            tilbud i <a href="http://efteruddgym.emu.dk/"
                                >Efteruddannelseskataloget</a>. </p>
                    </xsl:when>
                    <xsl:otherwise>
                        <p>
                            <xsl:call-template name="string-replace-all-by-bullet">
                                <xsl:with-param name="text">
                                    <xsl:value-of select="description"/>
                                </xsl:with-param>
                                <xsl:with-param name="replace" select="'- '"/>
                            </xsl:call-template>
                        </p>
                        <table class="unic_eub">
                            <thead>
                                <tr>
                                    <th>Titel</th>
                                    <th>Dato</th>
                                    <th align="center">Status</th>
                                </tr>
                            </thead>
                            <tbody>
                                <xsl:call-template name="listItemEUB"/>
                            </tbody>
                        </table>
                        <p class="minimal">
                            <img src="http://css.emu.dk/images/eub/ledig.gif"
                                title="Der er ledige pladser" alt=""/> - Der er ledige pladser<br/>
                            <img src="http://css.emu.dk/images/eub/ingen-ledige.gif"
                                title="Der er ikke ledige pladser" alt=""/> - Der er ikke ledige pladser<br/>
                            <img src="http://css.emu.dk/images/eub/aaben.gif"
                                title="Kurset er &#229;bent for tilmeldinger" alt=""/> - Kurset er
                            &#229;bent for tilmeldinger<br/>
                            <img src="http://css.emu.dk/images/eub/aflyst.gif"
                                title="Kurset er aflyst" alt=""/> - Kurset er aflyst </p>
                    </xsl:otherwise>
                </xsl:choose>
                <p class="box-f">
                    <a href="{link}" title="{title}"><xsl:value-of select="$LaesMere"/>...</a>
                </p>
            </div>
        </div>
    </xsl:template>

    <xsl:template name="listCalendar">
        <xsl:variable name="showItem">
            <xsl:call-template name="selection">
                <xsl:with-param name="itemcount" select="count(item)"/>
            </xsl:call-template>
        </xsl:variable>
        <xsl:for-each select="item">
            <xsl:if
                test="($showItem = position()) or ($showItem = 0 and position() >= $UseFirst and $UseLast >= position())">
                <div class="box cald">
                    <div class="box-i">
                        <h2 class="dt">
                            <xsl:element name="abbr">
                                <xsl:attribute name="class">dtstart</xsl:attribute>
                                <xsl:attribute name="title"><xsl:call-template name="listUnicFdate1"
                                    />T000000Z</xsl:attribute>
                                <xsl:element name="span">
                                    <xsl:attribute name="class">dtstart</xsl:attribute>
                                    <xsl:attribute name="title"><xsl:call-template
                                            name="listUnicFdate1"/>T000000Z</xsl:attribute>
                                    <xsl:call-template name="listUnicFdate2"/>
                                </xsl:element>
                            </xsl:element> &#160;-&#160; <xsl:element name="abbr">
                                <xsl:attribute name="class">dtstart</xsl:attribute>
                                <xsl:attribute name="title"><xsl:call-template name="listUnicTdate1"
                                    />T000000Z</xsl:attribute>
                                <xsl:element name="span">
                                    <xsl:attribute name="class">dtstart</xsl:attribute>
                                    <xsl:attribute name="title"><xsl:call-template
                                            name="listUnicTdate1"/>T000000Z</xsl:attribute>
                                    <xsl:call-template name="listUnicTdate2"/>
                                </xsl:element>
                            </xsl:element>
                        </h2>
                        <h3 class="inline summary">
                            <a href="{link}">
                                <xsl:value-of select="title" disable-output-escaping="yes"/>
                            </a>
                        </h3>
                        <br/>
                        <xsl:choose>
                            <xsl:when test="count(./content:encoded) > 0">
                                <xsl:value-of select="content:encoded" disable-output-escaping="yes"
                                />
                            </xsl:when>
                            <xsl:otherwise>
                                <xsl:value-of select="description" disable-output-escaping="yes"/>
                            </xsl:otherwise>
                        </xsl:choose>
                        <p class="box-f">
                            <a href="{link}" title="{title}"><xsl:value-of select="$LaesMereI"
                                />...</a>
                        </p>
                    </div>
                </div>
            </xsl:if>
        </xsl:for-each>
    </xsl:template>

    <xsl:template match="/atom:feed|/atom1:feed">
        <div class="box norm">
            <div class="box-i">
                <xsl:call-template name="mainTitle">
                    <xsl:with-param name="title">
                        <xsl:apply-templates select="atom:title|atom1:title"/>
                    </xsl:with-param>
                </xsl:call-template>
                <xsl:call-template name="listAtomItem"/>
                <xsl:call-template name="box-f">
                    <xsl:with-param name="title">
                        <xsl:apply-templates select="atom:title|atom1:title"/>
                    </xsl:with-param>
                    <xsl:with-param name="href">
                        <xsl:apply-templates select="atom:link|atom1:link"/>
                    </xsl:with-param>
                </xsl:call-template>
            </div>
        </div>
    </xsl:template>

    <xsl:template match="atom:link|atom1:link">
        <xsl:if test="@rel = 'alternate'">
            <xsl:value-of select="@href"/>
        </xsl:if>
    </xsl:template>

    <xsl:template match="atom:title|atom1:title">
        <xsl:value-of select="." disable-output-escaping="yes"/>
    </xsl:template>

    <xsl:template match="/rdf:RDF">
        <div class="box norm">
            <div class="box-i">
                <xsl:call-template name="mainTitle">
                    <xsl:with-param name="title" select="rss:channel/rss:title"/>
                </xsl:call-template>
                <xsl:call-template name="listRdfItem"/>
                <xsl:call-template name="box-f">
                    <xsl:with-param name="title" select="rss:channel/rss:title"/>
                    <xsl:with-param name="href" select="rss:channel/rss:link"/>
                </xsl:call-template>
            </div>
        </div>
    </xsl:template>

    <!--#####################      FUNCTION 	#####################-->
    <xsl:template name="listItem">
        <xsl:param name="GlobalDomain"/>
        <xsl:param name="title"/>
        <xsl:param name="href"/>
        <xsl:variable name="GlobalLink" select="/rss/channel/link"/>
        <xsl:variable name="GlobalTitle" select="$title"/>
        <xsl:variable name="showItem">
            <xsl:call-template name="selection">
                <xsl:with-param name="itemcount" select="count(item)"/>
            </xsl:call-template>
        </xsl:variable>
        <xsl:for-each select="item">
            <xsl:variable name="showStyle">
                <xsl:choose>
                    <xsl:when test="$Show = 'fArT' and position() = 1">All</xsl:when>
                    <xsl:when test="$Show = 'fArT' and position() > 1">Title</xsl:when>
                    <xsl:otherwise>
                        <xsl:value-of select="$Show"/>
                    </xsl:otherwise>
                </xsl:choose>
            </xsl:variable>
            <xsl:if
                test="($showItem = position()) or ($showItem = 0 and position() >= $UseFirst and $UseLast >= position())">
                <xsl:variable name="fullLink" select="link"/>
                <xsl:variable name="fullLinkTrunc">
                    <xsl:value-of select="$fullLink"/>
                </xsl:variable>
                <xsl:variable name="itemDate">
                    <xsl:choose>
                        <xsl:when test="dc:date">
                            <!-- Show date if available -->
                            <xsl:call-template name="listDcDate"/>
                        </xsl:when>
                        <xsl:when test="pubDate">
                            <!-- Show date if available -->
                            <xsl:call-template name="listPubDate"/>
                        </xsl:when>
                    </xsl:choose>
                </xsl:variable>
                <dl class="rss">
                    <dt class="rssTitle">
                        <xsl:call-template name="title-date">
                            <xsl:with-param name="title" select="title"/>
                            <xsl:with-param name="href" select="$fullLink"/>
                            <xsl:with-param name="target" select="''"/>
                            <xsl:with-param name="date" select="$itemDate"/>
                        </xsl:call-template>
                    </dt>
                    <xsl:variable name="description_woMSO1">
                        <xsl:call-template name="remove-html-comment">
                            <xsl:with-param name="text" select="description"/>
                        </xsl:call-template>
                    </xsl:variable>
                    <xsl:variable name="description_woMSO2">
                        <xsl:call-template name="string-replace-all">
                            <xsl:with-param name="text" select="$description_woMSO1"/>
                            <xsl:with-param name="replace" select="'&lt;p&gt;&amp;nbsp;&lt;/p&gt;'"/>
                            <xsl:with-param name="by" select="''"/>
                        </xsl:call-template>
                    </xsl:variable>
                    <xsl:variable name="description_woMSO3">
                        <xsl:value-of select="$description_woMSO2"/>
                    </xsl:variable>
                    <xsl:variable name="description_woMSO">
                        <xsl:call-template name="string-replace-all">
                            <xsl:with-param name="text" select="$description_woMSO3"/>
                            <xsl:with-param name="replace" select="'&lt;p&gt;&lt;/p&gt;'"/>
                            <xsl:with-param name="by" select="''"/>
                        </xsl:call-template>
                    </xsl:variable>
                    <xsl:choose>
                        
                        <xsl:when test="$showStyle = 'Short'">
                            <dd class="rssDescription">
                                <xsl:call-template name="truncate">
                                    <xsl:with-param name="text">
                                        <xsl:value-of select="$description_woMSO"/>
                                    </xsl:with-param>
                                </xsl:call-template>
                                <xsl:if test="$Date ='afterItem'">
                                    <span class="rssDate">
                                        <xsl:value-of select="$itemDate"/>
                                    </span>
                                </xsl:if>
                            </dd>
                        </xsl:when>
                        <xsl:when test="$showStyle = 'Item' or $showStyle = 'All'">
                            <xsl:variable name="fullDesc">
                                <xsl:choose>
                                    <xsl:when test="count(./content:encoded) > 0">
                                        <xsl:value-of select="content:encoded"/>
                                    </xsl:when>
                                    <xsl:otherwise>
                                        <xsl:value-of select="$description_woMSO"/>
                                    </xsl:otherwise>
                                </xsl:choose>
                            </xsl:variable>
                            <dd class="rssDescription">
                                <xsl:value-of select="$fullDesc" disable-output-escaping="yes"/>
                                <xsl:if test="$Date ='afterItem'">
                                    <span class="rssDate">
                                        <xsl:value-of select="$itemDate"/>
                                    </span>
                                </xsl:if>
                            </dd>
                        </xsl:when>
                    </xsl:choose>
                </dl>
                <xsl:if test="$UseItemLink = 'yes'">
                    <p class="box-f rssItemSource"><xsl:value-of select="$Kilde"/>:&#160;<a
                            href="{link}">
                            <xsl:value-of select="$GlobalTitle"
                                disable-output-escaping="yes"/>
                        </a>
                    </p>
                </xsl:if>
            </xsl:if>
        </xsl:for-each>
    </xsl:template>

    <!--#####################      FUNCTION 	#####################-->
    <xsl:template name="listItemEUB">
        <xsl:variable name="showItem">
            <xsl:call-template name="selection">
                <xsl:with-param name="itemcount" select="count(item)"/>
            </xsl:call-template>
        </xsl:variable>
        <xsl:for-each select="item">
            <xsl:if
                test="($showItem = position()) or ($showItem = 0 and position() >= $UseFirst and $UseLast >= position())">
                <xsl:variable name="start" select="unic:course/@fdate"/>
                <xsl:variable name="slut" select="unic:course/@tdate"/>
                <xsl:variable name="tilm" select="unic:course/@ddate"/>
                <xsl:variable name="status" select="unic:course/@status"/>
                <!-- remove after 22/9 2011 -->
                <xsl:variable name="pladser" select="unic:course/@pladser"/>
                <xsl:variable name="aflyst" select="unic:course/@aflyst"/>
                <xsl:variable name="aaben" select="unic:course/@aaben"/>
                <tr class="vevent">
                    <td class="summary">
                        <a href="{link}" title="Vis detaljer for kurset" class="url">
                            <xsl:value-of select="title"/>
                        </a>
                    </td>
                    <td align="right">
                        <span title="Kursets start- og evt. slutdato" class="nobr">
                            <abbr class="dtstart">
                                <span class="dtstart">
                                    <xsl:call-template name="listUnicDate2">
                                        <xsl:with-param name="date" select="$start"/>
                                    </xsl:call-template>
                                </span>
                            </abbr>
                            <xsl:if test="($start != $slut) and ($slut != '')">
                                <abbr class="dtend">
                                    <span class="dtend"> - <xsl:call-template name="listUnicDate2">
                                            <xsl:with-param name="date" select="$slut"/>
                                        </xsl:call-template>
                                    </span>
                                </abbr>
                            </xsl:if>
                        </span>
                    </td>
                    <td align="center">
                        <xsl:call-template name="listUnicDate2">
                            <xsl:with-param name="date" select="$tilm"/>
                        </xsl:call-template>
                        <xsl:choose>
                            <xsl:when test="($aflyst = 'ja') or ($status = 'Kurset er aflyst')">
                                <img src="http://css.emu.dk/images/eub/aflyst.gif"
                                    alt="Kurset er aflyst" title="Kurset er aflyst" class="dtreg"/>
                            </xsl:when>
                            <xsl:otherwise>
                                <xsl:choose>
                                    <xsl:when
                                        test="($pladser = 'nej') or ($status = 'Der er ingen ledige pladser')">
                                        <img src="http://css.emu.dk/images/eub/ingen-ledige.gif"
                                            alt="Der er ingen ledige pladser"
                                            title="Der er ingen ledige pladser" class="dtreg"/>
                                    </xsl:when>
                                    <xsl:when
                                        test="($pladser = 'ja') or ($status = 'Der er ledige pladser')">
                                        <img src="http://css.emu.dk/images/eub/ledig.gif"
                                            alt="Der er ledige pladser"
                                            title="Der er ledige pladser" class="dtreg"/>
                                    </xsl:when>
                                </xsl:choose>
                                <xsl:choose>
                                    <xsl:when test="$aaben = 'ja'">
                                        <img src="http://css.emu.dk/images/eub/aaben.gif"
                                            alt="Kurset er &#229;bent for tilmeldinger"
                                            title="Kurset er &#229;bent for tilmeldinger"
                                            class="dtreg"/>
                                    </xsl:when>
                                </xsl:choose>
                            </xsl:otherwise>
                        </xsl:choose>
                    </td>
                </tr>
            </xsl:if>
        </xsl:for-each>
    </xsl:template>

    <!--#####################      FUNCTION 	#####################-->
    <xsl:template name="string-replace-all-by-bullet">
        <xsl:param name="text"/>
        <xsl:param name="replace"/>
        <xsl:choose>
            <xsl:when test="contains($text, $replace)">
                <xsl:value-of select="substring-before($text,$replace)"/>
                <br/>&#160;<strong>&#8226;</strong>&#160; <xsl:call-template
                    name="string-replace-all-by-bullet">
                    <xsl:with-param name="text" select="substring-after($text,$replace)"/>
                    <xsl:with-param name="replace" select="$replace"/>
                </xsl:call-template>
            </xsl:when>
            <xsl:otherwise>
                <xsl:value-of select="$text"/>
            </xsl:otherwise>
        </xsl:choose>
    </xsl:template>

    <!--#####################      FUNCTION 	#####################-->
    <xsl:template name="string-add-br-before">
        <xsl:param name="text"/>
        <xsl:param name="replace"/>
        <xsl:choose>
            <xsl:when test="contains($text, $replace)">
                <xsl:value-of select="substring-before($text,$replace)"/>
                <br/>
                <xsl:value-of select="$replace"/>
                <xsl:call-template name="string-add-br-before">
                    <xsl:with-param name="text" select="substring-after($text,$replace)"/>
                    <xsl:with-param name="replace" select="$replace"/>
                </xsl:call-template>
            </xsl:when>
            <xsl:otherwise>
                <xsl:value-of select="$text"/>
            </xsl:otherwise>
        </xsl:choose>
    </xsl:template>


    <!--#####################      FUNCTION 	#####################-->
    <xsl:template name="listAtomItem">
        <xsl:variable name="showItem">
            <xsl:call-template name="selection">
                <xsl:with-param name="itemcount" select="count(atom:entry|atom1:entry)"/>
            </xsl:call-template>
        </xsl:variable>
        <xsl:for-each select="atom:entry|atom1:entry">
            <xsl:variable name="showStyle">
                <xsl:choose>
                    <xsl:when test="$Show = 'fArT' and position() = 1">All</xsl:when>
                    <xsl:when test="$Show = 'fArT' and position() > 1">Title</xsl:when>
                    <xsl:otherwise>
                        <xsl:value-of select="$Show"/>
                    </xsl:otherwise>
                </xsl:choose>
            </xsl:variable>
            <xsl:if
                test="($showItem = position()) or ($showItem = 0 and position() >= $UseFirst and $UseLast >= position())">
                <xsl:variable name="itemDate">
                    <xsl:choose>
                        <xsl:when test="atom:modified">
                            <!-- Show date if available -->
                            <xsl:call-template name="listAtomDate"/>
                        </xsl:when>
                    </xsl:choose>
                </xsl:variable>
                <xsl:variable name="itemHref">
                    <xsl:apply-templates
                        select="atom:link[@rel = 'alternate']|atom1:link[@rel = 'alternate']"/>
                </xsl:variable>
                <dl class="rss">
                    <dt class="rssTitle">
                        <xsl:call-template name="title-date">
                            <xsl:with-param name="title" select="atom:title|atom1:title"/>
                            <xsl:with-param name="href" select="$itemHref"/>
                            <xsl:with-param name="target" select="''"/>
                            <xsl:with-param name="date" select="$itemDate"/>
                        </xsl:call-template>
                    </dt>
                    <xsl:variable name="fullDesc">
                        <xsl:choose>
                            <xsl:when test="count(atom:summary) > 0">
                                <xsl:value-of select="atom:summary"/>
                            </xsl:when>
                            <xsl:when test="count(atom1:summary) > 0">
                                <xsl:value-of select="atom1:summary"/>
                            </xsl:when>
                            <xsl:otherwise>
                                <xsl:value-of select="atom:content|atom1:content"/>
                            </xsl:otherwise>
                        </xsl:choose>
                    </xsl:variable>
                    <xsl:choose>
                        <xsl:when test="$showStyle = 'Short'">
                            <dd class="rssDescription">
                                <xsl:call-template name="truncate">
                                    <xsl:with-param name="text">
                                        <xsl:value-of select="$fullDesc"/>
                                    </xsl:with-param>
                                </xsl:call-template>
                                <xsl:if test="$Date ='afterItem'">
                                    <span class="rssDate">
                                        <xsl:value-of select="$itemDate"/>
                                    </span>
                                </xsl:if>
                            </dd>
                        </xsl:when>
                        <xsl:when test="$showStyle = 'Item' or $showStyle = 'All'">
                            <dd class="rssDescription">
                                <xsl:value-of select="$fullDesc" disable-output-escaping="yes"/>
                                <xsl:if test="$Date ='afterItem'">
                                    <span class="rssDate">
                                        <xsl:value-of select="$itemDate"/>
                                    </span>
                                </xsl:if>
                            </dd>
                        </xsl:when>
                    </xsl:choose>
                </dl>
                <xsl:if test="$UseItemLink = 'yes'">
                    <p class="box-f rssItemSource">
                        <xsl:value-of select="$Kilde"/>:&#160;<xsl:element name="a">
                            <xsl:attribute name="href">
                                <xsl:value-of select="$itemHref"/>
                            </xsl:attribute>
                            <xsl:apply-templates select="atom:title|atom1:title"/>
                        </xsl:element>
                    </p>
                </xsl:if>
            </xsl:if>
        </xsl:for-each>
    </xsl:template>

    <!--#####################      FUNCTION 	#####################-->
    <xsl:template name="listRdfItem">
        <xsl:variable name="showItem">
            <xsl:call-template name="selection">
                <xsl:with-param name="itemcount" select="count(rss:item)"/>
            </xsl:call-template>
        </xsl:variable>
        <xsl:for-each select="rss:item">
            <xsl:variable name="showStyle">
                <xsl:choose>
                    <xsl:when test="$Show = 'fArT' and position() = 1">All</xsl:when>
                    <xsl:when test="$Show = 'fArT' and position() > 1">Title</xsl:when>
                    <xsl:otherwise>
                        <xsl:value-of select="$Show"/>
                    </xsl:otherwise>
                </xsl:choose>
            </xsl:variable>
            <xsl:if
                test="($showItem = position()) or ($showItem = 0 and position() >= $UseFirst and $UseLast >= position())">
                <xsl:variable name="itemDate">
                    <xsl:choose>
                        <xsl:when test="dc:date">
                            <xsl:call-template name="listDcDate"/>
                        </xsl:when>
                    </xsl:choose>
                </xsl:variable>
                <dl class="rss">
                    <dt class="rssTitle">
                        <xsl:call-template name="title-date">
                            <xsl:with-param name="title" select="rss:title"/>
                            <xsl:with-param name="href" select="link"/>
                            <xsl:with-param name="target" select="''"/>
                            <xsl:with-param name="date" select="$itemDate"/>
                        </xsl:call-template>
                    </dt>
                    <xsl:variable name="fullDesc" select="rss:description"/>
                    <xsl:choose>
                        <xsl:when test="$showStyle = 'Short'">
                            <dd class="rssDescription">
                                <xsl:call-template name="truncate">
                                    <xsl:with-param name="text">
                                        <xsl:value-of select="$fullDesc"/>
                                    </xsl:with-param>
                                </xsl:call-template>
                                <xsl:if test="$Date ='afterItem'">
                                    <span class="rssDate">
                                        <xsl:value-of select="$itemDate"/>
                                    </span>
                                </xsl:if>
                            </dd>
                        </xsl:when>
                        <xsl:when test="$showStyle = 'Item' or $showStyle = 'All'">
                            <dd class="rssDescription">
                                <xsl:value-of select="$fullDesc" disable-output-escaping="yes"/>
                                <xsl:if test="$Date ='afterItem'">
                                    <span class="rssDate">
                                        <xsl:value-of select="$itemDate"/>
                                    </span>
                                </xsl:if>
                            </dd>
                        </xsl:when>
                    </xsl:choose>
                </dl>
                <xsl:if test="$UseItemLink = 'yes'">
                    <p class="box-f rssItemSource"><xsl:value-of select="$Kilde"/>:&#160;<a
                            href="{rss:link}">
                            <xsl:value-of select="rss:title" disable-output-escaping="yes"/>
                        </a></p>
                </xsl:if>
            </xsl:if>
        </xsl:for-each>
    </xsl:template>
    
    <!--#####################      FUNCTION 	#####################-->
    <xsl:template name="mainTitle">
        <xsl:param name="title"/>
        <xsl:variable name="cleanTitle">
            <xsl:choose>
                <xsl:when test="contains($title, ':')">
                    <xsl:value-of select="substring-before($title, ':')"/>
                </xsl:when>
                <xsl:otherwise>
                    <xsl:value-of select="$title"/>
                </xsl:otherwise>
            </xsl:choose>
        </xsl:variable>
        <h2 class="{$h2Class}">
            <xsl:value-of select="$cleanTitle" disable-output-escaping="yes"/>
        </h2>
    </xsl:template>

    <!--#####################      FUNCTION 	#####################-->
    <xsl:template name="skodaPay">
        <xsl:choose>
            <xsl:when test="$Source = 'ShowP'"> (<a
                    href="http://www.emu.dk/zz_info/generelt/linkbeskrivelse/skoda.html"
                    rel="/zz_cgi/item2html.cgi?file=/zz_info/generelt/linkbeskrivelse/skoda.htmf"
                    class="tooltip jqClueTip" title="L&#230;s mere om krav til brug">SkoDa
                    kr&#230;ver login&#8230;</a>) </xsl:when>
            <xsl:otherwise/>
        </xsl:choose>
    </xsl:template>

    <!--#####################      FUNCTION 	#####################-->
    <xsl:template name="selection">
        <xsl:param name="itemcount"/>
        <xsl:choose>
            <xsl:when test="$Random = 1">
                <!-- random -->
                <xsl:value-of select="1 + $RandomVal mod $itemcount"/>
            </xsl:when>
            <xsl:when test="$Random = 2">0</xsl:when>
            <!-- all -->
            <xsl:otherwise>
                <xsl:value-of select="$Single"/>
            </xsl:otherwise>
        </xsl:choose>
    </xsl:template>

    <!--#####################      FUNCTION 	#####################-->
    <xsl:template name="title-date">
        <xsl:param name="title"/>
        <xsl:param name="href"/>
        <xsl:param name="target"/>
        <xsl:param name="date"/>

        <xsl:variable name="targetAttr">
            <xsl:choose>
                <xsl:when test="$target = ''">_self</xsl:when>
                <xsl:otherwise>
                    <xsl:value-of select="$target"/>
                </xsl:otherwise>
            </xsl:choose>
        </xsl:variable>
        <xsl:if test="$Date ='beforeTitle'">
            <span class="rssDate">
                <xsl:value-of select="$date"/>
            </span>
        </xsl:if>
        <xsl:choose>
            <xsl:when test="$Show = 'All'">
                <a href="{$href}" target="{$targetAttr}">
                    <xsl:value-of select="$title" disable-output-escaping="yes"/>
                </a>
            </xsl:when>
            <xsl:when test="$Show = 'Title'">
                <a href="{$href}" target="{$targetAttr}">
                    <xsl:value-of select="$title" disable-output-escaping="yes"/>
                </a>
            </xsl:when>
            <xsl:otherwise>
                <a href="{$href}" target="{$targetAttr}">
                    <xsl:value-of select="$title" disable-output-escaping="yes"/>
                </a>
            </xsl:otherwise>
        </xsl:choose>
        <xsl:if test="$Date ='afterTitle'">
            <span class="rssDate">
                <xsl:value-of select="$date"/>
            </span>
        </xsl:if>
    </xsl:template>

    <!--#####################      FUNCTION 	#####################-->
    <xsl:template name="box-f">
        <xsl:param name="title"/>
        <xsl:param name="href"/>
        <xsl:variable name="cleanTitle">
            <xsl:choose>
                <xsl:when test="contains($title, ':')">
                    <xsl:value-of select="substring-before($title, ':')"/>
                </xsl:when>
                <xsl:otherwise>
                    <xsl:value-of select="$title"/>
                </xsl:otherwise>
            </xsl:choose>
        </xsl:variable>
        <xsl:if test="$UseItemLink = 'no'">
            <p class="box-f {$SourceClass}"><xsl:value-of select="$Kilde"/>: <a href="{$href}">
                <xsl:value-of select="$cleanTitle" disable-output-escaping="yes"/>
                </a>
            </p>
        </xsl:if>
    </xsl:template>

    <!--#####################      FUNCTION 	#####################-->
    <xsl:template name="remove-html">
        <xsl:param name="text"/>
        <xsl:choose>
            <xsl:when test="contains($text, '&lt;')">
                <xsl:value-of select="substring-before($text, '&lt;')"/>
                <xsl:call-template name="remove-html">
                    <xsl:with-param name="text" select="substring-after($text, '&gt;')"/>
                </xsl:call-template>
            </xsl:when>
            <xsl:otherwise>
                <xsl:value-of select="$text"/>
            </xsl:otherwise>
        </xsl:choose>
    </xsl:template>

    <!--#####################      FUNCTION 	#####################-->
    <xsl:template name="remove-html-dltag">
        <xsl:param name="text"/>
        <xsl:choose>
            <xsl:when test="contains($text, '&lt;dl')">
                <xsl:value-of select="substring-before($text, '&lt;dl')"/>
                <xsl:call-template name="remove-html-dltag">
                    <xsl:with-param name="text" select="substring-after($text, 'dl&gt;')"/>
                </xsl:call-template>
            </xsl:when>
            <xsl:otherwise>
                <xsl:value-of select="$text"/>
            </xsl:otherwise>
        </xsl:choose>
    </xsl:template>

    <!--#####################      FUNCTION 	#####################-->
    <xsl:template name="remove-html-comment">
        <xsl:param name="text"/>
        <xsl:choose>
            <xsl:when test="contains($text, '&lt;!--')">
                <xsl:value-of select="substring-before($text, '&lt;!--')"/>
                <xsl:call-template name="remove-html-comment">
                    <xsl:with-param name="text" select="substring-after($text, '--&gt;')"/>
                </xsl:call-template>
            </xsl:when>
            <xsl:otherwise>
                <xsl:value-of select="$text"/>
            </xsl:otherwise>
        </xsl:choose>
    </xsl:template>

    <!--#####################      FUNCTION 	#####################-->
    <xsl:template name="string-replace-all">
        <xsl:param name="text"/>
        <xsl:param name="replace"/>
        <xsl:param name="by"/>
        <xsl:choose>
            <xsl:when test="contains($text, $replace)">
                <xsl:value-of select="substring-before($text,$replace)"/>
                <xsl:value-of select="$by"/>
                <xsl:call-template name="string-replace-all">
                    <xsl:with-param name="text" select="substring-after($text,$replace)"/>
                    <xsl:with-param name="replace" select="$replace"/>
                    <xsl:with-param name="by" select="$by"/>
                </xsl:call-template>
            </xsl:when>
            <xsl:otherwise>
                <xsl:value-of select="$text"/>
            </xsl:otherwise>
        </xsl:choose>
    </xsl:template>

    <!--#####################      FUNCTION 	#####################-->
    <xsl:template name="truncate">
        <xsl:param name="text"/>
        <xsl:variable name="trimText" select="normalize-space($text)"/>
        <xsl:variable name="fullDescTrunc" select="substring($trimText, 1, 250)"/>
        <xsl:variable name="fullDescATrunc" select="substring($trimText, 251, 400)"/>
        <xsl:variable name="fullDescATruncSpace">
            <xsl:choose>
                <xsl:when test="contains($fullDescATrunc, '&gt;')">
                    <xsl:value-of select="substring-before($fullDescATrunc, '&gt;')"/>&gt; </xsl:when>
                <xsl:otherwise>
                    <xsl:value-of select="substring-before($fullDescATrunc, ' ')"/>
                </xsl:otherwise>
            </xsl:choose>
        </xsl:variable>
        <xsl:variable name="fullDescATruncHtml">
            <xsl:value-of select="$fullDescTrunc"/>
            <xsl:value-of select="$fullDescATruncSpace"/>
        </xsl:variable>
        <xsl:choose>
            <xsl:when test="string-length($fullDescATruncHtml) > 250 ">
                <xsl:value-of select="$fullDescATruncHtml" disable-output-escaping="yes"/>&#8230; </xsl:when>
            <xsl:otherwise>
                <xsl:value-of select="$fullDescATruncHtml" disable-output-escaping="yes"/>
            </xsl:otherwise>
        </xsl:choose>

    </xsl:template>

    <!--#####################      FUNCTION 	#####################-->
    <!--## <pubDate>Wed Sep 28 12:14:36 +0000 2011</pubDate> #####-->
    <!--## <pubDate>Fri, 29 Sep 2006 14:16:42 +0200</pubDate> #####-->
    <!--## <pubDate>19 Nov 2008 09:20:00 +0100</pubDate> #####-->
    <xsl:template name="listPubDate">
        <xsl:choose>
            <xsl:when test="substring(pubDate, 4, 1) = ' '">
                <xsl:variable name="after1" select="substring-after(pubDate, ' ')"/>
                <xsl:variable name="month1" select="substring-before($after1, ' ')"/>
                <xsl:variable name="after2" select="substring-after($after1, ' ')"/>
                <xsl:variable name="day" select="substring-before($after2, ' ')"/>
                <xsl:variable name="after3" select="substring-after($after2, '+')"/>
                <xsl:variable name="year" select="substring-after($after3, ' ')"/>
                <xsl:variable name="month">
                    <xsl:choose>
                        <xsl:when test="$month1= 'Jan'">01</xsl:when>
                        <xsl:when test="$month1= 'Feb'">02</xsl:when>
                        <xsl:when test="$month1= 'Mar'">03</xsl:when>
                        <xsl:when test="$month1= 'Apr'">04</xsl:when>
                        <xsl:when test="$month1= 'May' or $month1= 'Maj'">05</xsl:when>
                        <xsl:when test="$month1= 'Jun'">06</xsl:when>
                        <xsl:when test="$month1= 'Jul'">07</xsl:when>
                        <xsl:when test="$month1= 'Aug'">08</xsl:when>
                        <xsl:when test="$month1= 'Sep'">09</xsl:when>
                        <xsl:when test="$month1= 'Oct' or $month1= 'Okt'">10</xsl:when>
                        <xsl:when test="$month1= 'Nov'">11</xsl:when>
                        <xsl:when test="$month1= 'Dec'">12</xsl:when>
                        <xsl:otherwise><xsl:value-of select="$month1"/></xsl:otherwise>
                    </xsl:choose>
                </xsl:variable> (<xsl:value-of select="$day"/><xsl:text>/</xsl:text><xsl:value-of
                    select="$month"/>&#160;<xsl:value-of select="$year"/>) </xsl:when>
            <xsl:otherwise>
                <xsl:variable name="after1">
                    <xsl:choose>
                        <xsl:when test="contains(pubDate, ',')">
                            <xsl:value-of select="substring-after(pubDate, ', ')"/>
                        </xsl:when>
                        <xsl:otherwise>
                            <xsl:value-of select="pubDate"/>
                        </xsl:otherwise>
                    </xsl:choose>
                </xsl:variable>
                <xsl:variable name="day" select="substring-before($after1, ' ')"/>
                <xsl:variable name="after2" select="substring-after($after1, ' ')"/>
                <xsl:variable name="month1" select="substring-before($after2, ' ')"/>
                <xsl:variable name="after3" select="substring-after($after2, ' ')"/>
                <xsl:variable name="year" select="substring-before($after3, ' ')"/>
                <xsl:variable name="month">
                    <xsl:choose>
                        <xsl:when test="$month1= 'Jan'">01</xsl:when>
                        <xsl:when test="$month1= 'Feb'">02</xsl:when>
                        <xsl:when test="$month1= 'Mar'">03</xsl:when>
                        <xsl:when test="$month1= 'Apr'">04</xsl:when>
                        <xsl:when test="$month1= 'May' or $month1= 'Maj'">05</xsl:when>
                        <xsl:when test="$month1= 'Jun'">06</xsl:when>
                        <xsl:when test="$month1= 'Jul'">07</xsl:when>
                        <xsl:when test="$month1= 'Aug'">08</xsl:when>
                        <xsl:when test="$month1= 'Sep'">09</xsl:when>
                        <xsl:when test="$month1= 'Oct' or $month1= 'Okt'">10</xsl:when>
                        <xsl:when test="$month1= 'Nov'">11</xsl:when>
                        <xsl:when test="$month1= 'Dec'">12</xsl:when>
                        <xsl:otherwise><xsl:value-of select="$month1"/></xsl:otherwise>
                    </xsl:choose>
                </xsl:variable> (<xsl:value-of select="$day"/><xsl:text>/</xsl:text><xsl:value-of
                    select="$month"/>&#160;<xsl:value-of select="$year"/>) </xsl:otherwise>
        </xsl:choose>
    </xsl:template>

    <!--#####################      FUNCTION 	#####################-->
    <!--## <pubDate>Fri, 29 Sep 2006 14:16:42 +0200</pubDate> #####-->
    <xsl:template name="listDcDate">
        <xsl:variable name="year" select="substring-before(dc:date, '-')"/>
        <xsl:variable name="after1" select="substring-after(dc:date, '-')"/>
        <xsl:variable name="month" select="substring-before($after1, '-')"/>
        <xsl:variable name="after2" select="substring-after($after1, '-')"/>
        <xsl:variable name="day" select="substring($after2, 1, 2)"/> (<xsl:value-of select="$day"
            /><xsl:text>/</xsl:text><xsl:value-of select="$month"/>&#160;<xsl:value-of
            select="$year"/>) </xsl:template>

    <!--#####################      FUNCTION 	#####################-->
    <!--## <modified>2006-10-04T17:06:42Z</modified>          #####-->
    <xsl:template name="listAtomDate">
        <xsl:variable name="year" select="substring-before(atom:modified, '-')"/>
        <xsl:variable name="after1" select="substring-after(atom:modified, '-')"/>
        <xsl:variable name="month" select="substring-before($after1, '-')"/>
        <xsl:variable name="after2" select="substring-after($after1, '-')"/>
        <xsl:variable name="day" select="substring($after2, 1, 2)"/> (<xsl:value-of select="$day"
            /><xsl:text>/</xsl:text><xsl:value-of select="$month"/>&#160;<xsl:value-of
            select="$year"/>) </xsl:template>

    <!--#####################      FUNCTION 	#####################-->
    <xsl:template name="listUnicDate2">
        <xsl:param name="date">1900-01-01</xsl:param>
        <xsl:if test="$date != ''">
            <xsl:variable name="year" select="substring($date, 1, 4)"/>
            <xsl:variable name="month" select="substring($date, 5, 2)"/>
            <xsl:variable name="day" select="substring($date, 7, 2)"/>
            <xsl:value-of select="$day"/><xsl:text>/</xsl:text><xsl:value-of select="$month"
                />&#160;<xsl:value-of select="$year"/>
        </xsl:if>
    </xsl:template>

    <!--#####################      FUNCTION 	#####################-->
    <xsl:template name="listUnicFdate1">
        <xsl:variable name="fdate1">
            <xsl:for-each select="unic:news">
                <xsl:value-of select="@fdate"/>
            </xsl:for-each>
        </xsl:variable>
        <xsl:value-of select="$fdate1"/>
    </xsl:template>

    <!--#####################      FUNCTION 	#####################-->
    <xsl:template name="listUnicFdate2">
        <xsl:variable name="fdate1">
            <xsl:for-each select="unic:news">
                <xsl:value-of select="@fdate"/>
            </xsl:for-each>
        </xsl:variable>
        <xsl:variable name="year" select="substring($fdate1, 1, 4)"/>
        <xsl:variable name="month" select="substring($fdate1, 5, 2)"/>
        <xsl:variable name="day" select="substring($fdate1, 7, 2)"/>
        <xsl:value-of select="$day"/><xsl:text>/</xsl:text><xsl:value-of select="$month"
            />&#160;<xsl:value-of select="$year"/>
    </xsl:template>
    <!--#####################      FUNCTION 	#####################-->
    <xsl:template name="listUnicTdate1">
        <xsl:variable name="tdate1">
            <xsl:for-each select="unic:news">
                <xsl:value-of select="@tdate"/>
            </xsl:for-each>
        </xsl:variable>
        <xsl:value-of select="$tdate1"/>
    </xsl:template>

    <!--#####################      FUNCTION 	#####################-->
    <xsl:template name="listUnicTdate2">
        <xsl:variable name="tdate1">
            <xsl:for-each select="unic:news">
                <xsl:value-of select="@tdate"/>
            </xsl:for-each>
        </xsl:variable>
        <xsl:variable name="year" select="substring($tdate1, 1, 4)"/>
        <xsl:variable name="month" select="substring($tdate1, 5, 2)"/>
        <xsl:variable name="day" select="substring($tdate1, 7, 2)"/>
        <xsl:value-of select="$day"/><xsl:text>/</xsl:text><xsl:value-of select="$month"
            />&#160;<xsl:value-of select="$year"/>
    </xsl:template>

</xsl:stylesheet>

