File: html.xsl

package info (click to toggle)
xml-resume-library 1.5.1-9
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 2,516 kB
  • ctags: 424
  • sloc: xml: 867; makefile: 126; sh: 47
file content (964 lines) | stat: -rw-r--r-- 30,465 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
<?xml version="1.0" encoding="UTF-8"?>
<!--
html.xsl
Transform XML resume into HTML.

Copyright (c) 2000-2002 Sean Kelly
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:

1. Redistributions of source code must retain the above copyright
   notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
   notice, this list of conditions and the following disclaimer in the
   documentation and/or other materials provided with the
   distribution.

THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

$Id: html.xsl,v 1.17 2002/11/10 20:48:58 brandondoyle Exp $
-->
<xsl:stylesheet xmlns:r="http://xmlresume.sourceforge.net/resume/0.0" 
 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"  version="1.0" 
 exclude-result-prefixes="r">
  <xsl:output method="html" omit-xml-declaration="yes" indent="no" encoding="UTF-8" 
   doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN" 
   doctype-system="http://www.w3.org/TR/xhtml1/DTD/strict.dtd"/>
   
  <xsl:strip-space elements="*"/>
  <xsl:include href="../params.xsl"/>
  <xsl:include href="../lib/common.xsl"/>
  <xsl:include href="../lib/string.xsl"/>
  <xsl:template name="Heading">
    <xsl:param name="Text">HEADING NOT DEFINED</xsl:param>
    <h2 class="heading">
      <span class="headingText">
        <xsl:copy-of select="$Text"/>
      </span>
    </h2>
  </xsl:template>
  <xsl:template match="/">
    <html>
      <head>
        <title>
          <xsl:apply-templates select="r:resume/r:header/r:name"/>
          <xsl:text> - </xsl:text>
          <xsl:value-of select="$resume.word"/>
        </title>
        <xsl:choose>
          <xsl:when test="$css.embed = 1">
            <style>
              <xsl:value-of select="document($css.href)"/>
            </style>
          </xsl:when>
          <xsl:otherwise>
            <link rel="stylesheet" type="text/css">
              <xsl:attribute name="href">
                <xsl:value-of select="$css.href"/>
              </xsl:attribute>
            </link>
          </xsl:otherwise>
        </xsl:choose>
        <xsl:apply-templates select="r:resume/r:keywords" mode="header"/>
      </head>
      <body>
        <xsl:apply-templates select="r:resume"/>
      </body>
    </html>
  </xsl:template>
  <xsl:template match="r:resume">
    <div class="resume">
      <xsl:apply-templates/>
    </div>
  </xsl:template>

<!-- Suppress the keywords in the main body of the document -->
  <xsl:template match="r:keywords"/>

<!-- But put them into the HTML header. -->
  <xsl:template match="r:keywords" mode="header">
    <meta name="keywords">
      <xsl:attribute name="content">
        <xsl:apply-templates select="r:keyword"/>
      </xsl:attribute>
    </meta>
  </xsl:template>
  <xsl:template match="r:keyword">
    <xsl:apply-templates/>
    <xsl:if test="position() != last()">
      <xsl:text>, </xsl:text>
    </xsl:if>
  </xsl:template>

<!-- Output your name and the word "Resume". -->
  <xsl:template match="r:header" mode="standard">
    <div class="header">
      <h1 class="nameHeading">
        <xsl:apply-templates select="r:name"/>
      </h1>
      <xsl:apply-templates select="r:address"/>
      <xsl:apply-templates select="r:contact"/>
    </div>
  </xsl:template>

<!-- Alternate formatting for the page header. -->
<!-- Display the name and contact information in a single centered block. -->
<!-- Since the 'align' attribute is deprecated, we rely on a CSS -->
<!-- style to center the header block. -->
  <xsl:template match="r:header" mode="centered">
    <div class="header" style="text-align: center">
      <h1 class="nameHeading">
        <xsl:apply-templates select="r:name"/>
      </h1>
      <xsl:apply-templates select="r:address"/>
      <xsl:apply-templates select="r:contact"/>
    </div>
  </xsl:template>

