<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:lb="http://www-mmt.inf.tu-dresden.de/Lehre/Wintersemester_10_11/Vo_WME/Uebung/material/Lorbeerblatt"
xmlns:h="http://www.w3.org/1999/xhtml">

<xsl:output method="xml" indent="yes" encoding="UTF-8" omit-xml-declaration="no" />


<xsl:template match="*"/>

	<!-- Grundgerüst -->
	<xsl:template match="/">
		<menu>
			<xsl:for-each select="h:html/h:body//h:div[@id='spalterechtsnebenmenue']/h:table[@class='speiseplan']">
				<mensa>

					<!-- Attribute -->
					<xsl:attribute name="name">
              			<xsl:value-of select="h:thead/h:tr/h:th[@class='text']" />
            		</xsl:attribute>

					<!-- erforderliche Metadaten -->
					<xsl:for-each select="h:tbody">
						<xsl:for-each select="h:tr[@class='darkrow']|h:tr[@class='lightrow']|h:tr[@class='last']">
							<xsl:apply-templates select="."/>
						</xsl:for-each>
					</xsl:for-each>
					

				</mensa>
			</xsl:for-each>
		</menu>
	</xsl:template>

	<!-- Element "dish" -->
	<xsl:template match="//h:tr[@class='darkrow']|//h:tbody/h:tr[@class='lightrow']|//h:tbody/h:tr[@class='last']">
		<dish>
			<title>
				<xsl:value-of select="h:td[@class='text']" />
			</title>
			<webUrl>
				<xsl:value-of select="h:td[@class='text']/h:a/@href" />
			</webUrl>
			<priceStudent>
				<xsl:value-of select="substring-before(normalize-space(h:td[@class='preise']), '/')"/>
			</priceStudent>
			<priceEmployee>
				<xsl:value-of select="substring-after(normalize-space(h:td[@class='preise']), '/')"/>
			</priceEmployee>
			<xsl:apply-templates select="h:td[@class='stoffe']/h:a/h:img"/>	
		</dish>
	</xsl:template>
		
	<xsl:template match="//h:td[@class='stoffe']/h:a/h:img">
		<ingredient>
			<xsl:value-of select="@alt"/>
		</ingredient>
	</xsl:template>
 
</xsl:stylesheet>