cv_html.xsl
branchstyles
changeset 0 08de8d15f932
equal deleted inserted replaced
-1:000000000000 0:08de8d15f932
       
     1 <?xml version="1.0"?>
       
     2 <xsl:stylesheet version="1.1"
       
     3   xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
       
     4   xmlns:xt="http://www.jclark.com/xt"
       
     5   extension-element-prefixes="xt" 
       
     6   xmlns="http://www.w3.org/1999/xhtml">
       
     7   <xsl:import href="html.xsl"/>
       
     8   <xsl:output method="xml"
       
     9         version="1.0" 
       
    10         encoding="UTF-8"
       
    11         doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
       
    12         doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
       
    13         indent="yes"/>
       
    14 
       
    15 
       
    16 <xsl:template name="gentext">
       
    17   <xsl:param name="string"/>
       
    18   <xsl:variable name="uri">
       
    19     <xsl:text>cv_str.</xsl:text>
       
    20     <xsl:value-of select="/cv/@lang"/>
       
    21     <xsl:text>.xml</xsl:text>
       
    22   </xsl:variable>
       
    23   <!-- <xsl:message>Looking for <xsl:value-of select="$string"/> in <xsl:value-of select="$uri"/>.</xsl:message> -->
       
    24   <xsl:value-of select="document($uri)//*[@name=$string]"/>
       
    25 </xsl:template>
       
    26 
       
    27 <!-- cv -->
       
    28 <xsl:template match="cv">
       
    29   <xsl:variable name="fullname">
       
    30     <xsl:apply-templates mode="fullname" select="identification"/>
       
    31   </xsl:variable>
       
    32   <html>
       
    33     <head>
       
    34       <title>
       
    35       	<xsl:call-template name="gentext">
       
    36 	  <xsl:with-param name="string">str-curriculum</xsl:with-param>
       
    37 	</xsl:call-template>
       
    38 	<xsl:value-of select="$fullname"/></title>
       
    39       <link href="{$css-base-dir}cv.css" media="screen" rel="stylesheet" type="text/css"/>
       
    40     </head>
       
    41     <body>
       
    42       <hr/>
       
    43       <xsl:apply-templates select="identification"/>
       
    44       <hr/>
       
    45       <h1 id="works">
       
    46       	<xsl:call-template name="gentext">
       
    47 	  <xsl:with-param name="string">str-experience</xsl:with-param>
       
    48 	</xsl:call-template>
       
    49       </h1>
       
    50       <xsl:apply-templates select="work"/>
       
    51       <hr/>
       
    52       <h1 id="studies">
       
    53       	<xsl:call-template name="gentext">
       
    54 	  <xsl:with-param name="string">str-formation</xsl:with-param>
       
    55 	</xsl:call-template>
       
    56       </h1>
       
    57       <ul class="studies">
       
    58         <xsl:apply-templates select="study" mode="short"/>
       
    59       </ul>
       
    60       <hr/>
       
    61       <h1 id="kownledges">
       
    62       	<xsl:call-template name="gentext">
       
    63 	  <xsl:with-param name="string">str-competences</xsl:with-param>
       
    64 	</xsl:call-template>
       
    65       </h1>
       
    66       <dl class="knowledge">
       
    67         <xsl:apply-templates select="knowledge"/>
       
    68         <dt id="languages">
       
    69       	  <xsl:call-template name="gentext">
       
    70 	    <xsl:with-param name="string">str-languages</xsl:with-param>
       
    71 	  </xsl:call-template>
       
    72 	</dt>
       
    73         <dd>
       
    74           <ul class="languages">
       
    75             <xsl:apply-templates select="language"/>
       
    76           </ul>
       
    77         </dd>
       
    78       </dl>
       
    79       <!--
       
    80       <dl class="legend">
       
    81         <dt>Acquis</dt><dd>plus d'un an de pratique.</dd>
       
    82         <dt>Notions</dt><dd>moins d'un an de pratique.</dd>
       
    83       </dl>
       
    84       -->
       
    85       <hr/>
       
    86       <h1 id="projects">
       
    87       	<xsl:call-template name="gentext">
       
    88 	  <xsl:with-param name="string">str-projects</xsl:with-param>
       
    89 	</xsl:call-template>
       
    90       </h1>
       
    91       <ul class="projects">
       
    92         <xsl:apply-templates select="project|concours" mode="short"/>
       
    93       </ul>
       
    94       <hr/>
       
    95       <h1 id="interests">
       
    96       	<xsl:call-template name="gentext">
       
    97 	  <xsl:with-param name="string">str-hobbies</xsl:with-param>
       
    98 	</xsl:call-template>
       
    99       </h1>
       
   100       <ul class="interests">
       
   101         <xsl:apply-templates select="interest" mode="short"/>
       
   102       </ul>
       
   103     </body>
       
   104   </html>
       
   105 </xsl:template>
       
   106 
       
   107 <xsl:template match="knownlist[@level='learning']"/> 
       
   108 <xsl:template match="work[@role='old']">
       
   109   <xsl:apply-templates select="." mode="short"/>
       
   110 </xsl:template>
       
   111 <xsl:template match="project|concours[@role='old']" mode="short"/>
       
   112 
       
   113 <!-- identification section -->
       
   114 <xsl:template match="identification">
       
   115   <div id="identification">
       
   116     <h2 class="name"><xsl:apply-templates select="." mode="fullname"/></h2>
       
   117     <p>
       
   118       <xsl:apply-templates mode="id"/> 
       
   119     </p>
       
   120   </div>
       
   121 </xsl:template>
       
   122 <!-- already process, so skip -->
       
   123 <xsl:template match="firstname|surname|initials" mode="id"/>
       
   124 <xsl:template mode="id" match="*">
       
   125   <span class="{name()}"><xsl:apply-templates select="."/></span><br/>
       
   126 </xsl:template>
       
   127 <xsl:template mode="id" match="title">
       
   128   <span class="{name()}"><xsl:apply-templates/></span><br/>
       
   129 </xsl:template>
       
   130 <xsl:template mode="id" match="email">
       
   131   <xsl:call-template name="gentext">
       
   132     <xsl:with-param name="string">str-email</xsl:with-param>
       
   133   </xsl:call-template>
       
   134   <xsl:text>: </xsl:text><span class="{name()}"><xsl:apply-templates/></span><br/>
       
   135 </xsl:template>
       
   136 <xsl:template mode="id" match="web">
       
   137   <span class="{name()}"><xsl:apply-templates/></span><br/>
       
   138 </xsl:template>
       
   139 <xsl:template mode="id" match="address">
       
   140   <xsl:apply-templates select="."/>
       
   141 </xsl:template>
       
   142 <xsl:template mode="id" match="phone">
       
   143   <xsl:call-template name="gentext">
       
   144     <xsl:with-param name="string">
       
   145       <xsl:choose>
       
   146 	<xsl:when test="@type='fax'">str-phone-fax</xsl:when>
       
   147 	<xsl:when test="@type='pager'">str-phone-pager</xsl:when>
       
   148 	<xsl:when test="@type='mobile'">str-phone-mobile</xsl:when>
       
   149 	<xsl:when test="@type='home'">str-phone-home</xsl:when>
       
   150 	<xsl:when test="@type='work'">str-phone-work</xsl:when>
       
   151 	<xsl:otherwise>str-phone</xsl:otherwise>
       
   152       </xsl:choose>
       
   153     </xsl:with-param>
       
   154   </xsl:call-template>
       
   155   <xsl:text>: </xsl:text>
       
   156   <span class="phone" title="{@type}"><xsl:apply-templates/></span><br/>
       
   157 </xsl:template>
       
   158 
       
   159 <!-- work -->
       
   160 <xsl:template match="work">
       
   161   <div class="work">
       
   162     <xsl:apply-templates/>
       
   163   </div>
       
   164 </xsl:template>
       
   165 <xsl:template match="work/organism">
       
   166   <h2><xsl:apply-templates select="." mode="short"/></h2>
       
   167 </xsl:template>
       
   168 
       
   169 <xsl:template match="work" mode="short">
       
   170   <h2><xsl:apply-templates select="organism" mode="short"/></h2>
       
   171   <ul>
       
   172     <xsl:apply-templates select="post" mode="short"/>
       
   173   </ul>
       
   174 </xsl:template>
       
   175 <xsl:template match="post" mode="short">
       
   176   <li>
       
   177     <xsl:if test="title">
       
   178       <xsl:apply-templates select="title" mode="short"/>
       
   179       <xsl:text>; </xsl:text>
       
   180     </xsl:if>
       
   181     <xsl:apply-templates select="duration" mode="short"/>
       
   182   </li>
       
   183 </xsl:template>
       
   184 
       
   185 <!-- post -->
       
   186 <xsl:template match="post">
       
   187   <div class="post">
       
   188     <xsl:attribute name="id">
       
   189       <xsl:call-template name="get-id"/>
       
   190     </xsl:attribute>
       
   191     <xsl:apply-templates/>
       
   192   </div>
       
   193 </xsl:template>
       
   194 <xsl:template match="post/title">
       
   195   <h3><xsl:apply-templates/></h3>
       
   196 </xsl:template>
       
   197 <xsl:template match="supervisor">
       
   198   <p class="supervisor">
       
   199     <xsl:call-template name="gentext">
       
   200       <xsl:with-param name="string">str-supervisor</xsl:with-param>
       
   201     </xsl:call-template>
       
   202     <xsl:text>: </xsl:text>
       
   203     <span class="supervisor">
       
   204      <xsl:apply-templates mode="fullname" select="."/>
       
   205     </span>
       
   206   </p>
       
   207 </xsl:template>
       
   208 <xsl:template match="post/duration">
       
   209   <p class="duration"><xsl:apply-templates/></p>
       
   210 </xsl:template>
       
   211 <xsl:template match="post/description">
       
   212   <div class="description">
       
   213     <xsl:apply-templates/>
       
   214   </div>
       
   215 </xsl:template>
       
   216 
       
   217 <!-- study -->
       
   218 <xsl:template match="study" mode="short">
       
   219   <li><xsl:apply-templates select="studydomain"/>
       
   220     <xsl:text> (</xsl:text>
       
   221     <xsl:apply-templates select="duration"/>
       
   222     <xsl:text>), </xsl:text>
       
   223     <xsl:apply-templates select="organism" mode="short"/>
       
   224   </li>
       
   225 </xsl:template>
       
   226 
       
   227 <!-- knowledge -->
       
   228 <xsl:template match="knowledge">
       
   229   <dt><xsl:apply-templates select="name"/></dt>
       
   230   <dd>
       
   231     <ul>
       
   232       <xsl:apply-templates select="knownlist"/>
       
   233     </ul>
       
   234   </dd>
       
   235 </xsl:template>
       
   236 <xsl:template match="knownlist">
       
   237   <li>
       
   238     <strong class="level">
       
   239       <xsl:call-template name="gentext">
       
   240         <xsl:with-param name="string">
       
   241           <xsl:choose>
       
   242             <xsl:when test="@level='notions'">str-level-notions</xsl:when>
       
   243             <xsl:when test="@level='learning'">str-level-learning</xsl:when>
       
   244             <xsl:otherwise>str-level-known</xsl:otherwise><!-- 'known' -->
       
   245           </xsl:choose>
       
   246 	</xsl:with-param>
       
   247       </xsl:call-template>
       
   248       <xsl:text>: </xsl:text>
       
   249     </strong>
       
   250     <xsl:apply-templates mode="short"/>
       
   251   </li>
       
   252 </xsl:template>
       
   253 
       
   254 <xsl:template match="language">
       
   255   <li>
       
   256     <xsl:apply-templates/>
       
   257     <xsl:text>: </xsl:text>
       
   258     <em class="level">
       
   259       <xsl:call-template name="gentext">
       
   260         <xsl:with-param name="string">
       
   261           <xsl:choose>
       
   262             <xsl:when test="@level='notions'">str-lang-notions</xsl:when>
       
   263             <xsl:when test="@level='learning'">str-lang-learning</xsl:when>
       
   264             <xsl:when test="@level='functional'">str-lang-functional</xsl:when>
       
   265             <xsl:otherwise>str-lang-known</xsl:otherwise><!-- 'known' -->
       
   266           </xsl:choose>
       
   267 	</xsl:with-param>
       
   268       </xsl:call-template>
       
   269     </em>
       
   270   </li>
       
   271 </xsl:template>
       
   272 
       
   273 <!-- project/concours -->
       
   274 <xsl:template match="project|concours" mode="short">
       
   275   <li><xsl:apply-templates select="organism" mode="short"/>
       
   276     <xsl:text> (</xsl:text>
       
   277     <xsl:apply-templates select="duration|year" mode="short"/>
       
   278     <xsl:text>)</xsl:text>
       
   279     <xsl:if test="description">
       
   280       <xsl:text>, </xsl:text>
       
   281       <xsl:apply-templates select="description" mode="short"/>
       
   282     </xsl:if>
       
   283   </li>
       
   284 </xsl:template>
       
   285 
       
   286 <xsl:template match="interest" mode="short">
       
   287   <li><xsl:apply-templates mode="short"/></li>
       
   288 </xsl:template>
       
   289 
       
   290 </xsl:stylesheet>