<?xml version="1.0" ?>
<!DOCTYPE stylesheet [
<!ENTITY sp "<xsl:text> </xsl:text>">
<!ENTITY cr "<xsl:text>
</xsl:text>">
]>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
	<xsl:output method="text" />

	<!-- root/ = main html wrapper -->
	<xsl:template match="resume">
<xsl:apply-templates select="name" mode="contact" />&cr;
<xsl:apply-templates select="description" mode="header" />&cr;&cr;
<xsl:apply-templates select="contact" />&cr;&cr;
<xsl:for-each select="experience|skills|distinction">
	<xsl:apply-templates select="." />
</xsl:for-each>
<xsl:apply-templates select="description" mode="footer" />
	</xsl:template>

	
	<!-- /name:contact = name on top of contact info -->	
	<xsl:template match="name" mode="contact">
<xsl:value-of select="first" />&sp;<xsl:value-of select="last" />
	</xsl:template>	
	
	<!-- /description:header = resume description in header -->
	<xsl:template match="description" mode="header">
<xsl:value-of select="title" /> | <xsl:value-of select="detail" />
	</xsl:template>
	
	<!-- /contact = contact information -->	
	<xsl:template match="contact">
<xsl:value-of select="email" />&cr;
<xsl:value-of select="url" />
&cr;&cr;
<xsl:apply-templates select="address" />&cr;
<xsl:value-of select="phone" />
	</xsl:template>

	<!-- /contact/address = address contact -->
	<xsl:template match="address">
<xsl:value-of select="street" />&cr;
<xsl:value-of select="city" />, <xsl:value-of select="state" />&sp;<xsl:value-of select="zip" />
	</xsl:template>
	
	<!-- !section_header = section header -->	
	<xsl:template name="section_header">
&cr;
--------------------------------------------------&cr;
&sp;<xsl:value-of select="title" />&cr;
&sp;<xsl:value-of select="description" />
--------------------------------------------------&cr;
	</xsl:template>


	<!-- /experience = past job experience section -->
	<xsl:template match="experience">
<xsl:call-template name="section_header" />
<xsl:apply-templates select="jobs/job" />
	</xsl:template>

	<!-- /experience/jobs/job = individual job info -->	
	<xsl:template match="jobs/job">
&cr;
<xsl:value-of select="company" />&cr;
<xsl:value-of select="title" />&cr;
<xsl:apply-templates select="location" />&cr;
<xsl:apply-templates select="duration" />
&cr;
<xsl:apply-templates select="details/detail" />
&cr;
	</xsl:template>
	
	<!-- /experience/jobs/job/duration = duration of job -->
	<xsl:template match="duration">			
<xsl:value-of select="start" /> | <xsl:choose>
	<xsl:when test="end/text()"><xsl:value-of select="end" /></xsl:when>
	<xsl:otherwise>Now</xsl:otherwise>
</xsl:choose>
	</xsl:template>
	
	<!-- /experience/jobs/job/location = location of job -->
	<xsl:template match="location">			
<xsl:value-of select="city" /> 
<xsl:if test="state/text()"> | <xsl:value-of select="state" /></xsl:if>
	</xsl:template>
	
	<!-- /experience/jobs/job/details/detail = job details -->
	<xsl:template match="details/detail">
* <xsl:value-of select="." />&cr;
	</xsl:template>


	<!-- /skills = skills section -->
	<xsl:template match="skills">
<xsl:call-template name="section_header" />
<xsl:apply-templates select="items/item" />
	</xsl:template>
	
	<!-- /skills/items/item = skills list -->
	<xsl:template match="items/item">
* <xsl:value-of select="." />
	</xsl:template>
	

	<!-- /distinction = distinction and education section -->
	<xsl:template match="distinction">
&cr;&cr;
<xsl:call-template name="section_header" />
<xsl:apply-templates select="events/event" />
	</xsl:template>

	<!-- /distinction/events/event = list of events -->
	<xsl:template match="events/event">
* [<xsl:value-of select="year" />] <xsl:value-of select="detail" />&cr;
	</xsl:template>
	

	<!-- /description:footer = resume description in footer -->
	<xsl:template match="description" mode="footer">
&cr;&cr;&cr;&cr;
<xsl:value-of select="end" />
END
	</xsl:template>

</xsl:stylesheet>
