<?xml version="1.0" encoding="UTF-8"?>
<!--
Demonstration.  Stylesheet to display employment contact information.
-->

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
 
<xsl:output method="html" encoding="UTF-8" indent="yes"/> 

<!-- - - - - - - - - - - - - - - - - -->
<xsl:template match="/">
	<html>
		<head>
			<xsl:call-template name="header"/>
		</head>
		<body>
			<xsl:apply-templates select="EmploymentSummaryDoc"/>
		</body>
	</html>
</xsl:template>
<!-- - - - - - - - - - - - - - - - - -->
<xsl:template match="EmploymentSummaryDoc">
	<xsl:choose>
		<xsl:when test="@xsi:nil='true'">
			<h2>No information on file for this person.</h2>
		</xsl:when>
		<xsl:otherwise>
			<h2>Employment Summary</h2>
			<xsl:apply-templates select="/EmploymentSummaryDoc/PersonEmployment"/>
		</xsl:otherwise>
	</xsl:choose>
</xsl:template>

<!-- - - - - - - - - - - - - - - - - -->
<xsl:template match="PersonEmployment" >
	<p>
	 	<xsl:call-template name="formatPersonName">
			<xsl:with-param name="fName" select="Person/FirstName"/>
			<xsl:with-param name="lName" select="Person/LastName" />
		</xsl:call-template>
		<xsl:text>, TANF case number: </xsl:text><u>
		<xsl:value-of select="@tanfCaseID"/></u>
	</p>
	<xsl:for-each select="Employment">
		<hr/>
		<xsl:choose>
			<xsl:when test="@xsi:nil='true'">
			<h3>Not currently employed.</h3>
		</xsl:when>
		<xsl:otherwise>
		<xsl:apply-templates select="." />
		</xsl:otherwise>
	</xsl:choose>
</xsl:for-each>
</xsl:template>
<!-- - - - - - - - - - - - - - - - - -->		
<xsl:template match="Employment">
	<p><span class="redbold"><xsl:value-of select="CompanyName"/> (Hired: <xsl:value-of select="HireDate"/>)</span>
	<br />
		<xsl:text>Contact: </xsl:text>
		<xsl:call-template name="formatPersonName">
			<xsl:with-param name="fName" select="EmployerContact/FirstName"/>
			<xsl:with-param name="lName" select="EmployerContact/LastName" />
		</xsl:call-template>
		<br /><xsl:value-of select="EmployerContact/@title"/>
		<br /><xsl:value-of select="EmployerContact/TelephoneNumber"/>
	</p>
</xsl:template>
<!-- - - - - - - - - - - - - - - - - -->	
<xsl:template name="formatPersonName">
	<xsl:param name="fName"/>
	<xsl:param name="lName"/>
	<xsl:value-of select="$fName"/><xsl:text> </xsl:text><xsl:value-of select="$lName"/>
</xsl:template>
<!-- - - - - - - - - - - - - - - - - - - - - - - - -->
<xsl:template name="header" xml:space="preserve">
<meta http-equiv="Content-Language" content="en-us"/>
<xsl:comment>
This document was created by applying the stylesheet Present.xsl.
</xsl:comment>
<title>Client Employment Summary Demonstration</title>
<style>
<xsl:comment>
	.redbold	{color: red; font-style: bold}
</xsl:comment>
</style>
</xsl:template>
</xsl:stylesheet>