<!-- Contact information -->
  <xsl:template match="r:contact">
    <p>
      <xsl:apply-templates/>
    </p>
  </xsl:template>
  <xsl:template match="r:contact/r:phone">
    <xsl:call-template name="PhoneLocation">	
      <xsl:with-param name="Location" select="@location"/>
    </xsl:call-template>    
    <xsl:text>: </xsl:text>
    <xsl:apply-templates/>
    <br/>
  </xsl:template>
  <xsl:template match="r:contact/r:fax">
    <xsl:call-template name="FaxLocation">
      <xsl:with-param name="Location" select="@location"/>
    </xsl:call-template>
    <xsl:text>: </xsl:text>
    <xsl:apply-templates/>
    <br/>
  </xsl:template>
  <xsl:template match="r:contact/r:pager">
    <xsl:value-of select="$pager.word"/>
    <xsl:text>: </xsl:text>
    <xsl:apply-templates/>
    <br/>
  </xsl:template>
  <xsl:template match="r:contact/r:email">
    <xsl:value-of select="$email.word"/>
    <xsl:text>: </xsl:text>
    <a href="mailto:{.}">
      <xsl:apply-templates/>
    </a>
    <br/>
  </xsl:template>
  <xsl:template match="r:contact/r:url">
    <xsl:value-of select="$url.word"/>
    <xsl:text>: </xsl:text>
    <a href="{.}">
      <xsl:apply-templates/>
    </a>
    <br/>
  </xsl:template>
  <xsl:template match="r:contact/r:instantMessage">
    <xsl:call-template name="IMServiceName">
      <xsl:with-param name="Service" select="@service"/>
    </xsl:call-template>
    <xsl:text>: </xsl:text>
    <xsl:apply-templates/>
    <br/>
  </xsl:template>
<!-- Address, in various formats -->
  <xsl:template match="r:address" mode="free-form">
    <p class="address">
      <xsl:apply-templates/>
    </p>
  </xsl:template>
  <xsl:template match="r:address" mode="standard">
    <p class="address">
<!-- templates defined in address.xsl for setting standard fields -->
      <xsl:variable name="AdminDivision">
        <xsl:call-template name="AdminDivision"/>
      </xsl:variable>
      <xsl:variable name="CityDivision">
        <xsl:call-template name="CityDivision"/>
      </xsl:variable>
      <xsl:variable name="PostCode">
        <xsl:call-template name="PostCode"/>
      </xsl:variable>
      <xsl:for-each select="r:street">
        <xsl:apply-templates select="."/>
        <br/>
      </xsl:for-each>
      <xsl:if test="r:street2">
        <xsl:apply-templates select="r:street2"/>
        <br/>
      </xsl:if>
      <xsl:if test="string-length($CityDivision) &gt; 0">
        <xsl:value-of select="$CityDivision"/>
        <br/>
      </xsl:if>
      <xsl:apply-templates select="r:city"/>
      <xsl:if test="string-length($AdminDivision) &gt; 0">
        <xsl:text>, </xsl:text>
        <xsl:value-of select="$AdminDivision"/>
      </xsl:if>
      <xsl:if test="string-length($PostCode) &gt; 0">
        <xsl:text> </xsl:text>
        <xsl:value-of select="$PostCode"/>
      </xsl:if>
      <xsl:if test="r:country">
        <br/>
        <xsl:apply-templates select="r:country"/>
      </xsl:if>
    </p>
  </xsl:template>
  <xsl:template match="r:address" mode="european">
    <p class="address">
