cv_html.xsl
author fabien
Sun, 16 Mar 2008 23:44:46 -0400
branchstyles
changeset 8 8138139b1aa9
parent 0 08de8d15f932
permissions -rw-r--r--
[svn r2298] r2544@freebird: fabien | 2008-03-12 01:34:15 -0400 Retrait des stages et ajustements subséquents.

<?xml version="1.0"?>
<xsl:stylesheet version="1.1"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:xt="http://www.jclark.com/xt"
  extension-element-prefixes="xt" 
  xmlns="http://www.w3.org/1999/xhtml">
  <xsl:import href="html.xsl"/>
  <xsl:output method="xml"
        version="1.0" 
        encoding="UTF-8"
        doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
        doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
        indent="yes"/>


<xsl:template name="gentext">
  <xsl:param name="string"/>
  <xsl:variable name="uri">
    <xsl:text>cv_str.</xsl:text>
    <xsl:value-of select="/cv/@lang"/>
    <xsl:text>.xml</xsl:text>
  </xsl:variable>
  <!-- <xsl:message>Looking for <xsl:value-of select="$string"/> in <xsl:value-of select="$uri"/>.</xsl:message> -->
  <xsl:value-of select="document($uri)//*[@name=$string]"/>
</xsl:template>

<!-- cv -->
<xsl:template match="cv">
  <xsl:variable name="fullname">
    <xsl:apply-templates mode="fullname" select="identification"/>
  </xsl:variable>
  <html>
    <head>
      <title>
      	<xsl:call-template name="gentext">
	  <xsl:with-param name="string">str-curriculum</xsl:with-param>
	</xsl:call-template>
	<xsl:value-of select="$fullname"/></title>
      <link href="{$css-base-dir}cv.css" media="screen" rel="stylesheet" type="text/css"/>
    </head>
    <body>
      <hr/>
      <xsl:apply-templates select="identification"/>
      <hr/>
      <h1 id="works">
      	<xsl:call-template name="gentext">
	  <xsl:with-param name="string">str-experience</xsl:with-param>
	</xsl:call-template>
      </h1>
      <xsl:apply-templates select="work"/>
      <hr/>
      <h1 id="studies">
      	<xsl:call-template name="gentext">
	  <xsl:with-param name="string">str-formation</xsl:with-param>
	</xsl:call-template>
      </h1>
      <ul class="studies">
        <xsl:apply-templates select="study" mode="short"/>
      </ul>
      <hr/>
      <h1 id="kownledges">
      	<xsl:call-template name="gentext">
	  <xsl:with-param name="string">str-competences</xsl:with-param>
	</xsl:call-template>
      </h1>
      <dl class="knowledge">
        <xsl:apply-templates select="knowledge"/>
        <dt id="languages">
      	  <xsl:call-template name="gentext">
	    <xsl:with-param name="string">str-languages</xsl:with-param>
	  </xsl:call-template>
	</dt>
        <dd>
          <ul class="languages">
            <xsl:apply-templates select="language"/>
          </ul>
        </dd>
      </dl>
      <!--
      <dl class="legend">
        <dt>Acquis</dt><dd>plus d'un an de pratique.</dd>
        <dt>Notions</dt><dd>moins d'un an de pratique.</dd>
      </dl>
      -->
      <hr/>
      <h1 id="projects">
      	<xsl:call-template name="gentext">
	  <xsl:with-param name="string">str-projects</xsl:with-param>
	</xsl:call-template>
      </h1>
      <ul class="projects">
        <xsl:apply-templates select="project|concours" mode="short"/>
      </ul>
      <hr/>
      <h1 id="interests">
      	<xsl:call-template name="gentext">
	  <xsl:with-param name="string">str-hobbies</xsl:with-param>
	</xsl:call-template>
      </h1>
      <ul class="interests">
        <xsl:apply-templates select="interest" mode="short"/>
      </ul>
    </body>
  </html>
</xsl:template>

<xsl:template match="knownlist[@level='learning']"/> 
<xsl:template match="work[@role='old']">
  <xsl:apply-templates select="." mode="short"/>
</xsl:template>
<xsl:template match="project|concours[@role='old']" mode="short"/>

<!-- identification section -->
<xsl:template match="identification">
  <div id="identification">
    <h2 class="name"><xsl:apply-templates select="." mode="fullname"/></h2>
    <p>
      <xsl:apply-templates mode="id"/> 
    </p>
  </div>
</xsl:template>
<!-- already process, so skip -->
<xsl:template match="firstname|surname|initials" mode="id"/>
<xsl:template mode="id" match="*">
  <span class="{name()}"><xsl:apply-templates select="."/></span><br/>
</xsl:template>
<xsl:template mode="id" match="title">
  <span class="{name()}"><xsl:apply-templates/></span><br/>
</xsl:template>
<xsl:template mode="id" match="email">
  <xsl:call-template name="gentext">
    <xsl:with-param name="string">str-email</xsl:with-param>
  </xsl:call-template>
  <xsl:text>: </xsl:text><span class="{name()}"><xsl:apply-templates/></span><br/>
</xsl:template>
<xsl:template mode="id" match="web">
  <span class="{name()}"><xsl:apply-templates/></span><br/>
