1
0
Fork 0
curriculum-vitae/templates/cv.xsl

166 lines
5.4 KiB
XML

<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" version="1.0" encoding="UTF-8" indent="yes" standalone="yes" doctype-system="about:legacy-compat" />
<xsl:param name="title" select="'Ainsley Ellis CV'"/>
<xsl:template name="company">
<article>
<h3><xsl:value-of select="./name/text()"/></h3>
<xsl:for-each select="./role">
<xsl:call-template name="role"/>
</xsl:for-each>
</article>
</xsl:template>
<xsl:template name="project">
<article>
<header>
<h3><xsl:value-of select="./name/text()" /></h3>
<p>
<xsl:value-of select="./activity/text()" />
</p>
</header>
<xsl:copy-of select="./description/node()" />
</article>
</xsl:template>
<xsl:template name="institution">
<article>
<hgroup>
<h3><xsl:value-of select="./name/text()" /></h3>
<p><xsl:value-of select="./location" /></p>
</hgroup>
<dl>
<xsl:for-each select="./degree">
<dt><xsl:value-of select="./level/text()" /> in <xsl:value-of select="./concentration/text()" /></dt>
<xsl:if test="boolean(./school)">
<dd>
<xsl:text>School: </xsl:text>
<xsl:value-of select="./school/text()" />
</dd>
</xsl:if>
<dd>
<xsl:text>Attended: </xsl:text>
<time>
<xsl:attribute name="datetime">
<xsl:value-of select="./duration/starrt[@datetime]" />
</xsl:attribute>
<xsl:value-of select="./duration/start/text()" />
</time>
<xsl:text> to </xsl:text>
<time>
<xsl:attribute name="datetime">
<xsl:value-of select="./duration/end[@datetime]" />
</xsl:attribute>
<xsl:value-of select="./duration/end/text()" />
</time>
</dd>
<xsl:if test="boolean(./gpa)">
<dd>GPA: <xsl:value-of select="./gpa/text()" /></dd>
</xsl:if>
<xsl:if test="boolean(./honors)">
<dd>
<xsl:text>Honours: </xsl:text>
<xsl:for-each select="./honors/item">
<xsl:value-of select="./text()" />
<xsl:if test="not(position()=last())">, </xsl:if>
</xsl:for-each>
</dd>
</xsl:if>
</xsl:for-each>
</dl>
</article>
</xsl:template>
<xsl:template name="skill-category">
<section>
<h3><xsl:value-of select="./name/text()" /></h3>
<ul role="list">
<xsl:for-each select="./item">
<li><xsl:value-of select="./text()" /></li>
</xsl:for-each>
</ul>
</section>
</xsl:template>
<xsl:template name="role">
<article>
<header>
<h4><xsl:value-of select="./title/text()" /></h4>
<p>
<time>
<xsl:attribute name="datetime">
<xsl:value-of select="./duration/start[@datetime]" />
</xsl:attribute>
<xsl:value-of select="./duration/start/text()" />
</time>
<xsl:choose>
<xsl:when test="./duration/start[@datetime] != ./duration/end[@datetime]">&#160;to&#160;<time>
<xsl:attribute name="datetime">
<xsl:value-of select="./duration/end[@datetime]" />
</xsl:attribute>
<xsl:value-of select="./duration/end/text()" />
</time>
</xsl:when>
<xsl:when test="not(boolean(./duration/end))">&#160;to&#160;Present</xsl:when>
</xsl:choose>
</p>
</header>
<xsl:copy-of select="./description/node()" />
</article>
</xsl:template>
<xsl:template match="/cv" data-xmlns="http://www.w3.org/1999/xhtml">
<html lang="en" dir="ltr">
<!-- The Yesterweb is dead, long live the Yesterweb! -->
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="color-scheme" content="light dark" />
<title><xsl:value-of select="$title"/></title>
<link rel="stylesheet" href="../assets/css/all.css" />
<link rel="stylesheet" href="../assets/css/screen.css" media="screen" />
<link rel="stylesheet" href="../assets/css/print.css" media="print" />
</head>
<body>
<main>
<xsl:copy-of select="document('./fragments/header.xml')"/>
<!-- <xsl:copy-of select="/cv"/> -->
<section id="objective">
<h2>Objective</h2>
<!-- select specific objective from xml file -->
<xsl:copy-of select="document('./fragments/objectives.xml')/objectives/objective[@name='web-development']/node()"/>
</section>
<section id="work-history">
<h2>Work History</h2>
<xsl:for-each select="./work-history/company">
<xsl:call-template name="company"/>
</xsl:for-each>
</section>
<section id="open-source-contributions">
<h2>Open-source Contributions</h2>
<xsl:for-each select="./foss-contributions/project">
<xsl:call-template name="project"/>
</xsl:for-each>
</section>
<section id="education">
<h2>Education</h2>
<xsl:for-each select="./education/institution">
<xsl:call-template name="institution"/>
</xsl:for-each>
</section>
<section id="skills">
<h2>Skills</h2>
<xsl:for-each select="./skills/category">
<xsl:call-template name="skill-category"/>
</xsl:for-each>
</section>
</main>
<hr/>
<xsl:if test="$hash">
<footer>
<p>
<small>Built with XSLT (<a>
<xsl:attribute name="href">https://git.pub0.org/heyainsleymae/curriculum-vitae/src/commit/<xsl:value-of select="$hash" /></xsl:attribute>view commit</a>)</small></p>
</footer>
</xsl:if>
</body>
</html>
</xsl:template>
</xsl:stylesheet>