cv_print.xsl
branchstyles
changeset 0 08de8d15f932
child 5 20b41b986ac6
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/XSL/Format">
       
     7 
       
     8 <xsl:import href="common.xsl"/>
       
     9 <xsl:import href="print.xsl"/>
       
    10 
       
    11   <xsl:output method="xml"
       
    12         indent="yes"/>
       
    13 
       
    14 <xsl:template name="gentext">
       
    15   <xsl:param name="string"/>
       
    16   <xsl:variable name="uri">
       
    17     <xsl:text>cv_str.</xsl:text>
       
    18     <xsl:value-of select="/cv/@lang"/>
       
    19     <xsl:text>.xml</xsl:text>
       
    20   </xsl:variable>
       
    21   <!-- xsl:message>Looking for <xsl:value-of select="$string"/> in <xsl:value-of select="$uri"/>.</xsl:message -->
       
    22   <xsl:value-of select="document($uri)//*[@name=$string]"/>
       
    23 </xsl:template>
       
    24 
       
    25 <xsl:param name="cv-uri"/>
       
    26 <xsl:param name="date"/>
       
    27 <xsl:attribute-set name="section-title-font" xsl:use-attribute-sets="verylarge-title-font">
       
    28   <xsl:attribute name="font-size">12pt</xsl:attribute>
       
    29   <xsl:attribute name="font-weight">bold</xsl:attribute>
       
    30   <xsl:attribute name="space-after">4pt</xsl:attribute>
       
    31   <xsl:attribute name="text-decoration">underline</xsl:attribute>
       
    32   <xsl:attribute name="score-spaces">true</xsl:attribute>
       
    33   <xsl:attribute name="keep-with-next.within-page">always</xsl:attribute>
       
    34 </xsl:attribute-set>
       
    35 <xsl:attribute-set name="knowledge-title-font" xsl:use-attribute-sets="large-title-font">
       
    36   <xsl:attribute name="font-size">12pt</xsl:attribute>
       
    37   <xsl:attribute name="font-weight">bold</xsl:attribute>
       
    38   <xsl:attribute name="space-after">4pt</xsl:attribute>
       
    39   <xsl:attribute name="space-before">4pt</xsl:attribute>
       
    40   <xsl:attribute name="font-variant">small-caps</xsl:attribute>
       
    41 </xsl:attribute-set>
       
    42 <xsl:attribute-set name="work-title-font" xsl:use-attribute-sets="large-title-font">
       
    43   <xsl:attribute name="font-size">14pt</xsl:attribute>
       
    44   <xsl:attribute name="font-weight">bold</xsl:attribute>
       
    45   <xsl:attribute name="space-after">8pt</xsl:attribute>
       
    46   <xsl:attribute name="space-before">12pt</xsl:attribute>
       
    47   <xsl:attribute name="font-variant">small-caps</xsl:attribute>
       
    48 </xsl:attribute-set>
       
    49 <xsl:attribute-set name="work-short-font" xsl:use-attribute-sets="large-title-font">
       
    50   <xsl:attribute name="font-size">12pt</xsl:attribute>
       
    51   <xsl:attribute name="font-weight">bold</xsl:attribute>
       
    52   <xsl:attribute name="space-before">4pt</xsl:attribute>
       
    53   <xsl:attribute name="space-after">4pt</xsl:attribute>
       
    54   <xsl:attribute name="font-variant">small-caps</xsl:attribute>
       
    55 </xsl:attribute-set>
       
    56 <xsl:attribute-set name="post-title-font" xsl:use-attribute-sets="medium-title-font">
       
    57   <xsl:attribute name="font-size">10pt</xsl:attribute>
       
    58   <xsl:attribute name="font-weight">bold</xsl:attribute>
       
    59   <xsl:attribute name="space-after">4pt</xsl:attribute>
       
    60 </xsl:attribute-set>
       
    61 <xsl:attribute-set name="name-title-font" xsl:use-attribute-sets="verylarge-title-font">
       
    62   <xsl:attribute name="font-size">16pt</xsl:attribute>
       
    63   <xsl:attribute name="font-weight">bold</xsl:attribute>
       
    64   <xsl:attribute name="space-after">8pt</xsl:attribute>
       
    65   <!-- <xsl:attribute name="space-before">6pt</xsl:attribute> -->
       
    66 </xsl:attribute-set>
       
    67 <xsl:attribute-set name="default-font">
       
    68   <xsl:attribute name="font-size">10pt</xsl:attribute>
       
    69   <xsl:attribute name="space-after">4pt</xsl:attribute>
       
    70 </xsl:attribute-set>
       
    71 
       
    72 <xsl:attribute-set name="section-block">
       
    73   <xsl:attribute name="keep-together.within-page">always</xsl:attribute>
       
    74   <!-- <xsl:attribute name="break-inside">avoid</xsl:attribute> -->
       
    75   <!-- <xsl:attribute name="border-before-style">solid</xsl:attribute> -->
       
    76   <!-- <xsl:attribute name="border-after-style">solid</xsl:attribute> -->
       
    77   <!-- <xsl:attribute name="padding-before">5mm</xsl:attribute> -->
       
    78   <xsl:attribute name="space-before">10mm</xsl:attribute>
       
    79   <xsl:attribute name="space-before.conditionality">discard</xsl:attribute>
       
    80 </xsl:attribute-set>
       
    81 <!-- cv -->
       
    82 <xsl:template match="cv">
       
    83   <xsl:variable name="fullname">
       
    84     <xsl:apply-templates mode="fullname" select="identification"/>
       
    85   </xsl:variable>
       
    86   <root>
       
    87     <layout-master-set>
       
    88       <simple-page-master master-name="cv"
       
    89                         margin-top="1cm" margin-bottom="1cm"
       
    90                         margin-left="1cm" margin-right="1cm">
       
    91         <region-body margin-top="1cm" margin-bottom="1cm"/>
       
    92         <region-before extent="1cm" precedence="true"/>
       
    93         <region-after extent="1cm" precedence="true"/>
       
    94       </simple-page-master>
       
    95       <page-sequence-master master-name="cv-sequence">
       
    96         <repeatable-page-master-reference master-reference="cv"/>
       
    97       </page-sequence-master>
       
    98     </layout-master-set>
       
    99 
       
   100     <page-sequence master-reference="cv-sequence">
       
   101       <static-content flow-name="xsl-region-before">
       
   102         <block border-after-style="solid">
       
   103           <table width="100%" table-layout="fixed">
       
   104             <table-column column-width="proportional-column-width(1)"
       
   105                   number-columns-repeated="2"/>
       
   106             <table-body>
       
   107               <table-row>
       
   108                 <table-cell>
       
   109                   <block text-align="start"><xsl:value-of select="$fullname"/></block>
       
   110                 </table-cell>
       
   111                 <table-cell>
       
   112                   <block text-align="end"><xsl:value-of select="$date"/></block>
       
   113                 </table-cell>
       
   114               </table-row>
       
   115             </table-body>
       
   116           </table>
       
   117         </block>
       
   118       </static-content>
       
   119       <static-content flow-name="xsl-region-after">
       
   120         <block border-before-style="solid">
       
   121           <table width="100%" table-layout="fixed">
       
   122             <table-column column-width="proportional-column-width(1)"
       
   123                   number-columns-repeated="2"/>
       
   124             <table-body>
       
   125               <table-row>
       
   126                 <table-cell>
       
   127                   <block text-align="start"><xsl:value-of select="$cv-uri"/></block>
       
   128                 </table-cell>
       
   129                 <table-cell>
       
   130                   <block text-align="end">
       
   131                     <xsl:call-template name="gentext">
       
   132                       <xsl:with-param name="string">str-page</xsl:with-param>
       
   133                     </xsl:call-template>
       
   134                     <page-number/>
       
   135                     <xsl:call-template name="gentext">
       
   136                       <xsl:with-param name="string">str-page-of</xsl:with-param>
       
   137                     </xsl:call-template>
       
   138                     <page-number-citation ref-id="xsl_cv_the_end"/></block>
       
   139                 </table-cell>
       
   140               </table-row>
       
   141             </table-body>
       
   142           </table>
       
   143         </block>
       
   144       </static-content>
       
   145       <flow flow-name="xsl-region-body" xsl:use-attribute-sets="default-font">
       
   146         <block xsl:use-attribute-sets="section-block">
       
   147           <xsl:apply-templates select="identification"/>
       
   148         </block>
       
   149         <block xsl:use-attribute-sets="section-block" space-before.optimum="10pt" space-before.maximum="10pt">
       
   150           <block xsl:use-attribute-sets="section-title-font">
       
   151             <xsl:call-template name="gentext">
       
   152               <xsl:with-param name="string">str-formation</xsl:with-param>
       
   153             </xsl:call-template>
       
   154           </block>
       
   155           <list-block>
       
   156             <xsl:apply-templates select="study" mode="short"/>
       
   157           </list-block>
       
   158         </block>
       
   159         <block xsl:use-attribute-sets="section-block">
       
   160           <block xsl:use-attribute-sets="section-title-font">
       
   161             <xsl:call-template name="gentext">
       
   162               <xsl:with-param name="string">str-competences</xsl:with-param>
       
   163             </xsl:call-template>
       
   164           </block>
       
   165           <xsl:apply-templates select="knowledge"/>
       
   166           <block keep-together.within-page="always">
       
   167             <block xsl:use-attribute-sets="knowledge-title-font">
       
   168               <xsl:call-template name="gentext">
       
   169                 <xsl:with-param name="string">str-languages</xsl:with-param>
       
   170               </xsl:call-template>
       
   171             </block>
       
   172             <table width="100%" table-layout="fixed" margin-left="24pt">
       
   173               <table-column column-width="proportional-column-width(1)"
       
   174                   number-columns-repeated="2"/>
       
   175               <table-body>
       
   176                 <table-row>
       
   177                   <table-cell>
       
   178                     <xsl:apply-templates select="language[not(@level='notions' or @level='learning')]"/>
       
   179                   </table-cell>
       
   180                   <table-cell>
       
   181                     <xsl:apply-templates select="language[@level='notions']"/>
       
   182                   </table-cell>
       
   183                 </table-row>
       
   184               </table-body>
       
   185             </table>
       
   186           </block>
       
   187         </block>
       
   188         <block xsl:use-attribute-sets="section-block">
       
   189           <block xsl:use-attribute-sets="section-title-font">
       
   190             <xsl:call-template name="gentext">
       
   191               <xsl:with-param name="string">str-projects</xsl:with-param>
       
   192             </xsl:call-template>
       
   193           </block>
       
   194           <list-block>
       
   195             <xsl:apply-templates select="project|concours" mode="short"/>
       
   196           </list-block>
       
   197         </block>
       
   198         <block xsl:use-attribute-sets="section-block">
       
   199           <block xsl:use-attribute-sets="section-title-font">
       
   200             <xsl:call-template name="gentext">
       
   201               <xsl:with-param name="string">str-hobbies</xsl:with-param>
       
   202             </xsl:call-template>
       
   203           </block>
       
   204           <list-block>
       
   205             <xsl:apply-templates select="interest" mode="short"/>
       
   206           </list-block>
       
   207         </block>
       
   208         <block xsl:use-attribute-sets="section-block"
       
   209 	xsl:space-before="0mm">
       
   210           <block xsl:use-attribute-sets="section-title-font">
       
   211             <xsl:call-template name="gentext">
       
   212               <xsl:with-param name="string">str-experience</xsl:with-param>
       
   213             </xsl:call-template>
       
   214           </block>
       
   215           <xsl:apply-templates select="work"/>
       
   216         </block>
       
   217         <block visibility="hidden" id="xsl_cv_the_end"/>
       
   218       </flow>
       
   219     </page-sequence>
       
   220   </root>
       
   221 </xsl:template>
       
   222 
       
   223 <xsl:template match="knownlist[@level='learning']"/>
       
   224 <xsl:template match="item[@role='old']" mode="short"/>
       
   225 <xsl:template match="work[@role='old']">
       
   226   <!-- xsl:apply-templates select="." mode="short"/ -->
       
   227 </xsl:template>
       
   228 <xsl:template match="concours[@role='old']" mode="short"/>
       
   229 <xsl:template match="project[@role='old']" mode="short"/>
       
   230 
       
   231 <!-- identification section -->
       
   232 <xsl:template match="identification">
       
   233   <table width="100%" table-layout="fixed">
       
   234     <table-column column-width="proportional-column-width(1)"
       
   235                   number-columns-repeated="2"/>
       
   236     <table-body>
       
   237     <table-row>
       
   238       <table-cell>
       
   239       <block xsl:use-attribute-sets="name-title-font"><xsl:apply-templates select="." mode="fullname"/></block>
       
   240       <xsl:apply-templates select="title|email" mode="id"/>
       
   241       </table-cell>
       
   242       <table-cell>
       
   243       <xsl:apply-templates mode="id" select="*[name(.) != 'title' and name(.) != 'email']"/>
       
   244       </table-cell>
       
   245     </table-row>
       
   246     </table-body>
       
   247   </table>
       
   248 </xsl:template>
       
   249 <!-- already process, so skip -->
       
   250 <xsl:template match="firstname|surname|initials" mode="id"/>
       
   251 <xsl:template mode="id" match="*">
       
   252   <block><xsl:apply-templates select="."/></block>
       
   253 </xsl:template>
       
   254 <xsl:template mode="id" match="title">
       
   255   <block font-weight="bold"><xsl:apply-templates/></block>
       
   256 </xsl:template>
       
   257 <xsl:template mode="id" match="email">
       
   258   <block>
       
   259     <xsl:call-template name="gentext">
       
   260       <xsl:with-param name="string">str-email</xsl:with-param>
       
   261     </xsl:call-template>
       
   262     <xsl:text>: </xsl:text>
       
   263     <xsl:apply-templates/>
       
   264   </block>
       
   265 </xsl:template>
       
   266 <xsl:template mode="id" match="web">
       
   267   <block><xsl:apply-templates/></block>
       
   268 </xsl:template>
       
   269 <xsl:template mode="id" match="address">
       
   270   <xsl:apply-templates select="."/>
       
   271 </xsl:template>
       
   272 <xsl:template mode="id" match="phone">
       
   273   <block>
       
   274     <xsl:call-template name="gentext">
       
   275       <xsl:with-param name="string">        
       
   276         <xsl:choose>
       
   277           <xsl:when test="@type='fax'">str-phone-fax</xsl:when>
       
   278           <xsl:when test="@type='pager'">str-phone-pager</xsl:when>
       
   279           <xsl:when test="@type='mobile'">str-phone-mobile</xsl:when>
       
   280           <xsl:when test="@type='home'">str-phone-home</xsl:when>
       
   281           <xsl:when test="@type='work'">str-phone-work</xsl:when>
       
   282           <xsl:otherwise>str-phone</xsl:otherwise>
       
   283         </xsl:choose>
       
   284       </xsl:with-param>
       
   285     </xsl:call-template>
       
   286     <xsl:text>: </xsl:text>
       
   287     <xsl:apply-templates/>
       
   288   </block>
       
   289 </xsl:template>
       
   290 
       
   291 <!-- work -->
       
   292 <xsl:template match="work">
       
   293   <block keep-together="always">
       
   294     <xsl:apply-templates/>
       
   295   </block>
       
   296 </xsl:template>
       
   297 <xsl:template match="work/organism">
       
   298   <block xsl:use-attribute-sets="work-title-font"><xsl:apply-templates select="." mode="short"/></block>
       
   299 </xsl:template>
       
   300 
       
   301 <xsl:template match="work" mode="short">
       
   302   <block keep-together.within-page="always">
       
   303     <block xsl:use-attribute-sets="work-short-font"><xsl:apply-templates select="organism" mode="short"/></block>
       
   304     <list-block>
       
   305       <xsl:apply-templates select="post" mode="short"/>
       
   306     </list-block>
       
   307   </block>
       
   308 </xsl:template>
       
   309 <xsl:template match="post" mode="short">
       
   310   <list-item>
       
   311     <xsl:call-template name="list-label"/>
       
   312     <list-item-body start-indent="body-start()">
       
   313       <block>
       
   314       <xsl:if test="title">
       
   315         <xsl:apply-templates select="title" mode="short"/>
       
   316         <xsl:text>; </xsl:text>
       
   317       </xsl:if>
       
   318       <xsl:apply-templates select="duration" mode="short"/>
       
   319       <xsl:text>.</xsl:text>
       
   320       </block>
       
   321     </list-item-body>
       
   322   </list-item>
       
   323 </xsl:template>
       
   324 
       
   325 <!-- post -->
       
   326 <xsl:template match="post">
       
   327   <block keep-together.within-page="always">
       
   328     <table width="100%" table-layout="fixed" space-after="6pt">
       
   329       <table-column column-width="proportional-column-width(1)"/>
       
   330       <table-column column-width="proportional-column-width(1)"/>
       
   331       <table-body>
       
   332         <table-row>
       
   333           <table-cell>
       
   334             <xsl:apply-templates select="title" mode="title"/>
       
   335           </table-cell>
       
   336           <table-cell>
       
   337             <xsl:apply-templates select="supervisor|duration" mode="title"/>
       
   338           </table-cell>
       
   339         </table-row>
       
   340       </table-body>
       
   341     </table>
       
   342     <block margin-left="24pt">
       
   343       <xsl:apply-templates/>
       
   344     </block>
       
   345   </block>
       
   346 </xsl:template>
       
   347 <xsl:template match="post/supervisor|post/duration|post/title"/>
       
   348 <xsl:template match="post/title" mode="title">
       
   349   <block xsl:use-attribute-sets="post-title-font"><xsl:apply-templates/></block>
       
   350 </xsl:template>
       
   351 <xsl:template match="supervisor" mode="title">
       
   352   <block>
       
   353     <xsl:call-template name="gentext">
       
   354       <xsl:with-param name="string">str-supervisor</xsl:with-param>
       
   355     </xsl:call-template>
       
   356     <xsl:text>: </xsl:text>
       
   357     <xsl:apply-templates mode="fullname" select="."/>
       
   358   </block>
       
   359 </xsl:template>
       
   360 <xsl:template match="post/duration" mode="title">
       
   361   <block><xsl:apply-templates/></block>
       
   362 </xsl:template>
       
   363 
       
   364 <!-- study -->
       
   365 <xsl:template match="study" mode="short">
       
   366   <list-item>
       
   367     <xsl:call-template name="list-label"/>
       
   368     <list-item-body start-indent="body-start()">
       
   369       <block>
       
   370       <xsl:apply-templates select="studydomain"/>
       
   371       <xsl:text> (</xsl:text>
       
   372       <xsl:apply-templates select="duration"/>
       
   373       <xsl:text>), </xsl:text>
       
   374       <xsl:apply-templates select="organism" mode="short"/>
       
   375       <xsl:text>.</xsl:text>
       
   376       </block>
       
   377     </list-item-body>
       
   378   </list-item>
       
   379 </xsl:template>
       
   380 
       
   381 <!-- knowledge -->
       
   382 <xsl:template match="knowledge">
       
   383   <block keep-together.within-page="always">
       
   384     <block xsl:use-attribute-sets="knowledge-title-font">
       
   385       <xsl:apply-templates select="name"/>
       
   386     </block>
       
   387     <table width="100%" table-layout="fixed" margin-left="24pt">
       
   388       <table-column column-width="proportional-column-width(1)"
       
   389           number-columns-repeated="{count(knownlist)}"/>
       
   390       <table-header>
       
   391         <table-row>
       
   392           <xsl:apply-templates select="knownlist" mode="table-header"/>
       
   393         </table-row>
       
   394       </table-header>
       
   395       <table-body>
       
   396         <table-row>
       
   397           <xsl:apply-templates select="knownlist"/>
       
   398         </table-row>
       
   399       </table-body>
       
   400     </table>
       
   401   </block>
       
   402 </xsl:template>
       
   403 <xsl:template match="knownlist" mode="table-header">
       
   404   <table-cell>
       
   405     <block font-weight="bold">
       
   406       <xsl:call-template name="gentext">
       
   407         <xsl:with-param name="string">          
       
   408         <xsl:choose>
       
   409           <xsl:when test="@level='notions'" >str-level-notions</xsl:when>
       
   410           <xsl:when test="@level='learning'">str-level-learning</xsl:when>
       
   411           <xsl:otherwise>str-level-known</xsl:otherwise><!-- 'known' -->
       
   412         </xsl:choose>
       
   413         </xsl:with-param>
       
   414       </xsl:call-template>
       
   415       <xsl:text>:</xsl:text>
       
   416     </block>
       
   417   </table-cell>
       
   418 </xsl:template>
       
   419 <xsl:template match="knownlist">
       
   420   <table-cell>
       
   421     <block><xsl:apply-templates mode="short"/></block>
       
   422   </table-cell>
       
   423 </xsl:template>
       
   424 
       
   425 <xsl:template match="language">
       
   426   <block>
       
   427     <xsl:apply-templates/><xsl:text>: </xsl:text>
       
   428     <inline font-style="italic" keep-together.within-line="always">
       
   429       <xsl:call-template name="gentext">
       
   430         <xsl:with-param name="string">          
       
   431           <xsl:choose>
       
   432             <xsl:when test="@level='notions'" >str-lang-notions</xsl:when>
       
   433             <xsl:when test="@level='learning'">str-lang-learning</xsl:when>
       
   434             <xsl:when test="@level='functional'" >str-lang-functional</xsl:when>
       
   435             <xsl:otherwise>str-lang-known</xsl:otherwise><!-- 'known' -->
       
   436           </xsl:choose>
       
   437         </xsl:with-param>
       
   438       </xsl:call-template>
       
   439     </inline>
       
   440   </block>
       
   441 </xsl:template>
       
   442 
       
   443 <!-- project/concours -->
       
   444 <xsl:template match="project|concours" mode="short">
       
   445   <list-item>
       
   446     <xsl:call-template name="list-label"/>
       
   447     <list-item-body start-indent="body-start()">
       
   448       <block>
       
   449         <xsl:apply-templates select="organism" mode="short"/>
       
   450         <xsl:text> (</xsl:text>
       
   451         <xsl:apply-templates select="duration|year" mode="short"/>
       
   452         <xsl:text>);</xsl:text>
       
   453         <xsl:if test="description">
       
   454           <xsl:text> </xsl:text>
       
   455           <xsl:apply-templates select="description" mode="short"/>
       
   456         </xsl:if>
       
   457       </block>
       
   458     </list-item-body>
       
   459   </list-item>
       
   460 </xsl:template>
       
   461 
       
   462 <xsl:template match="interest" mode="short">
       
   463   <list-item>
       
   464     <xsl:call-template name="list-label"/>
       
   465     <list-item-body start-indent="body-start()">
       
   466       <block><xsl:apply-templates mode="short"/></block>
       
   467     </list-item-body>
       
   468   </list-item>
       
   469 </xsl:template>
       
   470 
       
   471 </xsl:stylesheet>