</xsl:template>
<xsl:template mode="id" match="address">
  <xsl:apply-templates select="."/>
</xsl:template>
<xsl:template mode="id" match="phone">
  <xsl:call-template name="gentext">
    <xsl:with-param name="string">
      <xsl:choose>
	<xsl:when test="@type='fax'">str-phone-fax</xsl:when>
	<xsl:when test="@type='pager'">str-phone-pager</xsl:when>
	<xsl:when test="@type='mobile'">str-phone-mobile</xsl:when>
	<xsl:when test="@type='home'">str-phone-home</xsl:when>
	<xsl:when test="@type='work'">str-phone-work</xsl:when>
	<xsl:otherwise>str-phone</xsl:otherwise>
      </xsl:choose>
    </xsl:with-param>
  </xsl:call-template>
  <xsl:text>: </xsl:text>
  <span class="phone" title="{@type}"><xsl:apply-templates/></span><br/>
</xsl:template>

<!-- work -->
<xsl:template match="work">
  <div class="work">
    <xsl:apply-templates/>
  </div>
</xsl:template>
<xsl:template match="work/organism">
  <h2><xsl:apply-templates select="." mode="short"/></h2>
</xsl:template>

<xsl:template match="work" mode="short">
  <h2><xsl:apply-templates select="organism" mode="short"/></h2>
  <ul>
    <xsl:apply-templates select="post" mode="short"/>
  </ul>
</xsl:template>
<xsl:template match="post" mode="short">
  <li>
    <xsl:if test="title">
      <xsl:apply-templates select="title" mode="short"/>
      <xsl:text>; </xsl:text>
    </xsl:if>
    <xsl:apply-templates select="duration" mode="short"/>
  </li>
</xsl:template>

<!-- post -->
<xsl:template match="post">
  <div class="post">
    <xsl:attribute name="id">
      <xsl:call-template name="get-id"/>
    </xsl:attribute>
    <xsl:apply-templates/>
  </div>
</xsl:template>
<xsl:template match="post/title">
  <h3><xsl:apply-templates/></h3>
</xsl:template>
<xsl:template match="supervisor">
  <p class="supervisor">
    <xsl:call-template name="gentext">
      <xsl:with-param name="string">str-supervisor</xsl:with-param>
    </xsl:call-template>
    <xsl:text>: </xsl:text>
    <span class="supervisor">
     <xsl:apply-templates mode="fullname" select="."/>
    </span>
  </p>
</xsl:template>
<xsl:template match="post/duration">
  <p class="duration"><xsl:apply-templates/></p>
</xsl:template>
<xsl:template match="post/description">
  <div class="description">
    <xsl:apply-templates/>
  </div>
</xsl:template>

<!-- study -->
<xsl:template match="study" mode="short">
  <li><xsl:apply-templates select="studydomain"/>
    <xsl:text> (</xsl:text>
    <xsl:apply-templates select="duration"/>
    <xsl:text>), </xsl:text>
    <xsl:apply-templates select="organism" mode="short"/>
  </li>
</xsl:template>

<!-- knowledge -->
<xsl:template match="knowledge">
  <dt><xsl:apply-templates select="name"/></dt>
  <dd>
    <ul>
      <xsl:apply-templates select="knownlist"/>
    </ul>
  </dd>
</xsl:template>
<xsl:template match="knownlist">
  <li>
    <strong class="level">
      <xsl:call-template name="gentext">
        <xsl:with-param name="string">
          <xsl:choose>
            <xsl:when test="@level='notions'">str-level-notions</xsl:when>
            <xsl:when test="@level='learning'">str-level-learning</xsl:when>
            <xsl:otherwise>str-level-known</xsl:otherwise><!-- 'known' -->
          </xsl:choose>
	</xsl:with-param>
      </xsl:call-template>
      <xsl:text>: </xsl:text>
    </strong>
    <xsl:apply-templates mode="short"/>
  </li>
</xsl:template>

<xsl:template match="language">
  <li>
    <xsl:apply-templates/>
    <xsl:text>: </xsl:text>
    <em class="level">
      <xsl:call-template name="gentext">
        <xsl:with-param name="string">
          <xsl:choose>
            <xsl:when test="@level='notions'">str-lang-notions</xsl:when>
            <xsl:when test="@level='learning'">str-lang-learning</xsl:when>
            <xsl:when test="@level='functional'">str-lang-functional</xsl:when>
            <xsl:otherwise>str-lang-known</xsl:otherwise><!-- 'known' -->
          </xsl:choose>
	</xsl:with-param>
      </xsl:call-template>
    </em>
  </li>
</xsl:template>

<!-- project/concours -->
<xsl:template match="project|concours" mode="short">
  <li><xsl:apply-templates select="organism" mode="short"/>
    <xsl:text> (</xsl:text>
    <xsl:apply-templates select="duration|year" mode="short"/>
    <xsl:text>)</xsl:text>
    <xsl:if test="description">
      <xsl:text>, </xsl:text>
      <xsl:apply-templates select="description" mode="short"/>
    </xsl:if>
  </li>
</xsl:template>

<xsl:template match="interest" mode="short">
  <li><xsl:apply-templates mode="short"/></li>
</xsl:template>

</xsl:stylesheet>