<!-- templates defined in address.xsl for setting standard fields -->
      <xsl:variable name="AdminDivision">
        <xsl:call-template name="AdminDivision"/>
      </xsl:variable>
      <xsl:variable name="CityDivision">
        <xsl:call-template name="CityDivision"/>
      </xsl:variable>
      <xsl:variable name="PostCode">
        <xsl:call-template name="PostCode"/>
      </xsl:variable>
      <xsl:for-each select="r:street">
        <xsl:apply-templates select="."/>
        <br/>
      </xsl:for-each>
      <xsl:if test="r:street2">
        <xsl:apply-templates select="r:street2"/>
        <br/>
      </xsl:if>
      <xsl:if test="string-length($CityDivision) &gt; 0">
        <xsl:value-of select="$CityDivision"/>
        <br/>
      </xsl:if>
      <xsl:if test="string-length($PostCode) &gt; 0">
        <xsl:value-of select="$PostCode"/>
        <xsl:text> </xsl:text>
      </xsl:if>
      <xsl:apply-templates select="r:city"/>
      <xsl:if test="string-length($AdminDivision) &gt; 0">
        <br/>
        <xsl:value-of select="$AdminDivision"/>
      </xsl:if>
      <xsl:if test="r:country">
        <br/>
        <xsl:apply-templates select="r:country"/>
      </xsl:if>
    </p>
  </xsl:template>
  <xsl:template match="r:address" mode="italian">
    <p class="address">
      <xsl:for-each select="r:street">
        <xsl:apply-templates select="."/>
        <br/>
      </xsl:for-each>
      <xsl:if test="r:street2">
        <xsl:apply-templates select="r:street2"/>
        <br/>
      </xsl:if>
      <xsl:if test="r:postalCode">
        <xsl:apply-templates select="r:postalCode"/>
        <xsl:text> </xsl:text>
      </xsl:if>
      <xsl:apply-templates select="r:city"/>
      <xsl:if test="r:province">
        <xsl:text> (</xsl:text>
        <xsl:apply-templates select="r:province"/>
        <xsl:text>)</xsl:text>
      </xsl:if>
      <xsl:if test="r:country">
        <br/>
        <xsl:apply-templates select="r:country"/>
      </xsl:if>
    </p>
  </xsl:template>
<!-- Preserve line breaks within a free format address -->
  <xsl:template match="r:address//text()">
    <xsl:call-template name="String-Replace">
      <xsl:with-param name="Text" select="."/>
      <xsl:with-param name="Search-For">
        <xsl:text>
</xsl:text>
      </xsl:with-param>
      <xsl:with-param name="Replace-With">
        <br/>
      </xsl:with-param>
    </xsl:call-template>
  </xsl:template>
<!-- Objective, with level 2 heading. -->
  <xsl:template match="r:objective">
    <xsl:call-template name="Heading">
      <xsl:with-param name="Text">
        <xsl:value-of select="$objective.word"/>
      </xsl:with-param>
    </xsl:call-template>
    <xsl:apply-templates/>
  </xsl:template>
<!-- Past jobs, with level 2 heading. -->
  <xsl:template match="r:history">
    <xsl:call-template name="Heading">
      <xsl:with-param name="Text">
        <xsl:value-of select="$history.word"/>
      </xsl:with-param>
    </xsl:call-template>
    <xsl:apply-templates select="r:job"/>
  </xsl:template>

<!-- Format each job -->
  <xsl:template match="r:job">
    <p class="job">
      <xsl:apply-templates select="r:jobtitle"/>
      <br/>
      <xsl:apply-templates select="r:employer"/>
      <xsl:apply-templates select="r:location"/>
      <br/>
      <xsl:apply-templates select="r:date|r:period"/>
    </p>
    <xsl:apply-templates select="r:description">
      <xsl:with-param name="css.class">jobDescription</xsl:with-param>
    </xsl:apply-templates>
    <xsl:if test="r:projects/r:project">
      <div class="projects">
        <p>
          <xsl:value-of select="$projects.word"/>
        </p>
        <xsl:apply-templates select="r:projects"/>
      </div>
    </xsl:if>
    <xsl:if test="r:achievements/r:achievement">
      <div class="achievements">
        <p>
          <xsl:value-of select="$achievements.word"/>
        </p>
        <xsl:apply-templates select="r:achievements"/>
      </div>
    </xsl:if>
  </xsl:template>

  <xsl:template match="r:location">
    <span class="location">
      <xsl:value-of select="$location.start"/>
      <xsl:apply-templates/>
      <xsl:value-of select="$location.end"/>
    </span>
  </xsl:template>
  <xsl:template match="r:institution">
    <span class="institution">
      <xsl:apply-templates/>
    </span>
  </xsl:template>

