<?xml version="1.0"?>
<xsl:stylesheet
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:dc="http://purl.org/dc/elements/1.1/"
  xmlns:foaf="http://xmlns.com/foaf/0.1/"
  xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
  xmlns="http://crschmidt.net/ns/xtech#"
  xml:base="http://crschmidt.net/semweb/xtech/schedule"
  exclude-result-prefixes=""
  version="1.0"
  >

<xsl:output indent="yes" encoding="utf-8" method="xml"
  />

<xsl:template match="break"><Break>
		<dc:title><xsl:value-of select="@title" /></dc:title>
	</Break></xsl:template>

<xsl:template match="talk">
    <hasTalk><Talk>
        <xsl:if test="@id != ''">
		<xsl:attribute name="rdf:ID">a<xsl:value-of select="@id" /></xsl:attribute>
        </xsl:if>
		<dc:title>
			<xsl:value-of select="@title" />
		</dc:title>
        <title><xsl:value-of select="concat('Paper #',
				concat(@id, concat(', track ',
				@track)))" />
		</title>
        <track><xsl:value-of select="@track" /></track>
        <speaker>
            <foaf:Person>
			<xsl:attribute name="foaf:surname"><xsl:value-of select="@surname" /></xsl:attribute>
			<xsl:attribute name="foaf:firstName"><xsl:value-of select="@firstname" /></xsl:attribute>
			<xsl:attribute name="foaf:name"><xsl:value-of select="concat(@firstname,
				concat(' ', @surname))" />
            </xsl:attribute>
			<xsl:attribute name="foaf:mbox_sha1sum"><xsl:value-of select="@mbox_sha1sum" />
            </xsl:attribute>
            </foaf:Person>

		</speaker>
        <time><xsl:value-of select="../../@time" /></time>
        <audience><xsl:value-of select="@audience" /></audience>
        <room><xsl:value-of select="../@name" /></room>
        <xsl:if test="@chair-email != ''">
            <chair>
                    <xsl:attribute name="rdf:resource">
                        <xsl:value-of select="concat('mailto:', @chair-email)" />
                    </xsl:attribute>
                    <xsl:attribute name="foaf:name">
                    <xsl:value-of select="@chair-name" />
                    </xsl:attribute>
            </chair>
        </xsl:if>
	</Talk></hasTalk>
</xsl:template>

<xsl:template match="sessions">
				<xsl:for-each select="room">
					<xsl:apply-templates select="talk[1]" />
				</xsl:for-each>
				<xsl:for-each select="room">
					<xsl:apply-templates select="talk[2]" />
				</xsl:for-each>
</xsl:template>

<xsl:template match="day">
	<day><Day>
		<dc:title><xsl:value-of select="@title"/></dc:title>
		<xsl:apply-templates />
	</Day></day>
</xsl:template>

<xsl:template match="/timetable">
<rdf:RDF xml:base="http://crschmidt.net/semweb/xtech/schedule">
<Timetable rdf:ID="timetable">
	<xsl:apply-templates />
</Timetable>
</rdf:RDF>
</xsl:template>

</xsl:stylesheet>
