Revert "We are using a field PrescriptionGUID, obtained from NewCrop, to check if...
[openemr.git] / ccr / stylesheet / cda.xsl
blob4861d80f6b1de49faba15212860c4312deaedb60
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!--
3 Title: CDA XSL StyleSheet
4 Original Filename: cda.xsl
5 Version: 3.0
6 Revision History: 08/12/08 Jingdong Li updated
7 Revision History: 12/11/09 KH updated
8 Revision History: 03/30/10 Jingdong Li updated.
9 Revision History: 08/25/10 Jingdong Li updated
10 Revision History: 09/17/10 Jingdong Li updated
11 Revision History: 01/05/11 Jingdong Li updated
12 Specification: ANSI/HL7 CDAR2
13 The current version and documentation are available at http://www.lantanagroup.com/resources/tools/.
14 We welcome feedback and contributions to tools@lantanagroup.com
15 The stylesheet is the cumulative work of several developers; the most significant prior milestones were the foundation work from HL7
16 Germany and Finland (Tyylitiedosto) and HL7 US (Calvin Beebe), and the presentation approach from Tony Schaller, medshare GmbH provided at IHIC 2009.
17 -->
18 <!-- LICENSE INFORMATION
19 Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
20 You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
21 -->
22 <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:n1="urn:hl7-org:v3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
23 <xsl:output method="html" indent="yes" version="4.01" encoding="ISO-8859-1" doctype-system="http://www.w3.org/TR/html4/strict.dtd" doctype-public="-//W3C//DTD HTML 4.01//EN"/>
24 <!-- global variable title -->
25 <xsl:variable name="title">
26 <xsl:choose>
27 <xsl:when test="string-length(/n1:ClinicalDocument/n1:title) &gt;= 1">
28 <xsl:value-of select="/n1:ClinicalDocument/n1:title"/>
29 </xsl:when>
30 <xsl:when test="/n1:ClinicalDocument/n1:code/@displayName">
31 <xsl:value-of select="/n1:ClinicalDocument/n1:code/@displayName"/>
32 </xsl:when>
33 <xsl:otherwise>
34 <xsl:text>Clinical Document</xsl:text>
35 </xsl:otherwise>
36 </xsl:choose>
37 </xsl:variable>
38 <!-- Main -->
39 <xsl:template match="/">
40 <xsl:apply-templates select="n1:ClinicalDocument"/>
41 </xsl:template>
42 <!-- produce browser rendered, human readable clinical document -->
43 <xsl:template match="n1:ClinicalDocument">
44 <html>
45 <head>
46 <xsl:comment> Do NOT edit this HTML directly: it was generated via an XSLT transformation from a CDA Release 2 XML document. </xsl:comment>
47 <title>
48 <xsl:value-of select="$title"/>
49 </title>
50 <xsl:call-template name="addCSS"/>
51 </head>
52 <body>
53 <h1 class="h1center">
54 <xsl:value-of select="$title"/>
55 </h1>
56 <!-- START display top portion of clinical document -->
57 <xsl:call-template name="recordTarget"/>
58 <xsl:call-template name="documentGeneral"/>
59 <xsl:call-template name="documentationOf"/>
60 <xsl:call-template name="author"/>
61 <xsl:call-template name="componentof"/>
62 <xsl:call-template name="participant"/>
63 <xsl:call-template name="dataEnterer"/>
64 <xsl:call-template name="authenticator"/>
65 <xsl:call-template name="informant"/>
66 <xsl:call-template name="informationRecipient"/>
67 <xsl:call-template name="legalAuthenticator"/>
68 <xsl:call-template name="custodian"/>
69 <!-- END display top portion of clinical document -->
70 <!-- produce table of contents -->
71 <xsl:if test="not(//n1:nonXMLBody)">
72 <xsl:if test="count(/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component[n1:section]) &gt; 1">
73 <xsl:call-template name="make-tableofcontents"/>
74 </xsl:if>
75 </xsl:if>
76 <hr align="left" color="teal" size="2" width="80%"/>
77 <!-- produce human readable document content -->
78 <xsl:apply-templates select="n1:component/n1:structuredBody|n1:component/n1:nonXMLBody"/>
79 <br/>
80 <br/>
81 </body>
82 </html>
83 </xsl:template>
84 <!-- generate table of contents -->
85 <xsl:template name="make-tableofcontents">
86 <h2>
87 <a name="toc">Table of Contents</a>
88 </h2>
89 <ul>
90 <xsl:for-each select="n1:component/n1:structuredBody/n1:component/n1:section/n1:title">
91 <li>
92 <a href="#{generate-id(.)}">
93 <xsl:value-of select="."/>
94 </a>
95 </li>
96 </xsl:for-each>
97 </ul>
98 </xsl:template>
99 <!-- header elements -->
100 <xsl:template name="documentGeneral">
101 <table class="header_table">
102 <tbody>
103 <tr>
104 <td width="20%" bgcolor="#3399ff">
105 <span class="td_label">
106 <xsl:text>Document Id</xsl:text>
107 </span>
108 </td>
109 <td width="80%">
110 <xsl:call-template name="show-id">
111 <xsl:with-param name="id" select="n1:id"/>
112 </xsl:call-template>
113 </td>
114 </tr>
115 <tr>
116 <td width="20%" bgcolor="#3399ff">
117 <span class="td_label">
118 <xsl:text>Document Created:</xsl:text>
119 </span>
120 </td>
121 <td width="80%">
122 <xsl:call-template name="show-time">
123 <xsl:with-param name="datetime" select="n1:effectiveTime"/>
124 </xsl:call-template>
125 </td>
126 </tr>
127 </tbody>
128 </table>
129 </xsl:template>
130 <!-- confidentiality -->
131 <xsl:template name="confidentiality">
132 <table class="header_table">
133 <tbody>
134 <td width="20%" bgcolor="#3399ff">
135 <xsl:text>Confidentiality</xsl:text>
136 </td>
137 <td width="80%">
138 <xsl:choose>
139 <xsl:when test="n1:confidentialityCode/@code = &apos;N&apos;">
140 <xsl:text>Normal</xsl:text>
141 </xsl:when>
142 <xsl:when test="n1:confidentialityCode/@code = &apos;R&apos;">
143 <xsl:text>Restricted</xsl:text>
144 </xsl:when>
145 <xsl:when test="n1:confidentialityCode/@code = &apos;V&apos;">
146 <xsl:text>Very restricted</xsl:text>
147 </xsl:when>
148 </xsl:choose>
149 <xsl:if test="n1:confidentialityCode/n1:originalText">
150 <xsl:text> </xsl:text>
151 <xsl:value-of select="n1:confidentialityCode/n1:originalText"/>
152 </xsl:if>
153 </td>
154 </tbody>
155 </table>
156 </xsl:template>
157 <!-- author -->
158 <xsl:template name="author">
159 <xsl:if test="n1:author">
160 <table class="header_table">
161 <tbody>
162 <xsl:for-each select="n1:author/n1:assignedAuthor">
163 <tr>
164 <td width="20%" bgcolor="#3399ff">
165 <span class="td_label">
166 <xsl:text>Author</xsl:text>
167 </span>
168 </td>
169 <td width="80%">
170 <xsl:choose>
171 <xsl:when test="n1:assignedPerson/n1:name">
172 <xsl:call-template name="show-name">
173 <xsl:with-param name="name" select="n1:assignedPerson/n1:name"/>
174 </xsl:call-template>
175 <xsl:if test="n1:representedOrganization">
176 <xsl:text>, </xsl:text>
177 <xsl:call-template name="show-name">
178 <xsl:with-param name="name" select="n1:representedOrganization/n1:name"/>
179 </xsl:call-template>
180 </xsl:if>
181 </xsl:when>
182 <xsl:when test="n1:assignedAuthoringDevice/n1:softwareName">
183 <xsl:value-of select="n1:assignedAuthoringDevice/n1:softwareName"/>
184 </xsl:when>
185 <xsl:when test="n1:representedOrganization">
186 <xsl:call-template name="show-name">
187 <xsl:with-param name="name" select="n1:representedOrganization/n1:name"/>
188 </xsl:call-template>
189 </xsl:when>
190 <xsl:otherwise>
191 <xsl:for-each select="n1:id">
192 <xsl:call-template name="show-id"/>
193 <br/>
194 </xsl:for-each>
195 </xsl:otherwise>
196 </xsl:choose>
197 </td>
198 </tr>
199 <xsl:if test="n1:addr | n1:telecom">
200 <tr>
201 <td bgcolor="#3399ff">
202 <span class="td_label">
203 <xsl:text>Contact info</xsl:text>
204 </span>
205 </td>
206 <td>
207 <xsl:call-template name="show-contactInfo">
208 <xsl:with-param name="contact" select="."/>
209 </xsl:call-template>
210 </td>
211 </tr>
212 </xsl:if>
213 </xsl:for-each>
214 </tbody>
215 </table>
216 </xsl:if>
217 </xsl:template>
218 <!-- authenticator -->
219 <xsl:template name="authenticator">
220 <xsl:if test="n1:authenticator">
221 <table class="header_table">
222 <tbody>
223 <tr>
224 <xsl:for-each select="n1:authenticator">
225 <tr>
226 <td width="20%" bgcolor="#3399ff">
227 <span class="td_label">
228 <xsl:text>Signed </xsl:text>
229 </span>
230 </td>
231 <td width="80%">
232 <xsl:call-template name="show-name">
233 <xsl:with-param name="name" select="n1:assignedEntity/n1:assignedPerson/n1:name"/>
234 </xsl:call-template>
235 <xsl:text> at </xsl:text>
236 <xsl:call-template name="show-time">
237 <xsl:with-param name="date" select="n1:time"/>
238 </xsl:call-template>
239 </td>
240 </tr>
241 <xsl:if test="n1:assignedEntity/n1:addr | n1:assignedEntity/n1:telecom">
242 <tr>
243 <td bgcolor="#3399ff">
244 <span class="td_label">
245 <xsl:text>Contact info</xsl:text>
246 </span>
247 </td>
248 <td width="80%">
249 <xsl:call-template name="show-contactInfo">
250 <xsl:with-param name="contact" select="n1:assignedEntity"/>
251 </xsl:call-template>
252 </td>
253 </tr>
254 </xsl:if>
255 </xsl:for-each>
256 </tr>
257 </tbody>
258 </table>
259 </xsl:if>
260 </xsl:template>
261 <!-- legalAuthenticator -->
262 <xsl:template name="legalAuthenticator">
263 <xsl:if test="n1:legalAuthenticator">
264 <table class="header_table">
265 <tbody>
266 <tr>
267 <td width="20%" bgcolor="#3399ff">
268 <span class="td_label">
269 <xsl:text>Legal authenticator</xsl:text>
270 </span>
271 </td>
272 <td width="80%">
273 <xsl:call-template name="show-assignedEntity">
274 <xsl:with-param name="asgnEntity" select="n1:legalAuthenticator/n1:assignedEntity"/>
275 </xsl:call-template>
276 <xsl:text> </xsl:text>
277 <xsl:call-template name="show-sig">
278 <xsl:with-param name="sig" select="n1:legalAuthenticator/n1:signatureCode"/>
279 </xsl:call-template>
280 <xsl:if test="n1:legalAuthenticator/n1:time/@value">
281 <xsl:text> at </xsl:text>
282 <xsl:call-template name="show-time">
283 <xsl:with-param name="datetime" select="n1:legalAuthenticator/n1:time"/>
284 </xsl:call-template>
285 </xsl:if>
286 </td>
287 </tr>
288 <xsl:if test="n1:legalAuthenticator/n1:assignedEntity/n1:addr | n1:legalAuthenticator/n1:assignedEntity/n1:telecom">
289 <tr>
290 <td bgcolor="#3399ff">
291 <span class="td_label">
292 <xsl:text>Contact info</xsl:text>
293 </span>
294 </td>
295 <td>
296 <xsl:call-template name="show-contactInfo">
297 <xsl:with-param name="contact" select="n1:legalAuthenticator/n1:assignedEntity"/>
298 </xsl:call-template>
299 </td>
300 </tr>
301 </xsl:if>
302 </tbody>
303 </table>
304 </xsl:if>
305 </xsl:template>
306 <!-- dataEnterer -->
307 <xsl:template name="dataEnterer">
308 <xsl:if test="n1:dataEnterer">
309 <table class="header_table">
310 <tbody>
311 <tr>
312 <td width="20%" bgcolor="#3399ff">
313 <span class="td_label">
314 <xsl:text>Entered by</xsl:text>
315 </span>
316 </td>
317 <td width="80%">
318 <xsl:call-template name="show-assignedEntity">
319 <xsl:with-param name="asgnEntity" select="n1:dataEnterer/n1:assignedEntity"/>
320 </xsl:call-template>
321 </td>
322 </tr>
323 <xsl:if test="n1:dataEnterer/n1:assignedEntity/n1:addr | n1:dataEnterer/n1:assignedEntity/n1:telecom">
324 <tr>
325 <td bgcolor="#3399ff">
326 <span class="td_label">
327 <xsl:text>Contact info</xsl:text>
328 </span>
329 </td>
330 <td>
331 <xsl:call-template name="show-contactInfo">
332 <xsl:with-param name="contact" select="n1:dataEnterer/n1:assignedEntity"/>
333 </xsl:call-template>
334 </td>
335 </tr>
336 </xsl:if>
337 </tbody>
338 </table>
339 </xsl:if>
340 </xsl:template>
341 <!-- componentOf -->
342 <xsl:template name="componentof">
343 <xsl:if test="n1:componentOf">
344 <table class="header_table">
345 <tbody>
346 <xsl:for-each select="n1:componentOf/n1:encompassingEncounter">
347 <xsl:if test="n1:id">
348 <tr>
349 <xsl:choose>
350 <xsl:when test="n1:code">
351 <td width="20%" bgcolor="#3399ff">
352 <span class="td_label">
353 <xsl:text>Encounter Id</xsl:text>
354 </span>
355 </td>
356 <td width="30%">
357 <xsl:call-template name="show-id">
358 <xsl:with-param name="id" select="n1:id"/>
359 </xsl:call-template>
360 </td>
361 <td width="15%" bgcolor="#3399ff">
362 <span class="td_label">
363 <xsl:text>Encounter Type</xsl:text>
364 </span>
365 </td>
366 <td>
367 <xsl:call-template name="show-code">
368 <xsl:with-param name="code" select="n1:code"/>
369 </xsl:call-template>
370 </td>
371 </xsl:when>
372 <xsl:otherwise>
373 <td width="20%" bgcolor="#3399ff">
374 <span class="td_label">
375 <xsl:text>Encounter Id</xsl:text>
376 </span>
377 </td>
378 <td>
379 <xsl:call-template name="show-id">
380 <xsl:with-param name="id" select="n1:id"/>
381 </xsl:call-template>
382 </td>
383 </xsl:otherwise>
384 </xsl:choose>
385 </tr>
386 </xsl:if>
387 <tr>
388 <td width="20%" bgcolor="#3399ff">
389 <span class="td_label">
390 <xsl:text>Encounter Date</xsl:text>
391 </span>
392 </td>
393 <td colspan="3">
394 <xsl:if test="n1:effectiveTime">
395 <xsl:choose>
396 <xsl:when test="n1:effectiveTime/@value">
397 <xsl:text>&#160;at&#160;</xsl:text>
398 <xsl:call-template name="show-time">
399 <xsl:with-param name="datetime" select="n1:effectiveTime"/>
400 </xsl:call-template>
401 </xsl:when>
402 <xsl:when test="n1:effectiveTime/n1:low">
403 <xsl:text>&#160;From&#160;</xsl:text>
404 <xsl:call-template name="show-time">
405 <xsl:with-param name="datetime" select="n1:effectiveTime/n1:low"/>
406 </xsl:call-template>
407 <xsl:if test="n1:effectiveTime/n1:high">
408 <xsl:text> to </xsl:text>
409 <xsl:call-template name="show-time">
410 <xsl:with-param name="datetime" select="n1:effectiveTime/n1:high"/>
411 </xsl:call-template>
412 </xsl:if>
413 </xsl:when>
414 </xsl:choose>
415 </xsl:if>
416 </td>
417 </tr>
418 <xsl:if test="n1:location/n1:healthCareFacility">
419 <tr>
420 <td width="20%" bgcolor="#3399ff">
421 <span class="td_label">
422 <xsl:text>Encounter Location</xsl:text>
423 </span>
424 </td>
425 <td colspan="3">
426 <xsl:choose>
427 <xsl:when test="n1:location/n1:healthCareFacility/n1:location/n1:name">
428 <xsl:call-template name="show-name">
429 <xsl:with-param name="name" select="n1:location/n1:healthCareFacility/n1:location/n1:name"/>
430 </xsl:call-template>
431 <xsl:for-each select="n1:location/n1:healthCareFacility/n1:serviceProviderOrganization/n1:name">
432 <xsl:text> of </xsl:text>
433 <xsl:call-template name="show-name">
434 <xsl:with-param name="name" select="n1:location/n1:healthCareFacility/n1:serviceProviderOrganization/n1:name"/>
435 </xsl:call-template>
436 </xsl:for-each>
437 </xsl:when>
438 <xsl:when test="n1:location/n1:healthCareFacility/n1:code">
439 <xsl:call-template name="show-code">
440 <xsl:with-param name="code" select="n1:location/n1:healthCareFacility/n1:code"/>
441 </xsl:call-template>
442 </xsl:when>
443 <xsl:otherwise>
444 <xsl:if test="n1:location/n1:healthCareFacility/n1:id">
445 <xsl:text>id: </xsl:text>
446 <xsl:for-each select="n1:location/n1:healthCareFacility/n1:id">
447 <xsl:call-template name="show-id">
448 <xsl:with-param name="id" select="."/>
449 </xsl:call-template>
450 </xsl:for-each>
451 </xsl:if>
452 </xsl:otherwise>
453 </xsl:choose>
454 </td>
455 </tr>
456 </xsl:if>
457 <xsl:if test="n1:responsibleParty">
458 <tr>
459 <td width="20%" bgcolor="#3399ff">
460 <span class="td_label">
461 <xsl:text>Responsible party</xsl:text>
462 </span>
463 </td>
464 <td colspan="3">
465 <xsl:call-template name="show-assignedEntity">
466 <xsl:with-param name="asgnEntity" select="n1:responsibleParty/n1:assignedEntity"/>
467 </xsl:call-template>
468 </td>
469 </tr>
470 </xsl:if>
471 <xsl:if test="n1:responsibleParty/n1:assignedEntity/n1:addr | n1:responsibleParty/n1:assignedEntity/n1:telecom">
472 <tr>
473 <td width="20%" bgcolor="#3399ff">
474 <span class="td_label">
475 <xsl:text>Contact info</xsl:text>
476 </span>
477 </td>
478 <td colspan="3">
479 <xsl:call-template name="show-contactInfo">
480 <xsl:with-param name="contact" select="n1:responsibleParty/n1:assignedEntity"/>
481 </xsl:call-template>
482 </td>
483 </tr>
484 </xsl:if>
485 </xsl:for-each>
486 </tbody>
487 </table>
488 </xsl:if>
489 </xsl:template>
490 <!-- custodian -->
491 <xsl:template name="custodian">
492 <xsl:if test="n1:custodian">
493 <table class="header_table">
494 <tbody>
495 <tr>
496 <td width="20%" bgcolor="#3399ff">
497 <span class="td_label">
498 <xsl:text>Document maintained by</xsl:text>
499 </span>
500 </td>
501 <td width="80%">
502 <xsl:choose>
503 <xsl:when test="n1:custodian/n1:assignedCustodian/n1:representedCustodianOrganization/n1:name">
504 <xsl:call-template name="show-name">
505 <xsl:with-param name="name" select="n1:custodian/n1:assignedCustodian/n1:representedCustodianOrganization/n1:name"/>
506 </xsl:call-template>
507 </xsl:when>
508 <xsl:otherwise>
509 <xsl:for-each select="n1:custodian/n1:assignedCustodian/n1:representedCustodianOrganization/n1:id">
510 <xsl:call-template name="show-id"/>
511 <xsl:if test="position()!=last()">
512 <br/>
513 </xsl:if>
514 </xsl:for-each>
515 </xsl:otherwise>
516 </xsl:choose>
517 </td>
518 </tr>
519 <xsl:if test="n1:custodian/n1:assignedCustodian/n1:representedCustodianOrganization/n1:addr | n1:custodian/n1:assignedCustodian/n1:representedCustodianOrganization/n1:telecom">
520 <tr>
521 <td bgcolor="#3399ff">
522 <span class="td_label">
523 <xsl:text>Contact info</xsl:text>
524 </span>
525 </td>
526 <td width="80%">
527 <xsl:call-template name="show-contactInfo">
528 <xsl:with-param name="contact" select="n1:custodian/n1:assignedCustodian/n1:representedCustodianOrganization"/>
529 </xsl:call-template>
530 </td>
531 </tr>
532 </xsl:if>
533 </tbody>
534 </table>
535 </xsl:if>
536 </xsl:template>
537 <!-- documentationOf -->
538 <xsl:template name="documentationOf">
539 <xsl:if test="n1:documentationOf">
540 <table class="header_table">
541 <tbody>
542 <xsl:for-each select="n1:documentationOf">
543 <xsl:if test="n1:serviceEvent/@classCode and n1:serviceEvent/n1:code">
544 <xsl:variable name="displayName">
545 <xsl:call-template name="show-actClassCode">
546 <xsl:with-param name="clsCode" select="n1:serviceEvent/@classCode"/>
547 </xsl:call-template>
548 </xsl:variable>
549 <xsl:if test="$displayName">
550 <tr>
551 <td width="20%" bgcolor="#3399ff">
552 <span class="td_label">
553 <xsl:call-template name="firstCharCaseUp">
554 <xsl:with-param name="data" select="$displayName"/>
555 </xsl:call-template>
556 </span>
557 </td>
558 <td width="80%" colspan="3">
559 <xsl:call-template name="show-code">
560 <xsl:with-param name="code" select="n1:serviceEvent/n1:code"/>
561 </xsl:call-template>
562 <xsl:if test="n1:serviceEvent/n1:effectiveTime">
563 <xsl:choose>
564 <xsl:when test="n1:serviceEvent/n1:effectiveTime/@value">
565 <xsl:text>&#160;at&#160;</xsl:text>
566 <xsl:call-template name="show-time">
567 <xsl:with-param name="datetime" select="n1:serviceEvent/n1:effectiveTime"/>
568 </xsl:call-template>
569 </xsl:when>
570 <xsl:when test="n1:serviceEvent/n1:effectiveTime/n1:low">
571 <xsl:text>&#160;from&#160;</xsl:text>
572 <xsl:call-template name="show-time">
573 <xsl:with-param name="datetime" select="n1:serviceEvent/n1:effectiveTime/n1:low"/>
574 </xsl:call-template>
575 <xsl:if test="n1:serviceEvent/n1:effectiveTime/n1:high">
576 <xsl:text> to </xsl:text>
577 <xsl:call-template name="show-time">
578 <xsl:with-param name="datetime" select="n1:serviceEvent/n1:effectiveTime/n1:high"/>
579 </xsl:call-template>
580 </xsl:if>
581 </xsl:when>
582 </xsl:choose>
583 </xsl:if>
584 </td>
585 </tr>
586 </xsl:if>
587 </xsl:if>
588 <xsl:for-each select="n1:serviceEvent/n1:performer">
589 <xsl:variable name="displayName">
590 <xsl:call-template name="show-participationType">
591 <xsl:with-param name="ptype" select="@typeCode"/>
592 </xsl:call-template>
593 <xsl:text> </xsl:text>
594 <xsl:if test="n1:functionCode/@code">
595 <xsl:call-template name="show-participationFunction">
596 <xsl:with-param name="pFunction" select="n1:functionCode/@code"/>
597 </xsl:call-template>
598 </xsl:if>
599 </xsl:variable>
600 <tr>
601 <td width="20%" bgcolor="#3399ff">
602 <span class="td_label">
603 <xsl:call-template name="firstCharCaseUp">
604 <xsl:with-param name="data" select="$displayName"/>
605 </xsl:call-template>
606 </span>
607 </td>
608 <td width="80%" colspan="3">
609 <xsl:call-template name="show-assignedEntity">
610 <xsl:with-param name="asgnEntity" select="n1:assignedEntity"/>
611 </xsl:call-template>
612 </td>
613 </tr>
614 </xsl:for-each>
615 </xsl:for-each>
616 </tbody>
617 </table>
618 </xsl:if>
619 </xsl:template>
620 <!-- inFulfillmentOf -->
621 <xsl:template name="inFulfillmentOf">
622 <xsl:if test="n1:infulfillmentOf">
623 <table class="header_table">
624 <tbody>
625 <xsl:for-each select="n1:inFulfillmentOf">
626 <tr>
627 <td width="20%" bgcolor="#3399ff">
628 <span class="td_label">
629 <xsl:text>In fulfillment of</xsl:text>
630 </span>
631 </td>
632 <td width="80%">
633 <xsl:for-each select="n1:order">
634 <xsl:for-each select="n1:id">
635 <xsl:call-template name="show-id"/>
636 </xsl:for-each>
637 <xsl:for-each select="n1:code">
638 <xsl:text>&#160;</xsl:text>
639 <xsl:call-template name="show-code">
640 <xsl:with-param name="code" select="."/>
641 </xsl:call-template>
642 </xsl:for-each>
643 <xsl:for-each select="n1:priorityCode">
644 <xsl:text>&#160;</xsl:text>
645 <xsl:call-template name="show-code">
646 <xsl:with-param name="code" select="."/>
647 </xsl:call-template>
648 </xsl:for-each>
649 </xsl:for-each>
650 </td>
651 </tr>
652 </xsl:for-each>
653 </tbody>
654 </table>
655 </xsl:if>
656 </xsl:template>
657 <!-- informant -->
658 <xsl:template name="informant">
659 <xsl:if test="n1:informant">
660 <table class="header_table">
661 <tbody>
662 <xsl:for-each select="n1:informant">
663 <tr>
664 <td width="20%" bgcolor="#3399ff">
665 <span class="td_label">
666 <xsl:text>Informant</xsl:text>
667 </span>
668 </td>
669 <td width="80%">
670 <xsl:if test="n1:assignedEntity">
671 <xsl:call-template name="show-assignedEntity">
672 <xsl:with-param name="asgnEntity" select="n1:assignedEntity"/>
673 </xsl:call-template>
674 </xsl:if>
675 <xsl:if test="n1:relatedEntity">
676 <xsl:call-template name="show-relatedEntity">
677 <xsl:with-param name="relatedEntity" select="n1:relatedEntity"/>
678 </xsl:call-template>
679 </xsl:if>
680 </td>
681 </tr>
682 <xsl:choose>
683 <xsl:when test="n1:assignedEntity/n1:addr | n1:assignedEntity/n1:telecom">
684 <tr>
685 <td bgcolor="#3399ff">
686 <span class="td_label">
687 <xsl:text>Contact info</xsl:text>
688 </span>
689 </td>
690 <td>
691 <xsl:if test="n1:assignedEntity">
692 <xsl:call-template name="show-contactInfo">
693 <xsl:with-param name="contact" select="n1:assignedEntity"/>
694 </xsl:call-template>
695 </xsl:if>
696 </td>
697 </tr>
698 </xsl:when>
699 <xsl:when test="n1:relatedEntity/n1:addr | n1:relatedEntity/n1:telecom">
700 <tr>
701 <td bgcolor="#3399ff">
702 <span class="td_label">
703 <xsl:text>Contact info</xsl:text>
704 </span>
705 </td>
706 <td>
707 <xsl:if test="n1:relatedEntity">
708 <xsl:call-template name="show-contactInfo">
709 <xsl:with-param name="contact" select="n1:relatedEntity"/>
710 </xsl:call-template>
711 </xsl:if>
712 </td>
713 </tr>
714 </xsl:when>
715 </xsl:choose>
716 </xsl:for-each>
717 </tbody>
718 </table>
719 </xsl:if>
720 </xsl:template>
721 <!-- informantionRecipient -->
722 <xsl:template name="informationRecipient">
723 <xsl:if test="n1:informationRecipient">
724 <table class="header_table">
725 <tbody>
726 <xsl:for-each select="n1:informationRecipient">
727 <tr>
728 <td width="20%" bgcolor="#3399ff">
729 <span class="td_label">
730 <xsl:text>Information recipient:</xsl:text>
731 </span>
732 </td>
733 <td width="80%">
734 <xsl:choose>
735 <xsl:when test="n1:intendedRecipient/n1:informationRecipient/n1:name">
736 <xsl:for-each select="n1:intendedRecipient/n1:informationRecipient">
737 <xsl:call-template name="show-name">
738 <xsl:with-param name="name" select="n1:name"/>
739 </xsl:call-template>
740 <xsl:if test="position() != last()">
741 <br/>
742 </xsl:if>
743 </xsl:for-each>
744 </xsl:when>
745 <xsl:otherwise>
746 <xsl:for-each select="n1:intendedRecipient">
747 <xsl:for-each select="n1:id">
748 <xsl:call-template name="show-id"/>
749 </xsl:for-each>
750 <xsl:if test="position() != last()">
751 <br/>
752 </xsl:if>
753 <br/>
754 </xsl:for-each>
755 </xsl:otherwise>
756 </xsl:choose>
757 </td>
758 </tr>
759 <xsl:if test="n1:intendedRecipient/n1:addr | n1:intendedRecipient/n1:telecom">
760 <tr>
761 <td bgcolor="#3399ff">
762 <span class="td_label">
763 <xsl:text>Contact info</xsl:text>
764 </span>
765 </td>
766 <td>
767 <xsl:call-template name="show-contactInfo">
768 <xsl:with-param name="contact" select="n1:intendedRecipient"/>
769 </xsl:call-template>
770 </td>
771 </tr>
772 </xsl:if>
773 </xsl:for-each>
774 </tbody>
775 </table>
776 </xsl:if>
777 </xsl:template>
778 <!-- participant -->
779 <xsl:template name="participant">
780 <xsl:if test="n1:participant">
781 <table class="header_table">
782 <tbody>
783 <xsl:for-each select="n1:participant">
784 <tr>
785 <td width="20%" bgcolor="#3399ff">
786 <xsl:variable name="participtRole">
787 <xsl:call-template name="translateRoleAssoCode">
788 <xsl:with-param name="classCode" select="n1:associatedEntity/@classCode"/>
789 <xsl:with-param name="code" select="n1:associatedEntity/n1:code"/>
790 </xsl:call-template>
791 </xsl:variable>
792 <xsl:choose>
793 <xsl:when test="$participtRole">
794 <span class="td_label">
795 <xsl:call-template name="firstCharCaseUp">
796 <xsl:with-param name="data" select="$participtRole"/>
797 </xsl:call-template>
798 </span>
799 </xsl:when>
800 <xsl:otherwise>
801 <span class="td_label">
802 <xsl:text>Participant</xsl:text>
803 </span>
804 </xsl:otherwise>
805 </xsl:choose>
806 </td>
807 <td width="80%">
808 <xsl:if test="n1:functionCode">
809 <xsl:call-template name="show-code">
810 <xsl:with-param name="code" select="n1:functionCode"/>
811 </xsl:call-template>
812 </xsl:if>
813 <xsl:call-template name="show-associatedEntity">
814 <xsl:with-param name="assoEntity" select="n1:associatedEntity"/>
815 </xsl:call-template>
816 <xsl:if test="n1:time">
817 <xsl:if test="n1:time/n1:low">
818 <xsl:text> from </xsl:text>
819 <xsl:call-template name="show-time">
820 <xsl:with-param name="datetime" select="n1:time/n1:low"/>
821 </xsl:call-template>
822 </xsl:if>
823 <xsl:if test="n1:time/n1:high">
824 <xsl:text> to </xsl:text>
825 <xsl:call-template name="show-time">
826 <xsl:with-param name="datetime" select="n1:time/n1:high"/>
827 </xsl:call-template>
828 </xsl:if>
829 </xsl:if>
830 <xsl:if test="position() != last()">
831 <br/>
832 </xsl:if>
833 </td>
834 </tr>
835 <xsl:if test="n1:associatedEntity/n1:addr | n1:associatedEntity/n1:telecom">
836 <tr>
837 <td bgcolor="#3399ff">
838 <span class="td_label">
839 <xsl:text>Contact info</xsl:text>
840 </span>
841 </td>
842 <td>
843 <xsl:call-template name="show-contactInfo">
844 <xsl:with-param name="contact" select="n1:associatedEntity"/>
845 </xsl:call-template>
846 </td>
847 </tr>
848 </xsl:if>
849 </xsl:for-each>
850 </tbody>
851 </table>
852 </xsl:if>
853 </xsl:template>
854 <!-- recordTarget -->
855 <xsl:template name="recordTarget">
856 <table class="header_table">
857 <tbody>
858 <xsl:for-each select="/n1:ClinicalDocument/n1:recordTarget/n1:patientRole">
859 <xsl:if test="not(n1:id/@nullFlavor)">
860 <tr>
861 <td width="20%" bgcolor="#3399ff">
862 <span class="td_label">
863 <xsl:text>Patient</xsl:text>
864 </span>
865 </td>
866 <td colspan="3">
867 <xsl:call-template name="show-name">
868 <xsl:with-param name="name" select="n1:patient/n1:name"/>
869 </xsl:call-template>
870 </td>
871 </tr>
872 <tr>
873 <td width="20%" bgcolor="#3399ff">
874 <span class="td_label">
875 <xsl:text>Date of birth</xsl:text>
876 </span>
877 </td>
878 <td width="30%">
879 <xsl:call-template name="show-time">
880 <xsl:with-param name="datetime" select="n1:patient/n1:birthTime"/>
881 </xsl:call-template>
882 </td>
883 <td width="15%" bgcolor="#3399ff">
884 <span class="td_label">
885 <xsl:text>Sex</xsl:text>
886 </span>
887 </td>
888 <td>
889 <xsl:for-each select="n1:patient/n1:administrativeGenderCode">
890 <xsl:call-template name="show-gender"/>
891 </xsl:for-each>
892 </td>
893 </tr>
894 <xsl:if test="n1:patient/n1:raceCode | (n1:patient/n1:ethnicGroupCode)">
895 <tr>
896 <td width="20%" bgcolor="#3399ff">
897 <span class="td_label">
898 <xsl:text>Race</xsl:text>
899 </span>
900 </td>
901 <td width="30%">
902 <xsl:choose>
903 <xsl:when test="n1:patient/n1:raceCode">
904 <xsl:for-each select="n1:patient/n1:raceCode">
905 <xsl:call-template name="show-race-ethnicity"/>
906 </xsl:for-each>
907 </xsl:when>
908 <xsl:otherwise>
909 <xsl:text>Information not available</xsl:text>
910 </xsl:otherwise>
911 </xsl:choose>
912 </td>
913 <td width="15%" bgcolor="#3399ff">
914 <span class="td_label">
915 <xsl:text>Ethnicity</xsl:text>
916 </span>
917 </td>
918 <td>
919 <xsl:choose>
920 <xsl:when test="n1:patient/n1:ethnicGroupCode">
921 <xsl:for-each select="n1:patient/n1:ethnicGroupCode">
922 <xsl:call-template name="show-race-ethnicity"/>
923 </xsl:for-each>
924 </xsl:when>
925 <xsl:otherwise>
926 <xsl:text>Information not available</xsl:text>
927 </xsl:otherwise>
928 </xsl:choose>
929 </td>
930 </tr>
931 </xsl:if>
932 <tr>
933 <td bgcolor="#3399ff">
934 <span class="td_label">
935 <xsl:text>Contact info</xsl:text>
936 </span>
937 </td>
938 <td>
939 <xsl:call-template name="show-contactInfo">
940 <xsl:with-param name="contact" select="."/>
941 </xsl:call-template>
942 </td>
943 <td bgcolor="#3399ff">
944 <span class="td_label">
945 <xsl:text>Patient IDs</xsl:text>
946 </span>
947 </td>
948 <td>
949 <xsl:for-each select="n1:id">
950 <xsl:call-template name="show-id"/>
951 <br/>
952 </xsl:for-each>
953 </td>
954 </tr>
955 </xsl:if>
956 </xsl:for-each>
957 </tbody>
958 </table>
959 </xsl:template>
960 <!-- relatedDocument -->
961 <xsl:template name="relatedDocument">
962 <xsl:if test="n1:relatedDocument">
963 <table class="header_table">
964 <tbody>
965 <xsl:for-each select="n1:relatedDocument">
966 <tr>
967 <td width="20%" bgcolor="#3399ff">
968 <span class="td_label">
969 <xsl:text>Related document</xsl:text>
970 </span>
971 </td>
972 <td width="80%">
973 <xsl:for-each select="n1:parentDocument">
974 <xsl:for-each select="n1:id">
975 <xsl:call-template name="show-id"/>
976 <br/>
977 </xsl:for-each>
978 </xsl:for-each>
979 </td>
980 </tr>
981 </xsl:for-each>
982 </tbody>
983 </table>
984 </xsl:if>
985 </xsl:template>
986 <!-- authorization (consent) -->
987 <xsl:template name="authorization">
988 <xsl:if test="n1:authorization">
989 <table class="header_table">
990 <tbody>
991 <xsl:for-each select="n1:authorization">
992 <tr>
993 <td width="20%" bgcolor="#3399ff">
994 <span class="td_label">
995 <xsl:text>Consent</xsl:text>
996 </span>
997 </td>
998 <td width="80%">
999 <xsl:choose>
1000 <xsl:when test="n1:consent/n1:code">
1001 <xsl:call-template name="show-code">
1002 <xsl:with-param name="code" select="n1:consent/n1:code"/>
1003 </xsl:call-template>
1004 </xsl:when>
1005 <xsl:otherwise>
1006 <xsl:call-template name="show-code">
1007 <xsl:with-param name="code" select="n1:consent/n1:statusCode"/>
1008 </xsl:call-template>
1009 </xsl:otherwise>
1010 </xsl:choose>
1011 <br/>
1012 </td>
1013 </tr>
1014 </xsl:for-each>
1015 </tbody>
1016 </table>
1017 </xsl:if>
1018 </xsl:template>
1019 <!-- setAndVersion -->
1020 <xsl:template name="setAndVersion">
1021 <xsl:if test="n1:setId and n1:versionNumber">
1022 <table class="header_table">
1023 <tbody>
1024 <tr>
1025 <td width="20%">
1026 <xsl:text>SetId and Version</xsl:text>
1027 </td>
1028 <td colspan="3">
1029 <xsl:text>SetId: </xsl:text>
1030 <xsl:call-template name="show-id">
1031 <xsl:with-param name="id" select="n1:setId"/>
1032 </xsl:call-template>
1033 <xsl:text> Version: </xsl:text>
1034 <xsl:value-of select="n1:versionNumber/@value"/>
1035 </td>
1036 </tr>
1037 </tbody>
1038 </table>
1039 </xsl:if>
1040 </xsl:template>
1041 <!-- show StructuredBody -->
1042 <xsl:template match="n1:component/n1:structuredBody">
1043 <xsl:for-each select="n1:component/n1:section">
1044 <xsl:call-template name="section"/>
1045 </xsl:for-each>
1046 </xsl:template>
1047 <!-- show nonXMLBody -->
1048 <xsl:template match='n1:component/n1:nonXMLBody'>
1049 <xsl:choose>
1050 <!-- if there is a reference, use that in an IFRAME -->
1051 <xsl:when test='n1:text/n1:reference'>
1052 <IFRAME name='nonXMLBody' id='nonXMLBody' WIDTH='80%' HEIGHT='600' src='{n1:text/n1:reference/@value}'/>
1053 </xsl:when>
1054 <xsl:when test='n1:text/@mediaType="text/plain"'>
1055 <pre>
1056 <xsl:value-of select='n1:text/text()'/>
1057 </pre>
1058 </xsl:when>
1059 <xsl:otherwise>
1060 <CENTER>Cannot display the text</CENTER>
1061 </xsl:otherwise>
1062 </xsl:choose>
1063 </xsl:template>
1064 <!-- top level component/section: display title and text,
1065 and process any nested component/sections
1067 <xsl:template name="section">
1068 <xsl:call-template name="section-title">
1069 <xsl:with-param name="title" select="n1:title"/>
1070 </xsl:call-template>
1071 <xsl:call-template name="section-author"/>
1072 <xsl:call-template name="section-text"/>
1073 <xsl:for-each select="n1:component/n1:section">
1074 <xsl:call-template name="nestedSection">
1075 <xsl:with-param name="margin" select="2"/>
1076 </xsl:call-template>
1077 </xsl:for-each>
1078 </xsl:template>
1079 <!-- top level section title -->
1080 <xsl:template name="section-title">
1081 <xsl:param name="title"/>
1082 <xsl:choose>
1083 <xsl:when test="count(/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component[n1:section]) &gt; 1">
1084 <h3>
1085 <a name="{generate-id($title)}" href="#toc">
1086 <xsl:value-of select="$title"/>
1087 </a>
1088 </h3>
1089 </xsl:when>
1090 <xsl:otherwise>
1091 <h3>
1092 <xsl:value-of select="$title"/>
1093 </h3>
1094 </xsl:otherwise>
1095 </xsl:choose>
1096 </xsl:template>
1097 <!-- section author -->
1098 <xsl:template name="section-author">
1099 <xsl:if test="count(n1:author)&gt;0">
1100 <div style="margin-left : 2em;">
1102 <xsl:text>Section Author: </xsl:text>
1103 </b>
1104 <xsl:for-each select="n1:author/n1:assignedAuthor">
1105 <xsl:choose>
1106 <xsl:when test="n1:assignedPerson/n1:name">
1107 <xsl:call-template name="show-name">
1108 <xsl:with-param name="name" select="n1:assignedPerson/n1:name"/>
1109 </xsl:call-template>
1110 <xsl:if test="n1:representedOrganization">
1111 <xsl:text>, </xsl:text>
1112 <xsl:call-template name="show-name">
1113 <xsl:with-param name="name" select="n1:representedOrganization/n1:name"/>
1114 </xsl:call-template>
1115 </xsl:if>
1116 </xsl:when>
1117 <xsl:when test="n1:assignedAuthoringDevice/n1:softwareName">
1118 <xsl:value-of select="n1:assignedAuthoringDevice/n1:softwareName"/>
1119 </xsl:when>
1120 <xsl:otherwise>
1121 <xsl:for-each select="n1:id">
1122 <xsl:call-template name="show-id"/>
1123 <br/>
1124 </xsl:for-each>
1125 </xsl:otherwise>
1126 </xsl:choose>
1127 </xsl:for-each>
1128 <br/>
1129 </div>
1130 </xsl:if>
1131 </xsl:template>
1132 <!-- top-level section Text -->
1133 <xsl:template name="section-text">
1134 <div>
1135 <xsl:apply-templates select="n1:text"/>
1136 </div>
1137 </xsl:template>
1138 <!-- nested component/section -->
1139 <xsl:template name="nestedSection">
1140 <xsl:param name="margin"/>
1141 <h4 style="margin-left : {$margin}em;">
1142 <xsl:value-of select="n1:title"/>
1143 </h4>
1144 <div style="margin-left : {$margin}em;">
1145 <xsl:apply-templates select="n1:text"/>
1146 </div>
1147 <xsl:for-each select="n1:component/n1:section">
1148 <xsl:call-template name="nestedSection">
1149 <xsl:with-param name="margin" select="2*$margin"/>
1150 </xsl:call-template>
1151 </xsl:for-each>
1152 </xsl:template>
1153 <!-- paragraph -->
1154 <xsl:template match="n1:paragraph">
1156 <xsl:apply-templates/>
1157 </p>
1158 </xsl:template>
1159 <!-- pre format -->
1160 <xsl:template match="n1:pre">
1161 <pre>
1162 <xsl:apply-templates/>
1163 </pre>
1164 </xsl:template>
1165 <!-- Content w/ deleted text is hidden -->
1166 <xsl:template match="n1:content[@revised='delete']"/>
1167 <!-- content -->
1168 <xsl:template match="n1:content">
1169 <xsl:apply-templates/>
1170 </xsl:template>
1171 <!-- line break -->
1172 <xsl:template match="n1:br">
1173 <xsl:element name='br'>
1174 <xsl:apply-templates/>
1175 </xsl:element>
1176 </xsl:template>
1177 <!-- list -->
1178 <xsl:template match="n1:list">
1179 <xsl:if test="n1:caption">
1182 <xsl:apply-templates select="n1:caption"/>
1183 </b>
1184 </p>
1185 </xsl:if>
1186 <ul>
1187 <xsl:for-each select="n1:item">
1188 <li>
1189 <xsl:apply-templates/>
1190 </li>
1191 </xsl:for-each>
1192 </ul>
1193 </xsl:template>
1194 <xsl:template match="n1:list[@listType='ordered']">
1195 <xsl:if test="n1:caption">
1196 <span style="font-weight:bold; ">
1197 <xsl:apply-templates select="n1:caption"/>
1198 </span>
1199 </xsl:if>
1200 <ol>
1201 <xsl:for-each select="n1:item">
1202 <li>
1203 <xsl:apply-templates/>
1204 </li>
1205 </xsl:for-each>
1206 </ol>
1207 </xsl:template>
1208 <!-- caption -->
1209 <xsl:template match="n1:caption">
1210 <xsl:apply-templates/>
1211 <xsl:text>: </xsl:text>
1212 </xsl:template>
1213 <!-- Tables -->
1214 <xsl:template match="n1:table/@*|n1:thead/@*|n1:tfoot/@*|n1:tbody/@*|n1:colgroup/@*|n1:col/@*|n1:tr/@*|n1:th/@*|n1:td/@*">
1215 <xsl:copy>
1216 <xsl:copy-of select="@*"/>
1217 <xsl:apply-templates/>
1218 </xsl:copy>
1219 </xsl:template>
1220 <xsl:template match="n1:table">
1221 <table class="narr_table">
1222 <xsl:copy-of select="@*"/>
1223 <xsl:apply-templates/>
1224 </table>
1225 </xsl:template>
1226 <xsl:template match="n1:thead">
1227 <thead>
1228 <xsl:copy-of select="@*"/>
1229 <xsl:apply-templates/>
1230 </thead>
1231 </xsl:template>
1232 <xsl:template match="n1:tfoot">
1233 <tfoot>
1234 <xsl:copy-of select="@*"/>
1235 <xsl:apply-templates/>
1236 </tfoot>
1237 </xsl:template>
1238 <xsl:template match="n1:tbody">
1239 <tbody>
1240 <xsl:copy-of select="@*"/>
1241 <xsl:apply-templates/>
1242 </tbody>
1243 </xsl:template>
1244 <xsl:template match="n1:colgroup">
1245 <colgroup>
1246 <xsl:copy-of select="@*"/>
1247 <xsl:apply-templates/>
1248 </colgroup>
1249 </xsl:template>
1250 <xsl:template match="n1:col">
1251 <col>
1252 <xsl:copy-of select="@*"/>
1253 <xsl:apply-templates/>
1254 </col>
1255 </xsl:template>
1256 <xsl:template match="n1:tr">
1257 <tr class="narr_tr">
1258 <xsl:copy-of select="@*"/>
1259 <xsl:apply-templates/>
1260 </tr>
1261 </xsl:template>
1262 <xsl:template match="n1:th">
1263 <th class="narr_th">
1264 <xsl:copy-of select="@*"/>
1265 <xsl:apply-templates/>
1266 </th>
1267 </xsl:template>
1268 <xsl:template match="n1:td">
1269 <td>
1270 <xsl:copy-of select="@*"/>
1271 <xsl:apply-templates/>
1272 </td>
1273 </xsl:template>
1274 <xsl:template match="n1:table/n1:caption">
1275 <span style="font-weight:bold; ">
1276 <xsl:apply-templates/>
1277 </span>
1278 </xsl:template>
1279 <!-- RenderMultiMedia
1280 this currently only handles GIF's and JPEG's. It could, however,
1281 be extended by including other image MIME types in the predicate
1282 and/or by generating <object> or <applet> tag with the correct
1283 params depending on the media type @ID =$imageRef referencedObject
1285 <xsl:template match="n1:renderMultiMedia">
1286 <xsl:variable name="imageRef" select="@referencedObject"/>
1287 <xsl:choose>
1288 <xsl:when test="//n1:regionOfInterest[@ID=$imageRef]">
1289 <!-- Here is where the Region of Interest image referencing goes -->
1290 <xsl:if test="//n1:regionOfInterest[@ID=$imageRef]//n1:observationMedia/n1:value[@mediaType='image/gif' or
1291 @mediaType='image/jpeg']">
1292 <br clear="all"/>
1293 <xsl:element name="img">
1294 <xsl:attribute name="src"><xsl:value-of select="//n1:regionOfInterest[@ID=$imageRef]//n1:observationMedia/n1:value/n1:reference/@value"/></xsl:attribute>
1295 </xsl:element>
1296 </xsl:if>
1297 </xsl:when>
1298 <xsl:otherwise>
1299 <!-- Here is where the direct MultiMedia image referencing goes -->
1300 <xsl:if test="//n1:observationMedia[@ID=$imageRef]/n1:value[@mediaType='image/gif' or @mediaType='image/jpeg']">
1301 <br clear="all"/>
1302 <xsl:element name="img">
1303 <xsl:attribute name="src"><xsl:value-of select="//n1:observationMedia[@ID=$imageRef]/n1:value/n1:reference/@value"/></xsl:attribute>
1304 </xsl:element>
1305 </xsl:if>
1306 </xsl:otherwise>
1307 </xsl:choose>
1308 </xsl:template>
1309 <!-- Stylecode processing
1310 Supports Bold, Underline and Italics display
1312 <xsl:template match="//n1:*[@styleCode]">
1313 <xsl:if test="@styleCode='Bold'">
1314 <xsl:element name="b">
1315 <xsl:apply-templates/>
1316 </xsl:element>
1317 </xsl:if>
1318 <xsl:if test="@styleCode='Italics'">
1319 <xsl:element name="i">
1320 <xsl:apply-templates/>
1321 </xsl:element>
1322 </xsl:if>
1323 <xsl:if test="@styleCode='Underline'">
1324 <xsl:element name="u">
1325 <xsl:apply-templates/>
1326 </xsl:element>
1327 </xsl:if>
1328 <xsl:if test="contains(@styleCode,'Bold') and contains(@styleCode,'Italics') and not (contains(@styleCode, 'Underline'))">
1329 <xsl:element name="b">
1330 <xsl:element name="i">
1331 <xsl:apply-templates/>
1332 </xsl:element>
1333 </xsl:element>
1334 </xsl:if>
1335 <xsl:if test="contains(@styleCode,'Bold') and contains(@styleCode,'Underline') and not (contains(@styleCode, 'Italics'))">
1336 <xsl:element name="b">
1337 <xsl:element name="u">
1338 <xsl:apply-templates/>
1339 </xsl:element>
1340 </xsl:element>
1341 </xsl:if>
1342 <xsl:if test="contains(@styleCode,'Italics') and contains(@styleCode,'Underline') and not (contains(@styleCode, 'Bold'))">
1343 <xsl:element name="i">
1344 <xsl:element name="u">
1345 <xsl:apply-templates/>
1346 </xsl:element>
1347 </xsl:element>
1348 </xsl:if>
1349 <xsl:if test="contains(@styleCode,'Italics') and contains(@styleCode,'Underline') and contains(@styleCode, 'Bold')">
1350 <xsl:element name="b">
1351 <xsl:element name="i">
1352 <xsl:element name="u">
1353 <xsl:apply-templates/>
1354 </xsl:element>
1355 </xsl:element>
1356 </xsl:element>
1357 </xsl:if>
1358 <xsl:if test="not (contains(@styleCode,'Italics') or contains(@styleCode,'Underline') or contains(@styleCode, 'Bold'))">
1359 <xsl:apply-templates/>
1360 </xsl:if>
1361 </xsl:template>
1362 <!-- Superscript or Subscript -->
1363 <xsl:template match="n1:sup">
1364 <xsl:element name="sup">
1365 <xsl:apply-templates/>
1366 </xsl:element>
1367 </xsl:template>
1368 <xsl:template match="n1:sub">
1369 <xsl:element name="sub">
1370 <xsl:apply-templates/>
1371 </xsl:element>
1372 </xsl:template>
1373 <!-- show-signature -->
1374 <xsl:template name="show-sig">
1375 <xsl:param name="sig"/>
1376 <xsl:choose>
1377 <xsl:when test="$sig/@code =&apos;S&apos;">
1378 <xsl:text>signed</xsl:text>
1379 </xsl:when>
1380 <xsl:when test="$sig/@code=&apos;I&apos;">
1381 <xsl:text>intended</xsl:text>
1382 </xsl:when>
1383 <xsl:when test="$sig/@code=&apos;X&apos;">
1384 <xsl:text>signature required</xsl:text>
1385 </xsl:when>
1386 </xsl:choose>
1387 </xsl:template>
1388 <!-- show-id -->
1389 <xsl:template name="show-id">
1390 <xsl:param name="id"/>
1391 <xsl:choose>
1392 <xsl:when test="not($id)">
1393 <xsl:if test="not(@nullFlavor)">
1394 <xsl:if test="@extension">
1395 <xsl:value-of select="@extension"/>
1396 </xsl:if>
1397 <xsl:text> </xsl:text>
1398 <xsl:value-of select="@root"/>
1399 </xsl:if>
1400 </xsl:when>
1401 <xsl:otherwise>
1402 <xsl:if test="not($id/@nullFlavor)">
1403 <xsl:if test="$id/@extension">
1404 <xsl:value-of select="$id/@extension"/>
1405 </xsl:if>
1406 <xsl:text> </xsl:text>
1407 <xsl:value-of select="$id/@root"/>
1408 </xsl:if>
1409 </xsl:otherwise>
1410 </xsl:choose>
1411 </xsl:template>
1412 <!-- show-name -->
1413 <xsl:template name="show-name">
1414 <xsl:param name="name"/>
1415 <xsl:choose>
1416 <xsl:when test="$name/n1:family">
1417 <xsl:if test="$name/n1:prefix">
1418 <xsl:value-of select="$name/n1:prefix"/>
1419 <xsl:text> </xsl:text>
1420 </xsl:if>
1421 <xsl:value-of select="$name/n1:given"/>
1422 <xsl:text> </xsl:text>
1423 <xsl:value-of select="$name/n1:family"/>
1424 <xsl:if test="$name/n1:suffix">
1425 <xsl:text>, </xsl:text>
1426 <xsl:value-of select="$name/n1:suffix"/>
1427 </xsl:if>
1428 </xsl:when>
1429 <xsl:otherwise>
1430 <xsl:value-of select="$name"/>
1431 </xsl:otherwise>
1432 </xsl:choose>
1433 </xsl:template>
1434 <!-- show-gender -->
1435 <xsl:template name="show-gender">
1436 <xsl:choose>
1437 <xsl:when test="@code = &apos;M&apos;">
1438 <xsl:text>Male</xsl:text>
1439 </xsl:when>
1440 <xsl:when test="@code = &apos;F&apos;">
1441 <xsl:text>Female</xsl:text>
1442 </xsl:when>
1443 <xsl:when test="@code = &apos;U&apos;">
1444 <xsl:text>Undifferentiated</xsl:text>
1445 </xsl:when>
1446 </xsl:choose>
1447 </xsl:template>
1448 <!-- show-race-ethnicity -->
1449 <xsl:template name="show-race-ethnicity">
1450 <xsl:choose>
1451 <xsl:when test="@displayName">
1452 <xsl:value-of select="@displayName"/>
1453 </xsl:when>
1454 <xsl:otherwise>
1455 <xsl:value-of select="@code"/>
1456 </xsl:otherwise>
1457 </xsl:choose>
1458 </xsl:template>
1459 <!-- show-contactInfo -->
1460 <xsl:template name="show-contactInfo">
1461 <xsl:param name="contact"/>
1462 <xsl:call-template name="show-address">
1463 <xsl:with-param name="address" select="$contact/n1:addr"/>
1464 </xsl:call-template>
1465 <xsl:call-template name="show-telecom">
1466 <xsl:with-param name="telecom" select="$contact/n1:telecom"/>
1467 </xsl:call-template>
1468 </xsl:template>
1469 <!-- show-address -->
1470 <xsl:template name="show-address">
1471 <xsl:param name="address"/>
1472 <xsl:choose>
1473 <xsl:when test="$address">
1474 <xsl:if test="$address/@use">
1475 <xsl:text> </xsl:text>
1476 <xsl:call-template name="translateTelecomCode">
1477 <xsl:with-param name="code" select="$address/@use"/>
1478 </xsl:call-template>
1479 <xsl:text>:</xsl:text>
1480 <br/>
1481 </xsl:if>
1482 <xsl:for-each select="$address/n1:streetAddressLine">
1483 <xsl:value-of select="."/>
1484 <br/>
1485 </xsl:for-each>
1486 <xsl:if test="$address/n1:streetName">
1487 <xsl:value-of select="$address/n1:streetName"/>
1488 <xsl:text> </xsl:text>
1489 <xsl:value-of select="$address/n1:houseNumber"/>
1490 <br/>
1491 </xsl:if>
1492 <xsl:if test="string-length($address/n1:city)>0">
1493 <xsl:value-of select="$address/n1:city"/>
1494 </xsl:if>
1495 <xsl:if test="string-length($address/n1:state)>0">
1496 <xsl:text>,&#160;</xsl:text>
1497 <xsl:value-of select="$address/n1:state"/>
1498 </xsl:if>
1499 <xsl:if test="string-length($address/n1:postalCode)>0">
1500 <xsl:text>&#160;</xsl:text>
1501 <xsl:value-of select="$address/n1:postalCode"/>
1502 </xsl:if>
1503 <xsl:if test="string-length($address/n1:country)>0">
1504 <xsl:text>,&#160;</xsl:text>
1505 <xsl:value-of select="$address/n1:country"/>
1506 </xsl:if>
1507 </xsl:when>
1508 <xsl:otherwise>
1509 <xsl:text>address not available</xsl:text>
1510 </xsl:otherwise>
1511 </xsl:choose>
1512 <br/>
1513 </xsl:template>
1514 <!-- show-telecom -->
1515 <xsl:template name="show-telecom">
1516 <xsl:param name="telecom"/>
1517 <xsl:choose>
1518 <xsl:when test="$telecom">
1519 <xsl:variable name="type" select="substring-before($telecom/@value, ':')"/>
1520 <xsl:variable name="value" select="substring-after($telecom/@value, ':')"/>
1521 <xsl:if test="$type">
1522 <xsl:call-template name="translateTelecomCode">
1523 <xsl:with-param name="code" select="$type"/>
1524 </xsl:call-template>
1525 <xsl:if test="@use">
1526 <xsl:text> (</xsl:text>
1527 <xsl:call-template name="translateTelecomCode">
1528 <xsl:with-param name="code" select="@use"/>
1529 </xsl:call-template>
1530 <xsl:text>)</xsl:text>
1531 </xsl:if>
1532 <xsl:text>: </xsl:text>
1533 <xsl:text> </xsl:text>
1534 <xsl:value-of select="$value"/>
1535 </xsl:if>
1536 </xsl:when>
1537 <xsl:otherwise>
1538 <xsl:text>Telecom information not available</xsl:text>
1539 </xsl:otherwise>
1540 </xsl:choose>
1541 <br/>
1542 </xsl:template>
1543 <!-- show-recipientType -->
1544 <xsl:template name="show-recipientType">
1545 <xsl:param name="typeCode"/>
1546 <xsl:choose>
1547 <xsl:when test="$typeCode='PRCP'">Primary Recipient:</xsl:when>
1548 <xsl:when test="$typeCode='TRC'">Secondary Recipient:</xsl:when>
1549 <xsl:otherwise>Recipient:</xsl:otherwise>
1550 </xsl:choose>
1551 </xsl:template>
1552 <!-- Convert Telecom URL to display text -->
1553 <xsl:template name="translateTelecomCode">
1554 <xsl:param name="code"/>
1555 <!--xsl:value-of select="document('voc.xml')/systems/system[@root=$code/@codeSystem]/code[@value=$code/@code]/@displayName"/-->
1556 <!--xsl:value-of select="document('codes.xml')/*/code[@code=$code]/@display"/-->
1557 <xsl:choose>
1558 <!-- lookup table Telecom URI -->
1559 <xsl:when test="$code='tel'">
1560 <xsl:text>Tel</xsl:text>
1561 </xsl:when>
1562 <xsl:when test="$code='fax'">
1563 <xsl:text>Fax</xsl:text>
1564 </xsl:when>
1565 <xsl:when test="$code='http'">
1566 <xsl:text>Web</xsl:text>
1567 </xsl:when>
1568 <xsl:when test="$code='mailto'">
1569 <xsl:text>Mail</xsl:text>
1570 </xsl:when>
1571 <xsl:when test="$code='H'">
1572 <xsl:text>Home</xsl:text>
1573 </xsl:when>
1574 <xsl:when test="$code='HV'">
1575 <xsl:text>Vacation Home</xsl:text>
1576 </xsl:when>
1577 <xsl:when test="$code='HP'">
1578 <xsl:text>Pirmary Home</xsl:text>
1579 </xsl:when>
1580 <xsl:when test="$code='WP'">
1581 <xsl:text>Work Place</xsl:text>
1582 </xsl:when>
1583 <xsl:when test="$code='PUB'">
1584 <xsl:text>Pub</xsl:text>
1585 </xsl:when>
1586 <xsl:otherwise>
1587 <xsl:text>{$code='</xsl:text>
1588 <xsl:value-of select="$code"/>
1589 <xsl:text>'?}</xsl:text>
1590 </xsl:otherwise>
1591 </xsl:choose>
1592 </xsl:template>
1593 <!-- convert RoleClassAssociative code to display text -->
1594 <xsl:template name="translateRoleAssoCode">
1595 <xsl:param name="classCode"/>
1596 <xsl:param name="code"/>
1597 <xsl:choose>
1598 <xsl:when test="$classCode='AFFL'">
1599 <xsl:text>affiliate</xsl:text>
1600 </xsl:when>
1601 <xsl:when test="$classCode='AGNT'">
1602 <xsl:text>agent</xsl:text>
1603 </xsl:when>
1604 <xsl:when test="$classCode='ASSIGNED'">
1605 <xsl:text>assigned entity</xsl:text>
1606 </xsl:when>
1607 <xsl:when test="$classCode='COMPAR'">
1608 <xsl:text>commissioning party</xsl:text>
1609 </xsl:when>
1610 <xsl:when test="$classCode='CON'">
1611 <xsl:text>contact</xsl:text>
1612 </xsl:when>
1613 <xsl:when test="$classCode='ECON'">
1614 <xsl:text>emergency contact</xsl:text>
1615 </xsl:when>
1616 <xsl:when test="$classCode='NOK'">
1617 <xsl:text>next of kin</xsl:text>
1618 </xsl:when>
1619 <xsl:when test="$classCode='SGNOFF'">
1620 <xsl:text>signing authority</xsl:text>
1621 </xsl:when>
1622 <xsl:when test="$classCode='GUARD'">
1623 <xsl:text>guardian</xsl:text>
1624 </xsl:when>
1625 <xsl:when test="$classCode='GUAR'">
1626 <xsl:text>guardian</xsl:text>
1627 </xsl:when>
1628 <xsl:when test="$classCode='CIT'">
1629 <xsl:text>citizen</xsl:text>
1630 </xsl:when>
1631 <xsl:when test="$classCode='COVPTY'">
1632 <xsl:text>covered party</xsl:text>
1633 </xsl:when>
1634 <xsl:when test="$classCode='PRS'">
1635 <xsl:text>personal relationship</xsl:text>
1636 </xsl:when>
1637 <xsl:when test="$classCode='CAREGIVER'">
1638 <xsl:text>care giver</xsl:text>
1639 </xsl:when>
1640 <xsl:otherwise>
1641 <xsl:text>{$classCode='</xsl:text>
1642 <xsl:value-of select="$classCode"/>
1643 <xsl:text>'?}</xsl:text>
1644 </xsl:otherwise>
1645 </xsl:choose>
1646 <xsl:if test="($code/@code) and ($code/@codeSystem='2.16.840.1.113883.5.111')">
1647 <xsl:text> </xsl:text>
1648 <xsl:choose>
1649 <xsl:when test="$code/@code='FTH'">
1650 <xsl:text>(Father)</xsl:text>
1651 </xsl:when>
1652 <xsl:when test="$code/@code='MTH'">
1653 <xsl:text>(Mother)</xsl:text>
1654 </xsl:when>
1655 <xsl:when test="$code/@code='NPRN'">
1656 <xsl:text>(Natural parent)</xsl:text>
1657 </xsl:when>
1658 <xsl:when test="$code/@code='STPPRN'">
1659 <xsl:text>(Step parent)</xsl:text>
1660 </xsl:when>
1661 <xsl:when test="$code/@code='SONC'">
1662 <xsl:text>(Son)</xsl:text>
1663 </xsl:when>
1664 <xsl:when test="$code/@code='DAUC'">
1665 <xsl:text>(Daughter)</xsl:text>
1666 </xsl:when>
1667 <xsl:when test="$code/@code='CHILD'">
1668 <xsl:text>(Child)</xsl:text>
1669 </xsl:when>
1670 <xsl:when test="$code/@code='EXT'">
1671 <xsl:text>(Extended family member)</xsl:text>
1672 </xsl:when>
1673 <xsl:when test="$code/@code='NBOR'">
1674 <xsl:text>(Neighbor)</xsl:text>
1675 </xsl:when>
1676 <xsl:when test="$code/@code='SIGOTHR'">
1677 <xsl:text>(Significant other)</xsl:text>
1678 </xsl:when>
1679 <xsl:otherwise>
1680 <xsl:text>{$code/@code='</xsl:text>
1681 <xsl:value-of select="$code/@code"/>
1682 <xsl:text>'?}</xsl:text>
1683 </xsl:otherwise>
1684 </xsl:choose>
1685 </xsl:if>
1686 </xsl:template>
1687 <!-- show time -->
1688 <xsl:template name="show-time">
1689 <xsl:param name="datetime"/>
1690 <xsl:choose>
1691 <xsl:when test="not($datetime)">
1692 <xsl:call-template name="formatDateTime">
1693 <xsl:with-param name="date" select="@value"/>
1694 </xsl:call-template>
1695 <xsl:text> </xsl:text>
1696 </xsl:when>
1697 <xsl:otherwise>
1698 <xsl:call-template name="formatDateTime">
1699 <xsl:with-param name="date" select="$datetime/@value"/>
1700 </xsl:call-template>
1701 <xsl:text> </xsl:text>
1702 </xsl:otherwise>
1703 </xsl:choose>
1704 </xsl:template>
1705 <!-- paticipant facility and date -->
1706 <xsl:template name="facilityAndDates">
1707 <table class="header_table">
1708 <tbody>
1709 <!-- facility id -->
1710 <tr>
1711 <td width="20%" bgcolor="#3399ff">
1712 <span class="td_label">
1713 <xsl:text>Facility ID</xsl:text>
1714 </span>
1715 </td>
1716 <td colspan="3">
1717 <xsl:choose>
1718 <xsl:when test="count(/n1:ClinicalDocument/n1:participant
1719 [@typeCode='LOC'][@contextControlCode='OP']
1720 /n1:associatedEntity[@classCode='SDLOC']/n1:id)&gt;0">
1721 <!-- change context node -->
1722 <xsl:for-each select="/n1:ClinicalDocument/n1:participant
1723 [@typeCode='LOC'][@contextControlCode='OP']
1724 /n1:associatedEntity[@classCode='SDLOC']/n1:id">
1725 <xsl:call-template name="show-id"/>
1726 <!-- change context node again, for the code -->
1727 <xsl:for-each select="../n1:code">
1728 <xsl:text> (</xsl:text>
1729 <xsl:call-template name="show-code">
1730 <xsl:with-param name="code" select="."/>
1731 </xsl:call-template>
1732 <xsl:text>)</xsl:text>
1733 </xsl:for-each>
1734 </xsl:for-each>
1735 </xsl:when>
1736 <xsl:otherwise>
1737 Not available
1738 </xsl:otherwise>
1739 </xsl:choose>
1740 </td>
1741 </tr>
1742 <!-- Period reported -->
1743 <tr>
1744 <td width="20%" bgcolor="#3399ff">
1745 <span class="td_label">
1746 <xsl:text>First day of period reported</xsl:text>
1747 </span>
1748 </td>
1749 <td colspan="3">
1750 <xsl:call-template name="show-time">
1751 <xsl:with-param name="datetime" select="/n1:ClinicalDocument/n1:documentationOf
1752 /n1:serviceEvent/n1:effectiveTime/n1:low"/>
1753 </xsl:call-template>
1754 </td>
1755 </tr>
1756 <tr>
1757 <td width="20%" bgcolor="#3399ff">
1758 <span class="td_label">
1759 <xsl:text>Last day of period reported</xsl:text>
1760 </span>
1761 </td>
1762 <td colspan="3">
1763 <xsl:call-template name="show-time">
1764 <xsl:with-param name="datetime" select="/n1:ClinicalDocument/n1:documentationOf
1765 /n1:serviceEvent/n1:effectiveTime/n1:high"/>
1766 </xsl:call-template>
1767 </td>
1768 </tr>
1769 </tbody>
1770 </table>
1771 </xsl:template>
1772 <!-- show assignedEntity -->
1773 <xsl:template name="show-assignedEntity">
1774 <xsl:param name="asgnEntity"/>
1775 <xsl:choose>
1776 <xsl:when test="$asgnEntity/n1:assignedPerson/n1:name">
1777 <xsl:call-template name="show-name">
1778 <xsl:with-param name="name" select="$asgnEntity/n1:assignedPerson/n1:name"/>
1779 </xsl:call-template>
1780 <xsl:if test="$asgnEntity/n1:representedOrganization/n1:name">
1781 <xsl:text> of </xsl:text>
1782 <xsl:value-of select="$asgnEntity/n1:representedOrganization/n1:name"/>
1783 </xsl:if>
1784 </xsl:when>
1785 <xsl:when test="$asgnEntity/n1:representedOrganization">
1786 <xsl:value-of select="$asgnEntity/n1:representedOrganization/n1:name"/>
1787 </xsl:when>
1788 <xsl:otherwise>
1789 <xsl:for-each select="$asgnEntity/n1:id">
1790 <xsl:call-template name="show-id"/>
1791 <xsl:choose>
1792 <xsl:when test="position()!=last()">
1793 <xsl:text>, </xsl:text>
1794 </xsl:when>
1795 <xsl:otherwise>
1796 <br/>
1797 </xsl:otherwise>
1798 </xsl:choose>
1799 </xsl:for-each>
1800 </xsl:otherwise>
1801 </xsl:choose>
1802 </xsl:template>
1803 <!-- show relatedEntity -->
1804 <xsl:template name="show-relatedEntity">
1805 <xsl:param name="relatedEntity"/>
1806 <xsl:choose>
1807 <xsl:when test="$relatedEntity/n1:relatedPerson/n1:name">
1808 <xsl:call-template name="show-name">
1809 <xsl:with-param name="name" select="$relatedEntity/n1:relatedPerson/n1:name"/>
1810 </xsl:call-template>
1811 </xsl:when>
1812 </xsl:choose>
1813 </xsl:template>
1814 <!-- show associatedEntity -->
1815 <xsl:template name="show-associatedEntity">
1816 <xsl:param name="assoEntity"/>
1817 <xsl:choose>
1818 <xsl:when test="$assoEntity/n1:associatedPerson">
1819 <xsl:for-each select="$assoEntity/n1:associatedPerson/n1:name">
1820 <xsl:call-template name="show-name">
1821 <xsl:with-param name="name" select="."/>
1822 </xsl:call-template>
1823 <br/>
1824 </xsl:for-each>
1825 </xsl:when>
1826 <xsl:when test="$assoEntity/n1:scopingOrganization">
1827 <xsl:for-each select="$assoEntity/n1:scopingOrganization">
1828 <xsl:if test="n1:name">
1829 <xsl:call-template name="show-name">
1830 <xsl:with-param name="name" select="n1:name"/>
1831 </xsl:call-template>
1832 <br/>
1833 </xsl:if>
1834 <xsl:if test="n1:standardIndustryClassCode">
1835 <xsl:value-of select="n1:standardIndustryClassCode/@displayName"/>
1836 <xsl:text> code:</xsl:text>
1837 <xsl:value-of select="n1:standardIndustryClassCode/@code"/>
1838 </xsl:if>
1839 </xsl:for-each>
1840 </xsl:when>
1841 <xsl:when test="$assoEntity/n1:code">
1842 <xsl:call-template name="show-code">
1843 <xsl:with-param name="code" select="$assoEntity/n1:code"/>
1844 </xsl:call-template>
1845 </xsl:when>
1846 <xsl:when test="$assoEntity/n1:id">
1847 <xsl:value-of select="$assoEntity/n1:id/@extension"/>
1848 <xsl:text> </xsl:text>
1849 <xsl:value-of select="$assoEntity/n1:id/@root"/>
1850 </xsl:when>
1851 </xsl:choose>
1852 </xsl:template>
1853 <!-- show code
1854 if originalText present, return it, otherwise, check and return attribute: display name
1856 <xsl:template name="show-code">
1857 <xsl:param name="code"/>
1858 <xsl:variable name="this-codeSystem">
1859 <xsl:value-of select="$code/@codeSystem"/>
1860 </xsl:variable>
1861 <xsl:variable name="this-code">
1862 <xsl:value-of select="$code/@code"/>
1863 </xsl:variable>
1864 <xsl:choose>
1865 <xsl:when test="$code/n1:originalText">
1866 <xsl:value-of select="$code/n1:originalText"/>
1867 </xsl:when>
1868 <xsl:when test="$code/@displayName">
1869 <xsl:value-of select="$code/@displayName"/>
1870 </xsl:when>
1871 <!--
1872 <xsl:when test="$the-valuesets/*/voc:system[@root=$this-codeSystem]/voc:code[@value=$this-code]/@displayName">
1873 <xsl:value-of select="$the-valuesets/*/voc:system[@root=$this-codeSystem]/voc:code[@value=$this-code]/@displayName"/>
1874 </xsl:when>
1876 <xsl:otherwise>
1877 <xsl:value-of select="$this-code"/>
1878 </xsl:otherwise>
1879 </xsl:choose>
1880 </xsl:template>
1881 <!-- show classCode -->
1882 <xsl:template name="show-actClassCode">
1883 <xsl:param name="clsCode"/>
1884 <xsl:choose>
1885 <xsl:when test=" $clsCode = 'ACT' ">
1886 <xsl:text>healthcare service</xsl:text>
1887 </xsl:when>
1888 <xsl:when test=" $clsCode = 'ACCM' ">
1889 <xsl:text>accommodation</xsl:text>
1890 </xsl:when>
1891 <xsl:when test=" $clsCode = 'ACCT' ">
1892 <xsl:text>account</xsl:text>
1893 </xsl:when>
1894 <xsl:when test=" $clsCode = 'ACSN' ">
1895 <xsl:text>accession</xsl:text>
1896 </xsl:when>
1897 <xsl:when test=" $clsCode = 'ADJUD' ">
1898 <xsl:text>financial adjudication</xsl:text>
1899 </xsl:when>
1900 <xsl:when test=" $clsCode = 'CONS' ">
1901 <xsl:text>consent</xsl:text>
1902 </xsl:when>
1903 <xsl:when test=" $clsCode = 'CONTREG' ">
1904 <xsl:text>container registration</xsl:text>
1905 </xsl:when>
1906 <xsl:when test=" $clsCode = 'CTTEVENT' ">
1907 <xsl:text>clinical trial timepoint event</xsl:text>
1908 </xsl:when>
1909 <xsl:when test=" $clsCode = 'DISPACT' ">
1910 <xsl:text>disciplinary action</xsl:text>
1911 </xsl:when>
1912 <xsl:when test=" $clsCode = 'ENC' ">
1913 <xsl:text>encounter</xsl:text>
1914 </xsl:when>
1915 <xsl:when test=" $clsCode = 'INC' ">
1916 <xsl:text>incident</xsl:text>
1917 </xsl:when>
1918 <xsl:when test=" $clsCode = 'INFRM' ">
1919 <xsl:text>inform</xsl:text>
1920 </xsl:when>
1921 <xsl:when test=" $clsCode = 'INVE' ">
1922 <xsl:text>invoice element</xsl:text>
1923 </xsl:when>
1924 <xsl:when test=" $clsCode = 'LIST' ">
1925 <xsl:text>working list</xsl:text>
1926 </xsl:when>
1927 <xsl:when test=" $clsCode = 'MPROT' ">
1928 <xsl:text>monitoring program</xsl:text>
1929 </xsl:when>
1930 <xsl:when test=" $clsCode = 'PCPR' ">
1931 <xsl:text>care provision</xsl:text>
1932 </xsl:when>
1933 <xsl:when test=" $clsCode = 'PROC' ">
1934 <xsl:text>procedure</xsl:text>
1935 </xsl:when>
1936 <xsl:when test=" $clsCode = 'REG' ">
1937 <xsl:text>registration</xsl:text>
1938 </xsl:when>
1939 <xsl:when test=" $clsCode = 'REV' ">
1940 <xsl:text>review</xsl:text>
1941 </xsl:when>
1942 <xsl:when test=" $clsCode = 'SBADM' ">
1943 <xsl:text>substance administration</xsl:text>
1944 </xsl:when>
1945 <xsl:when test=" $clsCode = 'SPCTRT' ">
1946 <xsl:text>speciment treatment</xsl:text>
1947 </xsl:when>
1948 <xsl:when test=" $clsCode = 'SUBST' ">
1949 <xsl:text>substitution</xsl:text>
1950 </xsl:when>
1951 <xsl:when test=" $clsCode = 'TRNS' ">
1952 <xsl:text>transportation</xsl:text>
1953 </xsl:when>
1954 <xsl:when test=" $clsCode = 'VERIF' ">
1955 <xsl:text>verification</xsl:text>
1956 </xsl:when>
1957 <xsl:when test=" $clsCode = 'XACT' ">
1958 <xsl:text>financial transaction</xsl:text>
1959 </xsl:when>
1960 </xsl:choose>
1961 </xsl:template>
1962 <!-- show participationType -->
1963 <xsl:template name="show-participationType">
1964 <xsl:param name="ptype"/>
1965 <xsl:choose>
1966 <xsl:when test=" $ptype='PPRF' ">
1967 <xsl:text>primary performer</xsl:text>
1968 </xsl:when>
1969 <xsl:when test=" $ptype='PRF' ">
1970 <xsl:text>performer</xsl:text>
1971 </xsl:when>
1972 <xsl:when test=" $ptype='VRF' ">
1973 <xsl:text>verifier</xsl:text>
1974 </xsl:when>
1975 <xsl:when test=" $ptype='SPRF' ">
1976 <xsl:text>secondary performer</xsl:text>
1977 </xsl:when>
1978 </xsl:choose>
1979 </xsl:template>
1980 <!-- show participationFunction -->
1981 <xsl:template name="show-participationFunction">
1982 <xsl:param name="pFunction"/>
1983 <xsl:choose>
1984 <!-- From the HL7 v3 ParticipationFunction code system -->
1985 <xsl:when test=" $pFunction = 'ADMPHYS' ">
1986 <xsl:text>(admitting physician)</xsl:text>
1987 </xsl:when>
1988 <xsl:when test=" $pFunction = 'ANEST' ">
1989 <xsl:text>(anesthesist)</xsl:text>
1990 </xsl:when>
1991 <xsl:when test=" $pFunction = 'ANRS' ">
1992 <xsl:text>(anesthesia nurse)</xsl:text>
1993 </xsl:when>
1994 <xsl:when test=" $pFunction = 'ATTPHYS' ">
1995 <xsl:text>(attending physician)</xsl:text>
1996 </xsl:when>
1997 <xsl:when test=" $pFunction = 'DISPHYS' ">
1998 <xsl:text>(discharging physician)</xsl:text>
1999 </xsl:when>
2000 <xsl:when test=" $pFunction = 'FASST' ">
2001 <xsl:text>(first assistant surgeon)</xsl:text>
2002 </xsl:when>
2003 <xsl:when test=" $pFunction = 'MDWF' ">
2004 <xsl:text>(midwife)</xsl:text>
2005 </xsl:when>
2006 <xsl:when test=" $pFunction = 'NASST' ">
2007 <xsl:text>(nurse assistant)</xsl:text>
2008 </xsl:when>
2009 <xsl:when test=" $pFunction = 'PCP' ">
2010 <xsl:text>(primary care physician)</xsl:text>
2011 </xsl:when>
2012 <xsl:when test=" $pFunction = 'PRISURG' ">
2013 <xsl:text>(primary surgeon)</xsl:text>
2014 </xsl:when>
2015 <xsl:when test=" $pFunction = 'RNDPHYS' ">
2016 <xsl:text>(rounding physician)</xsl:text>
2017 </xsl:when>
2018 <xsl:when test=" $pFunction = 'SASST' ">
2019 <xsl:text>(second assistant surgeon)</xsl:text>
2020 </xsl:when>
2021 <xsl:when test=" $pFunction = 'SNRS' ">
2022 <xsl:text>(scrub nurse)</xsl:text>
2023 </xsl:when>
2024 <xsl:when test=" $pFunction = 'TASST' ">
2025 <xsl:text>(third assistant)</xsl:text>
2026 </xsl:when>
2027 <!-- From the HL7 v2 Provider Role code system (2.16.840.1.113883.12.443) which is used by HITSP -->
2028 <xsl:when test=" $pFunction = 'CP' ">
2029 <xsl:text>(consulting provider)</xsl:text>
2030 </xsl:when>
2031 <xsl:when test=" $pFunction = 'PP' ">
2032 <xsl:text>(primary care provider)</xsl:text>
2033 </xsl:when>
2034 <xsl:when test=" $pFunction = 'RP' ">
2035 <xsl:text>(referring provider)</xsl:text>
2036 </xsl:when>
2037 <xsl:when test=" $pFunction = 'MP' ">
2038 <xsl:text>(medical home provider)</xsl:text>
2039 </xsl:when>
2040 </xsl:choose>
2041 </xsl:template>
2042 <xsl:template name="formatDateTime">
2043 <xsl:param name="date"/>
2044 <!-- month -->
2045 <xsl:variable name="month" select="substring ($date, 5, 2)"/>
2046 <xsl:choose>
2047 <xsl:when test="$month='01'">
2048 <xsl:text>January </xsl:text>
2049 </xsl:when>
2050 <xsl:when test="$month='02'">
2051 <xsl:text>February </xsl:text>
2052 </xsl:when>
2053 <xsl:when test="$month='03'">
2054 <xsl:text>March </xsl:text>
2055 </xsl:when>
2056 <xsl:when test="$month='04'">
2057 <xsl:text>April </xsl:text>
2058 </xsl:when>
2059 <xsl:when test="$month='05'">
2060 <xsl:text>May </xsl:text>
2061 </xsl:when>
2062 <xsl:when test="$month='06'">
2063 <xsl:text>June </xsl:text>
2064 </xsl:when>
2065 <xsl:when test="$month='07'">
2066 <xsl:text>July </xsl:text>
2067 </xsl:when>
2068 <xsl:when test="$month='08'">
2069 <xsl:text>August </xsl:text>
2070 </xsl:when>
2071 <xsl:when test="$month='09'">
2072 <xsl:text>September </xsl:text>
2073 </xsl:when>
2074 <xsl:when test="$month='10'">
2075 <xsl:text>October </xsl:text>
2076 </xsl:when>
2077 <xsl:when test="$month='11'">
2078 <xsl:text>November </xsl:text>
2079 </xsl:when>
2080 <xsl:when test="$month='12'">
2081 <xsl:text>December </xsl:text>
2082 </xsl:when>
2083 </xsl:choose>
2084 <!-- day -->
2085 <xsl:choose>
2086 <xsl:when test='substring ($date, 7, 1)="0"'>
2087 <xsl:value-of select="substring ($date, 8, 1)"/>
2088 <xsl:text>, </xsl:text>
2089 </xsl:when>
2090 <xsl:otherwise>
2091 <xsl:value-of select="substring ($date, 7, 2)"/>
2092 <xsl:text>, </xsl:text>
2093 </xsl:otherwise>
2094 </xsl:choose>
2095 <!-- year -->
2096 <xsl:value-of select="substring ($date, 1, 4)"/>
2097 <!-- time and US timezone -->
2098 <xsl:if test="string-length($date) > 8">
2099 <xsl:text>, </xsl:text>
2100 <!-- time -->
2101 <xsl:variable name="time">
2102 <xsl:value-of select="substring($date,9,6)"/>
2103 </xsl:variable>
2104 <xsl:variable name="hh">
2105 <xsl:value-of select="substring($time,1,2)"/>
2106 </xsl:variable>
2107 <xsl:variable name="mm">
2108 <xsl:value-of select="substring($time,3,2)"/>
2109 </xsl:variable>
2110 <xsl:variable name="ss">
2111 <xsl:value-of select="substring($time,5,2)"/>
2112 </xsl:variable>
2113 <xsl:if test="string-length($hh)&gt;1">
2114 <xsl:value-of select="$hh"/>
2115 <xsl:if test="string-length($mm)&gt;1 and not(contains($mm,'-')) and not (contains($mm,'+'))">
2116 <xsl:text>:</xsl:text>
2117 <xsl:value-of select="$mm"/>
2118 <xsl:if test="string-length($ss)&gt;1 and not(contains($ss,'-')) and not (contains($ss,'+'))">
2119 <xsl:text>:</xsl:text>
2120 <xsl:value-of select="$ss"/>
2121 </xsl:if>
2122 </xsl:if>
2123 </xsl:if>
2124 <!-- time zone -->
2125 <xsl:variable name="tzon">
2126 <xsl:choose>
2127 <xsl:when test="contains($date,'+')">
2128 <xsl:text>+</xsl:text>
2129 <xsl:value-of select="substring-after($date, '+')"/>
2130 </xsl:when>
2131 <xsl:when test="contains($date,'-')">
2132 <xsl:text>-</xsl:text>
2133 <xsl:value-of select="substring-after($date, '-')"/>
2134 </xsl:when>
2135 </xsl:choose>
2136 </xsl:variable>
2137 <xsl:choose>
2138 <!-- reference: http://www.timeanddate.com/library/abbreviations/timezones/na/ -->
2139 <xsl:when test="$tzon = '-0500' ">
2140 <xsl:text>, EST</xsl:text>
2141 </xsl:when>
2142 <xsl:when test="$tzon = '-0600' ">
2143 <xsl:text>, CST</xsl:text>
2144 </xsl:when>
2145 <xsl:when test="$tzon = '-0700' ">
2146 <xsl:text>, MST</xsl:text>
2147 </xsl:when>
2148 <xsl:when test="$tzon = '-0800' ">
2149 <xsl:text>, PST</xsl:text>
2150 </xsl:when>
2151 <xsl:otherwise>
2152 <xsl:text> </xsl:text>
2153 <xsl:value-of select="$tzon"/>
2154 </xsl:otherwise>
2155 </xsl:choose>
2156 </xsl:if>
2157 </xsl:template>
2158 <!-- convert to lower case -->
2159 <xsl:template name="caseDown">
2160 <xsl:param name="data"/>
2161 <xsl:if test="$data">
2162 <xsl:value-of select="translate($data, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ','abcdefghijklmnopqrstuvwxyz')"/>
2163 </xsl:if>
2164 </xsl:template>
2165 <!-- convert to upper case -->
2166 <xsl:template name="caseUp">
2167 <xsl:param name="data"/>
2168 <xsl:if test="$data">
2169 <xsl:value-of select="translate($data,'abcdefghijklmnopqrstuvwxyz', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ')"/>
2170 </xsl:if>
2171 </xsl:template>
2172 <!-- convert first character to upper case -->
2173 <xsl:template name="firstCharCaseUp">
2174 <xsl:param name="data"/>
2175 <xsl:if test="$data">
2176 <xsl:call-template name="caseUp">
2177 <xsl:with-param name="data" select="substring($data,1,1)"/>
2178 </xsl:call-template>
2179 <xsl:value-of select="substring($data,2)"/>
2180 </xsl:if>
2181 </xsl:template>
2182 <!-- show-noneFlavor -->
2183 <xsl:template name="show-noneFlavor">
2184 <xsl:param name="nf"/>
2185 <xsl:choose>
2186 <xsl:when test=" $nf = 'NI' ">
2187 <xsl:text>no information</xsl:text>
2188 </xsl:when>
2189 <xsl:when test=" $nf = 'INV' ">
2190 <xsl:text>invalid</xsl:text>
2191 </xsl:when>
2192 <xsl:when test=" $nf = 'MSK' ">
2193 <xsl:text>masked</xsl:text>
2194 </xsl:when>
2195 <xsl:when test=" $nf = 'NA' ">
2196 <xsl:text>not applicable</xsl:text>
2197 </xsl:when>
2198 <xsl:when test=" $nf = 'UNK' ">
2199 <xsl:text>unknown</xsl:text>
2200 </xsl:when>
2201 <xsl:when test=" $nf = 'OTH' ">
2202 <xsl:text>other</xsl:text>
2203 </xsl:when>
2204 </xsl:choose>
2205 </xsl:template>
2206 <xsl:template name="addCSS">
2207 <style type="text/css">
2208 <xsl:text>
2209 body {
2210 color: #003366;
2211 background-color: #FFFFFF;
2212 font-family: Verdana, Tahoma, sans-serif;
2213 font-size: 11px;
2217 color: #003366;
2218 background-color: #FFFFFF;
2221 h1 {
2222 font-size: 12pt;
2223 font-weight: bold;
2226 h2 {
2227 font-size: 11pt;
2228 font-weight: bold;
2231 h3 {
2232 font-size: 10pt;
2233 font-weight: bold;
2236 h4 {
2237 font-size: 8pt;
2238 font-weight: bold;
2241 div {
2242 width: 80%;
2245 table {
2246 line-height: 10pt;
2247 width: 80%;
2250 tr {
2251 background-color: #ccccff;
2254 td {
2255 padding: 0.1cm 0.2cm;
2256 vertical-align: top;
2259 .h1center {
2260 font-size: 12pt;
2261 font-weight: bold;
2262 text-align: center;
2263 width: 80%;
2266 .header_table{
2267 border: 1pt inset #00008b;
2270 .narr_table {
2271 width: 100%;
2274 .narr_tr {
2275 background-color: #ffffcc;
2278 .narr_th {
2279 background-color: #ffd700;
2282 .td_label{
2283 font-weight: bold;
2284 color: white;
2286 </xsl:text>
2287 </style>
2288 </xsl:template>
2289 </xsl:stylesheet>