<!-- Format the projects section as a bullet list -->
  <xsl:template match="r:projects">
    <ul>
      <xsl:apply-templates select="r:project"/>
    </ul>
  </xsl:template>

<!-- Format a project as a bullet -->
  <xsl:template match="r:project">
      <li class="project">
        <xsl:if test="@title">
          <span class="projectTitle">
  	    <xsl:value-of select="@title"/>
  	    <xsl:value-of select="$title.separator"/>
          </span>
	</xsl:if>
        <xsl:apply-templates/>	
      </li>
  </xsl:template>


  <xsl:template match="r:jobtitle">
    <span class="jobTitle">
      <xsl:apply-templates/>
    </span>
  </xsl:template>

  <xsl:template match="r:employer">
    <span class="employer">
      <xsl:apply-templates/>
    </span>
  </xsl:template>

  <xsl:template match="r:organization">
    <span class="organization">
      <xsl:apply-templates/>
    </span>
  </xsl:template>

<!-- Format the period element -->
  <xsl:template match="r:period">
    <xsl:apply-templates select="r:from"/>-<xsl:apply-templates select="r:to"/>
   </xsl:template>

<!-- Format a date -->
   <xsl:template match="r:date" name="FormatDate">
     <xsl:if test="r:dayOfMonth">
       <xsl:apply-templates select="r:dayOfMonth"/>
       <xsl:text> </xsl:text>
     </xsl:if>
    <xsl:if test="r:month">
      <xsl:apply-templates select="r:month"/>
      <xsl:text> </xsl:text>
    </xsl:if>
    <xsl:apply-templates select="r:year"/>
  </xsl:template>
  <xsl:template match="r:present">
    <xsl:value-of select="$present.word"/>
  </xsl:template>

<!-- Format the achievements section as a bullet list *SE* -->
  <xsl:template match="r:achievements">
    <ul>
      <xsl:for-each select="r:achievement">
        <li class="achievement">
          <xsl:apply-templates/>
        </li>
      </xsl:for-each>
    </ul>
  </xsl:template>

<!-- Degrees and stuff -->
  <xsl:template match="r:academics">
    <xsl:call-template name="Heading">
      <xsl:with-param name="Text">
        <xsl:value-of select="$academics.word"/>
      </xsl:with-param>
    </xsl:call-template>
    <xsl:apply-templates select="r:degrees"/>
    <xsl:apply-templates select="r:note"/>
  </xsl:template>
  <xsl:template match="r:degrees">
    <ul class="degrees">
      <xsl:apply-templates select="r:degree"/>
    </ul>
    <xsl:apply-templates select="r:note"/>
  </xsl:template>
  <xsl:template match="r:note">
    <span class="note">
      <xsl:apply-templates/>
    </span>
  </xsl:template>

<!-- Format a degree -->
  <xsl:template match="r:degree">
    <li class="degree">
      <span class="degreeTitle">
        <xsl:apply-templates select="r:level"/>
        <xsl:if test="r:major">
          <xsl:text> </xsl:text>
          <xsl:value-of select="$in.word"/>
          <xsl:text> </xsl:text>
          <xsl:apply-templates select="r:major"/>
        </xsl:if>
      </span>
      <xsl:apply-templates select="r:minor"/>
      <xsl:if test="r:date|r:period">
        <xsl:text>, </xsl:text>
        <xsl:apply-templates select="r:date|r:period"/>
      </xsl:if>
      <xsl:if test="r:annotation">
        <xsl:text>. </xsl:text>
        <xsl:apply-templates select="r:annotation"/>
      </xsl:if>
      <xsl:if test="r:institution">
        <br/>
        <xsl:apply-templates select="r:institution"/>
        <xsl:apply-templates select="r:location"/>
      </xsl:if>
      <xsl:apply-templates select="r:gpa"/>
      <xsl:apply-templates select="r:subjects"/>
      <xsl:apply-templates select="r:projects"/>
    </li>
  </xsl:template>
