<?xml version="1.0"?>

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml" version="1.0">
	<xsl:output method="xml" indent="yes" encoding="UTF-8" doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"/>
	<xsl:template match="/">
		<html>
			<head>
				<title>Kinkrforum - <xsl:value-of select="/topic/@title"/></title>
				<link rel="stylesheet" type="text/css" href="kinkrforum.css"/>
			</head>
			<body>
				<xsl:for-each select="/topic/replies/*">
					<div class="reply">
						<xsl:variable name="userid" select="./@userid"/>
						<xsl:variable name="user" select="/topic/users/user[@id=$userid]"/>
						<div class="header">
							<div class="left">
								<a href="/user/{$userid}">
									<xsl:value-of select="$user"/>
								</a>
								<xsl:if test="count($user/@type) &gt; 0 and string-length($user/@type) &gt; 0">
          (<xsl:value-of select="$user/@type"/>)
        </xsl:if>
								<br/>
								<div class="subtitle">
									<xsl:value-of select="$user/@subtitle"/>
								</div>
							</div>
							<div class="right">
								<a class="quote" href="postreply/{@id}">
									<span>Quote</span>
								</a>
								<a class="edit" href="edit/{@id}">
									<span>Edit</span>
								</a>
								<a class="profiel" href="http://fok.forum.nl/user/profile/{@userid}">
									<span>Profiel van <xsl:value-of select="$user"/></span>
								</a>
								<a class="fotoboek" href="http://fotoboek.fok.nl/{$user}">
									<span>Profiel van <xsl:value-of select="$user"/></span>
								</a>
								<a class="homepage" href="">
									<span>Homepage van <xsl:value-of select="$user"/></span>
								</a>
							</div>
						</div>
						<div class="userplane">
							<xsl:if test="string-length($user/@usericon) &gt; 0">
								<img class="usericon" src="http://i.fok.nl/usericons/{$user/@id}/{$user/@usericon}" alt="Usericon van $user"/>
							</xsl:if>
							<img src="http://i.fokzine.net/templates/new/i/p/{@pi}.gif" class="pi"/>
						</div>
						<div class="body">
							<xsl:apply-templates/>
						</div>
					</div>
				</xsl:for-each>
			</body>
		</html>
	</xsl:template>
	<xsl:template match="@*|node()" priority="-1">
		<xsl:copy>
			<xsl:copy-of select="namespace::*"/>
			<xsl:apply-templates/>
		</xsl:copy>
	</xsl:template>
	<xsl:template match="img">
		<!-- check if there's an image -->
		<xsl:if test="@src">
			<xsl:copy-of select="namespace::*"/>
			<xsl:copy>
				<xsl:if test="not(@alt)">
					<xsl:attribute name="alt">&#160;</xsl:attribute>
				</xsl:if>
				<xsl:apply-templates/>
			</xsl:copy>
		</xsl:if>
	</xsl:template>
</xsl:stylesheet>
