View stylesheet

XML schemas http://dd.sdr.edw.ro/GetSchema?id=TBL7213
Output type HTML
Description HTML table
XSL file sdr-lakes-lakeshazsubst-html.xsl (Last modified: 13 Apr 2011 16:09 )
<?xml version="1.0" encoding="UTF-8"?>

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:dd715="http://dd.sdr.edw.ro/namespace.jsp?ns_id=715" xmlns:dd717="http://dd.sdr.edw.ro/namespace.jsp?ns_id=717">
	<xsl:output method="html"/>
	<xsl:template match="/">
		<html>
			<head>
				<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
				<title>HazSubstLakes_Agg</title>
			</head>
			<body>
				<h1>HazSubstLakes_Agg</h1>
				<table border="1">
					<xsl:apply-templates select="dd715:HazSubstLakes_Agg/dd715:Row"/>
				</table>
			</body>
		</html>
	</xsl:template>
	<xsl:template match="dd715:HazSubstLakes_Agg/dd715:Row">
		<xsl:if test="position()=1">
			<xsl:call-template name="header"/>
		</xsl:if>
		<tr>
			<xsl:for-each select="*">
				<xsl:if test="count(preceding-sibling::*[local-name() = local-name(current())])=0">
					<td>
						<xsl:if test=".=''">   </xsl:if>
						<xsl:call-template name="getValue"/>
					</td>
				</xsl:if>
			</xsl:for-each>
		</tr>
	</xsl:template>
	<xsl:template name="header">
		<tr>
			<xsl:for-each select="*">
				<xsl:if test="count(preceding-sibling::*[local-name() = local-name(current())])=0">
					<th bgcolor="#87cefa">
						<xsl:value-of select="local-name()"/>
					</th>
				</xsl:if>
			</xsl:for-each>
		</tr>
	</xsl:template>
	<xsl:template name="getValue">
		<xsl:choose>
			<xsl:when test="count(following-sibling::*[local-name() = local-name(current())])=0">
				<xsl:value-of select="."/>
			</xsl:when>
			<xsl:otherwise>
				<xsl:call-template name="joinMultiValue">
					<xsl:with-param name="valueList" select="parent::*/child::*[local-name() = local-name(current())]"/>
				</xsl:call-template>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>
	<xsl:template name="joinMultiValue">
		<xsl:param name="valueList" select="''"/>
		<xsl:variable name="separator">
			<xsl:call-template name="getSeparator">
				<xsl:with-param name="element" select="local-name()"/>
			</xsl:call-template>
		</xsl:variable>
		<xsl:for-each select="$valueList">
			<xsl:choose>
				<xsl:when test="position() = 1">
					<xsl:value-of select="."/>
				</xsl:when>
				<xsl:otherwise>
					<xsl:value-of select="concat($separator, .)"/>
				</xsl:otherwise>
			</xsl:choose>
		</xsl:for-each>
	</xsl:template>
	<xsl:template name="getSeparator">
		<xsl:param name="element" select="''"/>
		<xsl:value-of select="','"/>
	</xsl:template>
</xsl:stylesheet>