<!-- Format a GPA -->
  <xsl:template match="r:gpa">
    <p>
      <span class="gpaPreamble">
        <xsl:choose>
          <xsl:when test="@type = 'major'">
            <xsl:value-of select="$major-gpa.word"/>
          </xsl:when>
          <xsl:otherwise>
            <xsl:value-of select="$overall-gpa.word"/>
          </xsl:otherwise>
        </xsl:choose>
      </span>
      <xsl:text>: </xsl:text>
      <xsl:apply-templates select="r:score"/>
      <xsl:if test="r:possible">
        <xsl:value-of select="$out-of.word"/>
        <xsl:apply-templates select="r:possible"/>
      </xsl:if>
      <xsl:if test="r:note">
        <xsl:text>. </xsl:text>
        <xsl:apply-templates select="r:note"/>
      </xsl:if>
    </p>
  </xsl:template>
<!-- Format the subjects as a table-->
  <xsl:template match="r:subjects" mode="table">
    <p class="subjectsHeading">
      <xsl:value-of select="$subjects.word"/>
    </p>
    <table class="subjects">
      <xsl:for-each select="r:subject">
        <tr>
          <td>
            <xsl:apply-templates select="r:title"/>
          </td>
          <xsl:if test="$subjects.result.display = 1">
            <td>
              <xsl:apply-templates select="r:result"/>
            </td>
          </xsl:if>
        </tr>
      </xsl:for-each>
    </table>
  </xsl:template>

<!-- Format the subjects as a list -->
  <xsl:template match="r:subjects" mode="comma">
    <p>
      <xsl:call-template name="Title">
	<xsl:with-param name="Title" select="$subjects.word"/>
        <xsl:with-param name="Separator" select="$title.separator"/>
      </xsl:call-template>
      <xsl:apply-templates select="r:subject" mode="comma"/>
      <xsl:value-of select="$subjects.suffix"/>
    </p>
  </xsl:template>

<!-- Format a subject -->
  <xsl:template match="r:subject" mode="comma">
    <xsl:value-of select="normalize-space(r:title)"/>
    <xsl:if test="$subjects.result.display = 1">
      <xsl:if test="r:result">
        <xsl:value-of select="$subjects.result.start"/>
        <xsl:value-of select="normalize-space(r:result)"/>
        <xsl:value-of select="$subjects.result.end"/>
      </xsl:if>
    </xsl:if>
    <xsl:if test="following-sibling::r:subject">
      <xsl:value-of select="$subjects.separator"/>
    </xsl:if>
  </xsl:template>

<!-- Format the open-ended skills -->
  <xsl:template match="r:skillarea">
    <xsl:call-template name="Heading">
      <xsl:with-param name="Text">
        <xsl:apply-templates select="r:title"/>
      </xsl:with-param>
    </xsl:call-template>
    <xsl:apply-templates select="r:skillset"/>
  </xsl:template>

<!-- Format a skillset -->
  <xsl:template match="r:skillset">
    <xsl:choose>
      <xsl:when test="$skills.format = 'comma'">
        <p>
          <span class="skillSetTitle">
            <xsl:apply-templates select="r:title">
	      <xsl:with-param name="Separator" select="$title.separator"/>
	    </xsl:apply-templates>
	  </span>
          <xsl:if test="r:skill">
            <span class="skills">
              <xsl:apply-templates select="r:skill" mode="comma"/>
              <xsl:value-of select="$skills.suffix"/>
            </span>
          </xsl:if>
<!-- The following block should be removed in a future version. -->
          <xsl:if test="r:skills">
            <span class="skills">
              <xsl:apply-templates select="r:skills" mode="comma"/>
            </span>
          </xsl:if>
        </p>
      </xsl:when>
      <xsl:otherwise>
	<h3 class="skillsetTitle">
          <xsl:apply-templates select="r:title"/>
	</h3>
        <xsl:if test="r:skill">
          <ul class="skills">
            <xsl:apply-templates select="r:skill" mode="bullet"/>
          </ul>
        </xsl:if>
