<?xml version="1.0" encoding="UTF-8" ?>

<!DOCTYPE stylesheet [
<!ENTITY sp "<xsl:text> </xsl:text>">
]>

<xsl:stylesheet 
    exclude-result-prefixes="r"
    version="2.0" 
    xmlns:r="http://xmlresume.sourceforge.net/resume/0.0" 
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>
    <xsl:output method="html" encoding="UTF-8" />
    <xsl:param name="mobile"></xsl:param>

    <xsl:template match="/r:resume">
        <xsl:text disable-output-escaping="yes">&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"&gt;</xsl:text>
        <html lang="en">
	    <head>
                <xsl:apply-templates select="r:header/r:name" />
                <link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/combo?3.0.0/build/cssreset/reset-min.css&amp;3.0.0/build/cssfonts/fonts-min.css" />
                <link rel="stylesheet" type="text/css" href="css/brev-resume{$mobile}.css" />
                <link rel="shortcut icon" type="image/vnd.microsoft.icon" href="" />
	    </head>
    	    <body>
                <div id="brev-resume" class="hresume"> 
                    <div id="brev-resume-info" class="contact vcard">
                        <xsl:apply-templates select="r:header" />
                    </div>
                    <ul id="brev-resume-sections">
                        <li id="brev-resume-history" class="brev-resume-section"><xsl:apply-templates select="r:history" /></li>
                        <li id="brev-resume-skills" class="brev-resume-section"><xsl:apply-templates select="r:skillareas" /></li>
                        <li id="brev-resume-effort" class="brev-resume-section">
                            <h3>Effort</h3>
                            <ul class="brev-resume-section-content">
                                <li id="brev-resume-effort-school" class="brev-resume-effort-area"><xsl:apply-templates select="r:academics/r:degrees" /></li>
                                <li id="brev-resume-effort-groups" class="brev-resume-effort-area"><xsl:apply-templates select="r:memberships" /></li>
                                <li id="brev-resume-effort-awards" class="brev-resume-effort-area"><xsl:apply-templates select="r:awards" /></li>
                                <li id="brev-resume-effort-resume" class="brev-resume-effort-area">
                                    <h4>Resume</h4>
                                    <p>
                                        This page was automatically generated via <a href="xsl/brev-resume-html.xsl">XSLT</a> 
                                        from an <a href="brev-resume.xml">XML</a> file in the 
                                        <a href="http://xmlresume.sourceforge.net">XML Resume Library</a> format. 
                                    </p>
                                    <p>
                                        This 
                                        <a href="http://validator.w3.org/check?uri=http%3A%2F%2Fbrev.name%2Fresume%2Fbrev-resume{$mobile}.html">HTML</a> 
                                        file validates at the <a href="http://www.w3.org/">W3C</a>.
                                    </p>
                                    <p>
                                        This resume uses the 
                                        <a href="http://microformats.org/wiki/hresume">hResume</a>, 
                                        <a href="http://microformats.org/wiki/hcalendar">hCalendar</a>, 
                                        <a href="http://microformats.org/wiki/hcard">hCard</a>, 
                                        <a href="http://microformats.org/wiki/rel-tag">rel-tag</a>, 
                                        <a href="http://microformats.org/wiki/adr">adr</a>, and 
                                        <a href="http://microformats.org/wiki/geo">geo</a>
                                        Microformats.
                                    </p>
                                </li>
                            </ul>
                        </li>
                    </ul>
                </div>
                <script type="text/javascript">
                    var _gaq = _gaq || [];
                    _gaq.push(['_setAccount', 'UA-11130563-2']);
                    _gaq.push(['_trackPageview']);
                    (function() {
                        var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
                        ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
                        var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
                    })();
                </script>
            </body>
        </html>
    </xsl:template>
    
    <xsl:template match="r:header/r:name">
        <title>
            <xsl:value-of select="r:firstname" />&sp;
            <xsl:value-of select="r:surname" /> Resume - 
            <xsl:value-of select="/r:resume/r:objective/r:para" /> - 
            Agile, AJAX, CSS, DOM, HTML, Javascript, JSON, Microformats, Perl, PHP, REST, Scrum, SEO, Web Standards, XML, XSLT, YUI
        </title>
        <meta name="description" content="{r:firstname} {r:surname} Resume - {/r:resume/r:objective/r:para} - Agile, AJAX, CSS, DOM, HTML, Javascript, JSON, Microformats, Perl, PHP, REST, Scrum, SEO, Web Standards, XML, XSLT, YUI" />
        <meta name="keywords" content="{r:firstname}, {r:surname}, Resume, Agile, AJAX, CSS, DOM, HTML, Javascript, JSON, Microformats, Perl, PHP, REST, Scrum, SEO, Web Standards, XML, XSLT, YUI" />
        <xsl:if test="$mobile">
            <meta name="viewport" content="width=device-width" />
        </xsl:if>
    </xsl:template>
   
    <xsl:template match="r:header">
        <em><xsl:value-of select="r:name/r:firstname" /></em>
        <h2 class="summary role title"><xsl:value-of select="/r:resume/r:objective/r:para" /></h2>
        <div id="brev-resume-info-contact">
            <h1 id="brev-name" class="fn">
                <xsl:value-of select="r:name/r:firstname" />&sp;
                <xsl:value-of select="r:name/r:surname" />
            </h1>
            <ul id="brev-resume-info-contact-online">
                <xsl:for-each select="r:contact/r:url"> 
                    <li>
                        <xsl:element name="a">
                            <xsl:attribute name="class">url</xsl:attribute> 
                            <xsl:attribute name="href">
                                <xsl:value-of select="." />
                            </xsl:attribute> 
                            <xsl:choose>
                                <xsl:when test="contains(text(), 'linkedin')">LinkedIn Profile</xsl:when>
                                <xsl:otherwise>
                                    <xsl:value-of select="." />
                                </xsl:otherwise>
                            </xsl:choose>
                        </xsl:element>
                    </li>
                </xsl:for-each>
                <li id="brev-resume-info-contact-email">
                    <a class="email" href="mailto:{r:contact/r:email}"><xsl:value-of select="r:contact/r:email" /></a>
                </li>
            </ul>
            <div class="tel">
                <xsl:value-of select="r:contact/r:phone" />
            </div>
            <div class="adr">
                <span class="locality"><xsl:value-of select="r:address/r:city" /></span>,
                <span class="region"><xsl:value-of select="r:address/r:state" /></span>
                <br />
                <span class="country-name"><xsl:value-of select="r:address/r:country" /></span>
                <div class="brev-hide geo">
                    Geo:
                    <span class="latitude">
                        <xsl:value-of select="substring-before(r:address/r:province, ',')" />
                    </span>,
                    <span class="longitude">
                        <xsl:value-of select="substring-after(r:address/r:province, ',')" />
                    </span>
                </div>
            </div>
            <div id="brev-resume-updated">
                <xsl:choose>
                    <xsl:when test="$mobile">
                        Mobile Version
                    </xsl:when>
                    <xsl:otherwise>
                        Desktiop Version
                    </xsl:otherwise>
                </xsl:choose>
                <br />
                Last Updated:
                <br />
                <xsl:value-of select="substring(/r:resume/r:lastModified/r:date/r:month, 1, 3)" />&sp;
                <xsl:value-of select="/r:resume/r:lastModified/r:date/r:year" /> 
            </div> 
        </div>
    </xsl:template>
                        
    <xsl:template match="r:history">
        <h3>Career</h3>
        <ul class="brev-resume-section-content vcalendar">
            <xsl:for-each select="r:job"> 
                <li class="brev-resume-history-job experience vevent vcard">
                    <div class="brev-resume-history-job-info">
                        <div class="brev-resume-history-job-info-whowhatwhere">
                            <a href="#brev-name" class="include brev-hide"></a>
                            <h4>
                                <xsl:choose>
                                    <xsl:when test="r:employer/r:link">
                                        <xsl:element name="a">
                                            <xsl:attribute name="class">url</xsl:attribute>
                                            <xsl:attribute name="href">
                                                <xsl:value-of select="r:employer/r:link/@href" />
                                            </xsl:attribute> 
                                            <span class="summary org"><xsl:value-of select="r:employer/r:link" /></span>
                                        </xsl:element>
                                    </xsl:when>
                                    <xsl:otherwise>
                                        <span class="summary org"><xsl:value-of select="r:employer" /></span>
                                    </xsl:otherwise>
                                </xsl:choose>
                            </h4>
                            <h5 class="title role"><xsl:value-of select="r:jobtitle" /></h5>
                            <div class="brev-resume-history-job-info-where location adr">
                                <span class="locality"><xsl:value-of select="r:location/r:city" /></span>,
                                <span class="region"><xsl:value-of select="r:location/r:state" /></span>
                                <div class="brev-hide geo">
                                    Geo:
                                    <span class="latitude">
                                        <xsl:value-of select="substring-before(r:location/r:country, ',')" />
                                    </span>,
                                    <span class="longitude">
                                        <xsl:value-of select="substring-after(r:location/r:country, ',')" />
                                    </span>
                                </div>
                            </div>
                        </div>
                        <div class="brev-resume-history-job-info-when">
                            <span class="dtstart">
                                <xsl:value-of select="substring(r:period/r:from/r:date/r:month, 1, 3)" />&sp;
                                <xsl:value-of select="r:period/r:from/r:date/r:year" />
                            </span>                         
                            &#8212;
                            <span class="dtend">
                                <xsl:choose>
                                    <xsl:when test="r:period/r:to/r:present">Present</xsl:when>
                                    <xsl:otherwise>
                                        <xsl:value-of select="substring(r:period/r:to/r:date/r:month, 1, 3)" />&sp;
                                        <xsl:value-of select="r:period/r:to/r:date/r:year" />
                                    </xsl:otherwise>
                                </xsl:choose>
                            </span>
                        </div>
                    </div>
                    <p>
                        <xsl:for-each select="r:description/r:para/text()|r:description/r:para/*">
                            <xsl:choose>
                                <xsl:when test="self::*">
                                    <xsl:element name="a">
                                        <xsl:attribute name="href">
                                            <xsl:value-of select="@href" />
                                        </xsl:attribute> 
                                        <xsl:value-of select="." />
                                    </xsl:element>
                                </xsl:when>
                                <xsl:otherwise>
                                    <xsl:value-of select="." />
                                </xsl:otherwise>
                            </xsl:choose>
                        </xsl:for-each>
                    </p>
                </li>
            </xsl:for-each>
        </ul>
    </xsl:template>
   
    <xsl:template match="r:skillareas">
        <h3>Skills</h3>
        <ul class="brev-resume-section-content">
            <xsl:for-each select="r:skillarea">
                <li class="brev-resume-skills-area">
                    <h4><xsl:value-of select="r:title" /></h4>
                    <ul>
                        <xsl:for-each select="r:skillset">
                            <li class="brev-resume-skills-set"> 
                                <em><xsl:value-of select="r:title" /></em>
                                <ul class="brev-resume-skills-list">
                                    <xsl:for-each select="r:skill">
                                        <li>
                                            <a class="skill" rel="tag" href="http://technorati.com/tag/{text()}"><xsl:value-of select="." /></a>
                                            <xsl:if test="position() != last()">,</xsl:if>
                                        </li>
                                    </xsl:for-each>
                                </ul>
                            </li>
                        </xsl:for-each>
                    </ul>
                </li>        
            </xsl:for-each>
        </ul>
    </xsl:template>
    
    <xsl:template match="r:academics/r:degrees">
        <h4>School</h4>
        <ul class="vcalendar">
            <xsl:for-each select="r:degree">
                <li class="education vevent vcard">
                    <a href="#brev-name" class="include brev-hide"></a>
                    <em class="dtstart"><xsl:value-of select="r:date/r:year" /></em>
                    <h5 class="summary role title">
                        <xsl:value-of select="r:major" />
                        (<xsl:value-of select="r:level" />)
                    </h5> 
                    <xsl:if test="r:minor">
                        <div><xsl:value-of select="r:minor" /> Minor</div>
                    </xsl:if>
                    <div>
                        <xsl:element name="a">
                            <xsl:attribute name="class">org url</xsl:attribute> 
                            <xsl:attribute name="href">
                                <xsl:value-of select="r:institution/r:link/@href" />
                            </xsl:attribute> 
                            <xsl:value-of select="r:institution/r:link" />
                        </xsl:element>
                    </div>
                    <div class="location adr">
                        <span class="locality"><xsl:value-of select="r:location/r:city" /></span>,
                        <span class="region"><xsl:value-of select="r:location/r:state" /></span>
                        <div class="brev-hide geo">
                            Geo:
                            <span class="latitude">
                                <xsl:value-of select="substring-before(r:location/r:country, ',')" />
                            </span>,
                            <span class="longitude">
                                <xsl:value-of select="substring-after(r:location/r:country, ',')" />
                            </span>
                        </div>
                    </div>
                </li>
            </xsl:for-each>
        </ul>
    </xsl:template>
    
    <xsl:template match="r:memberships">
        <h4>Groups</h4>
        <ul>
            <xsl:for-each select="r:membership">
                <li class="affiliation vcard">
                    <a href="#brev-name" class="include brev-hide"></a>
                    <em><xsl:value-of select="r:date/r:year" /></em>
                    <div>
                        <xsl:choose>
                            <xsl:when test="r:organization/r:link">
                                <xsl:element name="a">
                                    <xsl:attribute name="class">url</xsl:attribute>
                                    <xsl:attribute name="href">
                                        <xsl:value-of select="r:organization/r:link/@href" />
                                    </xsl:attribute> 
                                    <xsl:value-of select="r:organization/r:link" />
                                </xsl:element>
                            </xsl:when>
                            <xsl:otherwise>
                                <xsl:value-of select="r:organization" />
                            </xsl:otherwise>
                        </xsl:choose>
                    </div>
                    <h5 class="org"><xsl:value-of select="r:title" /></h5>
                    <div class="role title"><xsl:value-of select="r:description/r:para" /></div>
                </li>
            </xsl:for-each>
        </ul>
    </xsl:template>
    
    <xsl:template match="r:awards">
        <h4>Awards</h4>
        <ul>
            <xsl:for-each select="r:award">
                <li>
                    <em><xsl:value-of select="r:date/r:year" /></em>
                    <h5><xsl:value-of select="r:title" /></h5>
                    <xsl:if test="r:description/r:para"> 
                        <div><xsl:value-of select="r:description/r:para" /></div>
                    </xsl:if>
                    <div>
                        <xsl:element name="a">
                            <xsl:attribute name="href">
                                <xsl:value-of select="r:organization/r:link/@href" />
                            </xsl:attribute> 
                            <xsl:value-of select="r:organization/r:link" />
                        </xsl:element>
                    </div>
                </li>
            </xsl:for-each>
        </ul>
    </xsl:template>

</xsl:stylesheet>