<!-- The following block should be removed in a future version. -->
        <xsl:if test="r:skills">
          <ul class="skills">
            <xsl:apply-templates select="r:skills" mode="bullet"/>
          </ul>
        </xsl:if>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

<!-- Format a skill as part of a comma-separated list -->
  <xsl:template match="r:skill" mode="comma">
    <xsl:apply-templates/>
    <xsl:apply-templates select="@level"/>
    <xsl:if test="following-sibling::r:skill">
      <xsl:value-of select="$skills.separator"/>
    </xsl:if>
  </xsl:template>

<!-- Format a skill as part of a bulleted list -->
  <xsl:template match="r:skill" mode="bullet">
    <li class="skill">
      <xsl:apply-templates/>
      <xsl:apply-templates select="@level"/>
    </li>
  </xsl:template>

<!-- Format a skill level -->
  <xsl:template match="r:skill/@level">
    <xsl:if test="$skills.level.display = 1">
      <xsl:value-of select="$skills.level.start"/>
      <xsl:value-of select="normalize-space(.)"/>
      <xsl:value-of select="$skills.level.end"/>
    </xsl:if>
  </xsl:template>

<!-- Format publications -->
  <xsl:template match="r:pubs">
    <xsl:call-template name="Heading">
      <xsl:with-param name="Text">
        <xsl:value-of select="$publications.word"/>
      </xsl:with-param>
    </xsl:call-template>
    <ul class="pubs">
      <xsl:apply-templates select="r:pub"/>
    </ul>
  </xsl:template>
<!-- Format a single publication -->
  <xsl:template match="r:pub">
    <li class="pub">
      <xsl:call-template name="FormatPub"/>
    </li>
  </xsl:template>
<!-- Memberships, with level 2 heading. -->
  <xsl:template match="r:memberships">
    <xsl:call-template name="Heading">
      <xsl:with-param name="Text">
        <xsl:apply-templates select="r:title"/>
      </xsl:with-param>
    </xsl:call-template>
    <ul>
      <xsl:apply-templates select="r:membership"/>
    </ul>
  </xsl:template>

<!-- A single membership. -->
  <xsl:template match="r:membership">
    <li>
      <xsl:if test="r:title">
	<div class="membershipTitle">
          <xsl:call-template name="Title">
	    <xsl:with-param name="Title" select="r:title"/>
	  </xsl:call-template>
	</div>
      </xsl:if>
      <xsl:if test="r:organization">
        <xsl:apply-templates select="r:organization"/>
        <xsl:apply-templates select="r:location"/>
        <br/>
      </xsl:if>
      <xsl:if test="r:date|r:period">
        <xsl:apply-templates select="r:date|r:period"/>
        <br/>
      </xsl:if>
      <xsl:apply-templates select="r:description">
        <xsl:with-param name="css.class">membershipDescription</xsl:with-param>
      </xsl:apply-templates>
    </li>
  </xsl:template>

<!-- Format interests section. -->
  <xsl:template match="r:interests">
    <xsl:call-template name="Heading">
      <xsl:with-param name="Text">
        <xsl:call-template name="Title">
          <xsl:with-param name="Title" select="$interests.word"/>
        </xsl:call-template>
      </xsl:with-param>
    </xsl:call-template>
    <ul>
      <xsl:apply-templates select="r:interest"/>
    </ul>
  </xsl:template>

<!-- A single interest. -->
  <xsl:template match="r:interest">
    <li>
      <span class="interestTitle">
        <xsl:apply-templates select="r:title"/>
      </span>
<!-- Append period to title if followed by a single-line description -->
      <xsl:if test="$interest.description.format = 'single-line' and r:description">
        <xsl:text>. </xsl:text>
      </xsl:if>
      <xsl:apply-templates select="r:description"/>
    </li>
  </xsl:template>
<!-- Format an interest description -->
  <xsl:template match="r:interest/r:description">
    <xsl:call-template name="r:description">
      <xsl:with-param name="paragraph.format" select="$interest.description.format"/>
      <xsl:with-param name="css.class">interestDescription</xsl:with-param>
    </xsl:call-template>
  </xsl:template>
<!-- Format security clearance section. -->
  <xsl:template match="r:clearances">
    <xsl:call-template name="Heading">
      <xsl:with-param name="Text">
        <xsl:call-template name="Title">
          <xsl:with-param name="Title" select="$security-clearances.word"/>
        </xsl:call-template>
      </xsl:with-param>
    </xsl:call-template>
    <ul>
      <xsl:apply-templates select="r:clearance"/>
    </ul>
  </xsl:template>
<!-- Format a single security clearance. -->
  <xsl:template match="r:clearance">
    <li class="clearance">
      <span class="clearanceLevel">
        <xsl:apply-templates select="r:level"/>
      </span>
      <xsl:if test="r:organization">
        <xsl:text>, </xsl:text>
        <xsl:apply-templates select="r:organization"/>
      </xsl:if>
      <xsl:if test="r:date|r:period">
        <xsl:text>, </xsl:text>
        <xsl:apply-templates select="r:date|r:period"/>
      </xsl:if>
      <xsl:if test="r:note">
        <xsl:text>. </xsl:text>
        <xsl:apply-templates select="r:note"/>
      </xsl:if>
    </li>
  </xsl:template>
<!-- Format awards section. -->
  <xsl:template match="r:awards">
    <xsl:call-template name="Heading">
      <xsl:with-param name="Text">
        <xsl:call-template name="Title">
          <xsl:with-param name="Title" select="$awards.word"/>
        </xsl:call-template>
      </xsl:with-param>
    </xsl:call-template>
    <ul>
      <xsl:apply-templates select="r:award"/>
    </ul>
  </xsl:template>
<!-- A single award. -->
  <xsl:template match="r:award">
    <li class="award">
      <span class="awardTitle">
        <xsl:apply-templates select="r:title"/>
      </span>
      <xsl:if test="r:organization">
        <xsl:text>, </xsl:text>
      </xsl:if>
      <xsl:apply-templates select="r:organization"/>
      <xsl:if test="r:date|r:period">
        <xsl:text>, </xsl:text>
      </xsl:if>
      <xsl:apply-templates select="r:date|r:period"/>
      <xsl:apply-templates select="r:description"/>
    </li>
  </xsl:template>
<!-- Format the misc info -->
  <xsl:template match="r:misc">
    <xsl:call-template name="Heading">
      <xsl:with-param name="Text">
        <xsl:value-of select="$miscellany.word"/>
      </xsl:with-param>
    </xsl:call-template>
    <xsl:apply-templates/>
  </xsl:template>
<!-- Format the "last modified" date -->
  <xsl:template match="r:lastModified">
    <p class="lastModified">
      <xsl:value-of select="$last-modified.phrase"/>
      <xsl:text> </xsl:text>
      <xsl:apply-templates/>
      <xsl:text>.</xsl:text>
    </p>
  </xsl:template>
<!-- Format the legalese -->
  <xsl:template match="r:copyright">
    <div class="copyright">
      <xsl:value-of select="$copyright.word"/>
      <xsl:text> </xsl:text>
      <xsl:apply-templates select="r:year"/>
      <xsl:text> </xsl:text>
      <xsl:value-of select="$by.word"/>
      <xsl:text> </xsl:text>
      <xsl:if test="r:name">
        <xsl:apply-templates select="r:name"/>
      </xsl:if>
      <xsl:if test="not(r:name)">
        <xsl:apply-templates select="/r:resume/r:header/r:name"/>
      </xsl:if>
      <xsl:text>. </xsl:text>
      <xsl:apply-templates select="r:legalnotice"/>
    </div>
  </xsl:template>
<!-- para -> p -->
  <xsl:template match="r:para">
    <p class="para">
      <xsl:apply-templates/>
    </p>
  </xsl:template>
<!-- emphasis -> strong -->
  <xsl:template match="r:emphasis">
    <strong class="emphasis">
      <xsl:apply-templates/>
    </strong>
  </xsl:template>
<!-- url -> monospace along with href -->
  <xsl:template match="r:url" name="FormatUrl">
    <a class="urlA">
      <xsl:attribute name="href">
        <xsl:apply-templates/>
      </xsl:attribute>
      <xsl:apply-templates/>
    </a>
  </xsl:template>
<!-- link -> make link from href attribute -->
  <xsl:template match="r:link">
    <a class="linkA">
      <xsl:attribute name="href">
        <xsl:apply-templates select="@href"/>
      </xsl:attribute>
      <xsl:apply-templates/>
    </a>
  </xsl:template>
<!-- citation -> cite -->
  <xsl:template match="r:citation">
    <cite class="citation">
      <xsl:apply-templates/>
    </cite>
  </xsl:template>

<!-- Format the referees -->
  <xsl:template match="r:referees">
    <xsl:call-template name="Heading">
      <xsl:with-param name="Text">
        <xsl:value-of select="$referees.word"/>
      </xsl:with-param>
    </xsl:call-template>
    <xsl:choose>
      <xsl:when test="$referees.display = 1">
        <xsl:choose>
	  <xsl:when test="$referees.layout = 'compact'">
            <table class="referees">
              <xsl:apply-templates select="r:referee" mode="compact"/>
            </table>
          </xsl:when>
	  <xsl:otherwise>
	    <div class="referees">
	      <xsl:apply-templates select="r:referee" mode="standard"/>
	    </div>
	  </xsl:otherwise>
	</xsl:choose>
      </xsl:when>
      <xsl:otherwise>
        <p>
          <xsl:value-of select="$referees.hidden.phrase"/>
        </p>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <xsl:template match="r:referee" mode="standard">
    <div class="referee">
      <div class="refereeName">
        <xsl:apply-templates select="r:name"/>
        <xsl:if test="r:title or r:organization">
          <div>
            <xsl:apply-templates select="r:title"/>
            <xsl:if test="r:title and r:organization">
              <xsl:text>, </xsl:text>
            </xsl:if>
            <xsl:apply-templates select="r:organization"/>
          </div>
        </xsl:if>
      </div>
      <div class="refereeAddress"><xsl:apply-templates select="r:address"/></div>
      <div class="refereeContact"><xsl:apply-templates select="r:contact"/></div>
    </div>
  </xsl:template>

  <xsl:template match="r:referee" mode="compact">
    <tr>
      <td>
        <div class="refereeName">
          <xsl:apply-templates select="r:name"/>
          <xsl:if test="r:title or r:organization">
            <div>
              <xsl:apply-templates select="r:title"/>
              <xsl:if test="r:title and r:organization">
                <xsl:text>, </xsl:text>
              </xsl:if>
              <xsl:apply-templates select="r:organization"/>
            </div>
          </xsl:if>
        </div>
        <div class="refereeContact"><xsl:apply-templates select="r:contact"/></div>
      </td>
      <td class="refereeAddress"><xsl:apply-templates select="r:address"/></td>
    </tr>
  </xsl:template>

<!-- Format a description as either a block (div) or a single line (span) -->
  <xsl:template match="r:description" name="r:description">
<!-- Possible values: 'block', 'single-line' -->
    <xsl:param name="paragraph.format">block</xsl:param>
    <xsl:param name="css.class">description</xsl:param>
    <xsl:choose>
      <xsl:when test="$paragraph.format = 'single-line'">
        <span class="{$css.class}">
          <xsl:for-each select="r:para">
            <xsl:apply-templates/>
            <xsl:if test="following-sibling::*">
              <xsl:value-of select="$description.para.separator"/>
            </xsl:if>
          </xsl:for-each>
        </span>
      </xsl:when>
      <xsl:otherwise>
<!-- block -->
        <div class="{$css.class}">
          <xsl:apply-templates/>
        </div>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>
</xsl:stylesheet>