Quick bug fix: Escaping of a string literal within an onClick tag.
[openemr.git] / ccr / ccr.xsl
blob2501dd1d2a7e40374215c2e1c65622bce58499ef
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!--
4 Copyright 2007 American Academy of Family Physicians
6 Licensed under the Apache License, Version 2.0 (the "License");
7 you may not use this file except in compliance with the License.
8 You may obtain a copy of the License at
10 http://www.apache.org/licenses/LICENSE-2.0
12 Unless required by applicable law or agreed to in writing, software distributed
13 under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
14 CONDITIONS OF ANY KIND, either express or implied. See the License for the
15 specific language governing permissions and limitations under the License.
17 This XSLT creates a simple HTML representation of the ASTM Continuity of Care Record.
18 This representation does not present all the potential data storable in the CCR.
19 Instead it gives a potential clinical representation of the CCR instance. There is
20 the potential for important information in a CCR to not be displayed in the resulting
21 HTML.
23 Derived works MUST change the footer.xsl template to denote that the resulting HTML
24 is a derived work from the AAFP's XSLT or remove the display of the "American Academy
25 of Family Physicians" name.
28 Although not required, it is encouraged to submit modifications or improvements to
29 this XSLT back to the community.
31 Author: Steven E. Waldren, MD
32 American Academy of Family Physicians
33 swaldren@aafp.org
35 Coauthors: Ken Miller Simon Sadedin
36 Solventus Medcommons
38 Date: 2007-06-01
39 Version: 2.0
41 -->
42 <xsl:stylesheet exclude-result-prefixes="a date str" version="1.0" xmlns:a="urn:astm-org:CCR" xmlns:date="http://exslt.org/dates-and-times" xmlns:str="http://exslt.org/strings" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
43 <xsl:output encoding="UTF-8" method="html"/>
44 <!-- XSL Parameters -->
45 <!-- This param can be used to define different CCS style sheets
46 If not passed, the default will be used -->
47 <xsl:param name="stylesheet"/>
48 <xsl:template match="/">
49 <html>
50 <head>
51 <!-- Load in the CSS file -->
52 <xsl:choose>
53 <xsl:when test="$stylesheet!=''">
54 <link href="{$stylesheet}" rel="stylesheet" type="text/css"/>
55 </xsl:when>
56 <xsl:otherwise>
57 <xsl:call-template name="defaultCCS"/>
58 <!-- call to ./templates/defaultCCS.xsl-->
59 </xsl:otherwise>
60 </xsl:choose>
61 <title>Continuity of Care Record</title>
62 </head>
63 <body>
65 <a href="../interface/patient_file/report/patient_report.php">
66 <span >Patient Report</span>
67 <span >(Back)</span>
68 </a><br/><br/>
70 <table cellPadding="1" cellSpacing="1">
71 <tbody>
72 <tr>
73 <td>
74 <table cellPadding="1" cellSpacing="1">
75 <tbody>
76 <tr id="ccrheaderrow">
77 <td>
78 <h1>Continuity of Care Record
79 <br/>
80 </h1>
81 <table bgColor="#ffffcc" cellPadding="1" cellSpacing="3" id="ccrheader" width="75%">
82 <tbody>
83 <tr>
84 <td>
85 <strong>Date Created:</strong>
86 </td>
87 <td>
88 <xsl:call-template name="date:format-date">
89 <xsl:with-param name="date-time">
90 <xsl:value-of select="a:ContinuityOfCareRecord/a:DateTime/a:ExactDateTime"/>
91 </xsl:with-param>
92 <xsl:with-param name="pattern">EEE MMM dd, yyyy 'at' hh:mm aa zzz</xsl:with-param>
93 </xsl:call-template>
94 </td>
95 </tr>
96 <tr>
97 <td>
98 <strong>From:</strong>
99 </td>
100 <td>
101 <xsl:for-each select="a:ContinuityOfCareRecord/a:From/a:ActorLink">
102 <xsl:call-template name="actorName">
103 <xsl:with-param name="objID" select="a:ActorID"/>
104 </xsl:call-template>
105 <xsl:if test="a:ActorRole/a:Text">
106 <xsl:text xml:space="preserve"> (</xsl:text>
107 <xsl:value-of select="a:ActorRole/a:Text"/>
108 <xsl:text>)</xsl:text>
109 </xsl:if>
110 <br/>
111 </xsl:for-each>
112 </td>
113 </tr>
114 <tr>
115 <td>
116 <strong>To:</strong>
117 </td>
118 <td>
119 <xsl:for-each select="a:ContinuityOfCareRecord/a:To/a:ActorLink">
120 <xsl:call-template name="actorName">
121 <xsl:with-param name="objID" select="a:ActorID"/>
122 </xsl:call-template>
123 <xsl:if test="a:ActorRole/a:Text">
124 <xsl:text xml:space="preserve"> (</xsl:text>
125 <xsl:value-of select="a:ActorRole/a:Text"/>
126 <xsl:text>)</xsl:text>
127 </xsl:if>
128 <br/>
129 </xsl:for-each>
130 </td>
131 </tr>
132 <tr>
133 <td>
134 <strong>Purpose:</strong>
135 </td>
136 <td>
137 <xsl:value-of select="a:ContinuityOfCareRecord/a:Purpose/a:Description/a:Text"/>
138 </td>
139 </tr>
140 </tbody>
141 </table>
142 <br/>
143 </td>
144 </tr>
145 <tr id="demographicsrow">
146 <td>
147 <span class="header">Patient Demographics</span>
148 <br/>
149 <table class="list" id="demographics">
150 <tbody>
151 <tr>
152 <th>Name</th>
153 <th>Date of Birth</th>
154 <th>Gender</th>
155 <th>Identification Numbers</th>
156 <th>Address / Phone</th>
157 </tr>
158 <xsl:for-each select="a:ContinuityOfCareRecord/a:Patient">
159 <xsl:variable name="objID" select="a:ActorID"/>
160 <xsl:for-each select="/a:ContinuityOfCareRecord/a:Actors/a:Actor">
161 <xsl:variable name="thisObjID" select="a:ActorObjectID"/>
162 <xsl:if test="$objID = $thisObjID">
163 <tr>
164 <td>
165 <xsl:call-template name="actorName">
166 <xsl:with-param name="objID">
167 <xsl:value-of select="$thisObjID"/>
168 </xsl:with-param>
169 </xsl:call-template>
170 <br/>
171 </td>
172 <td>
173 <table class="internal">
174 <tbody>
175 <xsl:call-template name="dateTime">
176 <xsl:with-param name="dt" select="a:Person/a:DateOfBirth"/>
177 </xsl:call-template>
178 </tbody>
179 </table>
180 </td>
181 <td>
182 <xsl:value-of select="a:Person/a:Gender/a:Text"/>
183 </td>
184 <td>
185 <table class="internal">
186 <tbody>
187 <xsl:for-each select="a:IDs">
188 <tr>
189 <td width="50%">
190 <xsl:value-of select="a:Type/a:Text"/>
191 </td>
192 <td width="50%">
193 <xsl:value-of select="a:ID"/>
194 </td>
195 </tr>
196 </xsl:for-each>
197 </tbody>
198 </table>
199 </td>
200 <td>
201 <xsl:for-each select="a:Address">
202 <xsl:if test="a:Type">
204 <xsl:value-of select="a:Type/a:Text"/>:</b>
205 <br/>
206 </xsl:if>
207 <xsl:if test="a:Line1">
208 <xsl:value-of select="a:Line1"/>
209 <br/>
210 </xsl:if>
211 <xsl:if test="a:Line2">
212 <xsl:value-of select="a:Line2"/>
213 <br/>
214 </xsl:if>
215 <xsl:if test="a:City">
216 <xsl:value-of select="a:City"/>,
217 </xsl:if>
218 <xsl:value-of select="a:State"/>
219 <xsl:value-of select="a:PostalCode"/>
220 <br/>
221 </xsl:for-each>
222 <xsl:for-each select="a:Telephone">
223 <br/>
224 <xsl:if test="a:Type/a:Text">
225 <xsl:value-of select="a:Type/a:Text"/>:
226 </xsl:if>
227 <xsl:value-of select="a:Value"/>
228 </xsl:for-each>
229 </td>
230 </tr>
231 </xsl:if>
232 </xsl:for-each>
233 </xsl:for-each>
234 </tbody>
235 </table>
236 </td>
237 </tr>
238 <span id="ccrcontent">
239 <xsl:if test="a:ContinuityOfCareRecord/a:Body/a:Alerts">
240 <tr id="alertsrow">
241 <td>
242 <span class="header">Alerts</span>
243 <br/>
244 <table class="list" id="alerts">
245 <tbody>
246 <tr>
247 <th>Type</th>
248 <th>Date</th>
249 <th>Code</th>
250 <th>Description</th>
251 <th>Reaction</th>
252 <th>Source</th>
253 </tr>
254 <xsl:for-each select="a:ContinuityOfCareRecord/a:Body/a:Alerts/a:Alert">
255 <tr>
256 <td>
257 <xsl:value-of select="a:Type/a:Text"/>
258 </td>
259 <td>
260 <table class="internal">
261 <tbody>
262 <xsl:call-template name="dateTime">
263 <xsl:with-param name="dt" select="a:DateTime"/>
264 </xsl:call-template>
265 </tbody>
266 </table>
267 </td>
268 <td>
269 <xsl:apply-templates select="a:Description/a:Code"/>
270 </td>
271 <td>
272 <strong class="clinical">
273 <xsl:value-of select="a:Description/a:Text"/>
274 </strong>
275 </td>
276 <td>
277 <xsl:value-of select="a:Reaction/a:Description/a:Text"/>
278 <xsl:if test="a:Reaction/a:Severity/a:Text">
279 <xsl:text>-</xsl:text>
280 <xsl:value-of select="a:Reaction/a:Severity/a:Text"/>
281 </xsl:if>
282 </td>
283 <td>
285 <xsl:attribute name="href">
286 <xsl:text>#</xsl:text>
287 <xsl:value-of select="a:Source/a:Actor/a:ActorID"/>
288 </xsl:attribute>
289 <xsl:call-template name="actorName">
290 <xsl:with-param name="objID" select="a:Source/a:Actor/a:ActorID"/>
291 </xsl:call-template>
292 </a>
293 </td>
294 </tr>
295 </xsl:for-each>
296 </tbody>
297 </table>
298 </td>
299 </tr>
300 </xsl:if>
301 <xsl:if test="a:ContinuityOfCareRecord/a:Body/a:AdvanceDirectives">
302 <tr id="advancedirectivesrow">
303 <td>
304 <span class="header">Advance Directives</span>
305 <br/>
306 <table class="list" id="advancedirectives">
307 <tbody>
308 <tr>
309 <th>Type</th>
310 <th>Date</th>
311 <th>Description</th>
312 <th>Status</th>
313 <th>Source</th>
314 </tr>
315 <xsl:for-each select="a:ContinuityOfCareRecord/a:Body/a:AdvanceDirectives/a:AdvanceDirective">
316 <tr>
317 <td>
318 <xsl:value-of select="a:Type/a:Text"/>
319 </td>
320 <td>
321 <table class="internal">
322 <tbody>
323 <xsl:call-template name="dateTime">
324 <xsl:with-param name="dt" select="a:DateTime"/>
325 </xsl:call-template>
326 </tbody>
327 </table>
328 </td>
329 <td>
330 <strong class="clinical">
331 <xsl:value-of select="a:Description/a:Text"/>
332 </strong>
333 </td>
334 <td>
335 <xsl:value-of select="a:Status/a:Text"/>
336 </td>
337 <td>
339 <xsl:attribute name="href">
340 <xsl:text>#</xsl:text>
341 <xsl:value-of select="a:Source/a:Actor/a:ActorID"/>
342 </xsl:attribute>
343 <xsl:call-template name="actorName">
344 <xsl:with-param name="objID" select="a:Source/a:Actor/a:ActorID"/>
345 </xsl:call-template>
346 </a>
347 </td>
348 </tr>
349 </xsl:for-each>
350 </tbody>
351 </table>
352 </td>
353 </tr>
354 </xsl:if>
355 <xsl:if test="a:ContinuityOfCareRecord/a:Body/a:Support">
356 <tr id="supportprovidersrow">
357 <td>
358 <span class="header" id="supportproviders">Support Providers</span>
359 <br/>
360 <table class="list">
361 <tbody>
362 <tr>
363 <th>Role</th>
364 <th>Name</th>
365 </tr>
366 <xsl:for-each select="a:ContinuityOfCareRecord/a:Body/a:Support/a:SupportProvider">
367 <tr>
368 <td>
369 <xsl:value-of select="a:ActorRole/a:Text"/>
370 </td>
371 <td>
373 <xsl:attribute name="href">
374 <xsl:text>#</xsl:text>
375 <xsl:value-of select="a:Source/a:Actor/a:ActorID"/>
376 </xsl:attribute>
377 <xsl:call-template name="actorName">
378 <xsl:with-param name="objID" select="a:ActorID"/>
379 </xsl:call-template>
380 </a>
381 </td>
382 </tr>
383 </xsl:for-each>
384 </tbody>
385 </table>
386 </td>
387 </tr>
388 </xsl:if>
389 <xsl:if test="a:ContinuityOfCareRecord/a:Body/a:FunctionalStatus">
390 <tr id="functionalstatus">
391 <td>
392 <span class="header">Functional Status</span>
393 <br/>
394 <table class="list">
395 <tbody>
396 <tr>
397 <th>Type</th>
398 <th>Date</th>
399 <th>Code</th>
400 <th>Description</th>
401 <th>Status</th>
402 <th>Source</th>
403 </tr>
404 <xsl:for-each select="a:ContinuityOfCareRecord/a:Body/a:FunctionalStatus/a:Function">
405 <tr>
406 <td>
407 <xsl:value-of select="a:Type/a:Text"/>
408 </td>
409 <td>
410 <table class="internal">
411 <tbody>
412 <xsl:call-template name="dateTime">
413 <xsl:with-param name="dt" select="a:DateTime"/>
414 </xsl:call-template>
415 </tbody>
416 </table>
417 </td>
418 <td>
419 <xsl:apply-templates select="a:Description/a:Code"/>
420 </td>
421 <td>
422 <strong class="clinical">
423 <xsl:value-of select="a:Description/a:Text"/>
424 </strong>
425 </td>
426 <td>
427 <xsl:value-of select="a:Status/a:Text"/>
428 </td>
429 <td>
431 <xsl:attribute name="href">
432 <xsl:text>#</xsl:text>
433 <xsl:value-of select="a:Source/a:Actor/a:ActorID"/>
434 </xsl:attribute>
435 <xsl:call-template name="actorName">
436 <xsl:with-param name="objID" select="a:Source/a:Actor/a:ActorID"/>
437 </xsl:call-template>
438 </a>
439 </td>
440 </tr>
441 </xsl:for-each>
442 </tbody>
443 </table>
444 </td>
445 </tr>
446 </xsl:if>
447 <xsl:if test="a:ContinuityOfCareRecord/a:Body/a:Problems">
448 <tr id="problemsrow">
449 <td>
450 <span class="header">Problems</span>
451 <br/>
452 <table class="list" id="problems">
453 <tbody>
454 <tr>
455 <th>Type</th>
456 <th>Date</th>
457 <th>Code</th>
458 <th>Description</th>
459 <th>Status</th>
460 <th>Source</th>
461 </tr>
462 <xsl:for-each select="a:ContinuityOfCareRecord/a:Body/a:Problems/a:Problem">
463 <tr>
464 <td>
465 <xsl:value-of select="a:Type/a:Text"/>
466 </td>
467 <td>
468 <table class="internal">
469 <tbody>
470 <xsl:call-template name="dateTime">
471 <xsl:with-param name="dt" select="a:DateTime"/>
472 </xsl:call-template>
473 </tbody>
474 </table>
475 </td>
476 <td>
477 <xsl:apply-templates select="a:Description/a:Code"/>
478 </td>
479 <td>
480 <strong class="clinical">
481 <xsl:value-of select="a:Description/a:Text"/>
482 </strong>
483 </td>
484 <td>
485 <xsl:value-of select="a:Status/a:Text"/>
486 </td>
487 <td>
489 <xsl:attribute name="href">
490 <xsl:text>#</xsl:text>
491 <xsl:value-of select="a:Source/a:Actor/a:ActorID"/>
492 </xsl:attribute>
493 <xsl:call-template name="actorName">
494 <xsl:with-param name="objID" select="a:Source/a:Actor/a:ActorID"/>
495 </xsl:call-template>
496 </a>
497 </td>
498 </tr>
499 </xsl:for-each>
500 </tbody>
501 </table>
502 </td>
503 </tr>
504 </xsl:if>
505 <xsl:if test="a:ContinuityOfCareRecord/a:Body/a:Procedures">
506 <tr id="proceduresrow">
507 <td>
508 <span class="header">Procedures</span>
509 <br/>
510 <table class="list" id="procedures">
511 <tbody>
512 <tr>
513 <th>Type</th>
514 <th>Date</th>
515 <th>Code</th>
516 <th>Description</th>
517 <th>Location</th>
518 <th>Substance</th>
519 <th>Method</th>
520 <th>Position</th>
521 <th>Site</th>
522 <th>Status</th>
523 <th>Source</th>
524 </tr>
525 <xsl:for-each select="a:ContinuityOfCareRecord/a:Body/a:Procedures/a:Procedure">
526 <tr>
527 <td>
528 <xsl:value-of select="a:Type/a:Text"/>
529 </td>
530 <td>
531 <table class="internal">
532 <tbody>
533 <xsl:call-template name="dateTime">
534 <xsl:with-param name="dt" select="a:DateTime"/>
535 </xsl:call-template>
536 </tbody>
537 </table>
538 </td>
539 <td>
540 <xsl:apply-templates select="a:Description/a:Code"/>
541 </td>
542 <td>
543 <strong class="clinical">
544 <xsl:value-of select="a:Description/a:Text"/>
545 </strong>
546 </td>
547 <td>
548 <xsl:for-each select="a:Locations/a:Location">
549 <xsl:value-of select="a:Description/a:Text"/>
550 <xsl:if test="a:Actor">
551 <xsl:text>(</xsl:text>
552 <xsl:call-template name="actorName">
553 <xsl:with-param name="objID" select="a:Actor/a:ActorID"/>
554 </xsl:call-template>
555 <xsl:if test="a:Actor/a:ActorRole/a:Text">
556 <xsl:text xml:space="preserve"> </xsl:text>-<xsl:text xml:space="preserve"> </xsl:text>
557 <xsl:value-of select="a:ActorRole/a:Text"/>
558 <xsl:text>)</xsl:text>
559 </xsl:if>
560 </xsl:if>
561 <xsl:if test="position() != last()">
562 <br/>
563 </xsl:if>
564 </xsl:for-each>
565 </td>
566 <td>
567 <xsl:for-each select="a:Substance">
568 <xsl:value-of select="a:Text"/>
569 </xsl:for-each>
570 </td>
571 <td>
572 <xsl:value-of select="a:Method/a:Text"/>
573 </td>
574 <td>
575 <xsl:value-of select="a:Position/a:Text"/>
576 </td>
577 <td>
578 <xsl:value-of select="a:Site/a:Text"/>
579 </td>
580 <td>
581 <xsl:value-of select="a:Status/a:Text"/>
582 </td>
583 <td>
585 <xsl:attribute name="href">
586 <xsl:text>#</xsl:text>
587 <xsl:value-of select="a:Source/a:Actor/a:ActorID"/>
588 </xsl:attribute>
589 <xsl:call-template name="actorName">
590 <xsl:with-param name="objID" select="a:Source/a:Actor/a:ActorID"/>
591 </xsl:call-template>
592 </a>
593 </td>
594 </tr>
595 </xsl:for-each>
596 </tbody>
597 </table>
598 </td>
599 </tr>
600 </xsl:if>
601 <xsl:if test="a:ContinuityOfCareRecord/a:Body/a:Medications">
602 <tr id="medicationsrow">
603 <td>
604 <span class="header" id="medications">Medications</span>
605 <br/>
606 <table class="list">
607 <tbody>
608 <tr>
609 <th>Medication</th>
610 <th>Date</th>
611 <th>Status</th>
612 <th>Form</th>
613 <th>Strength</th>
614 <th>Quantity</th>
615 <th>SIG</th>
616 <th>Indications</th>
617 <th>Instruction</th>
618 <th>Refills</th>
619 <th>Source</th>
620 </tr>
621 <xsl:for-each select="a:ContinuityOfCareRecord/a:Body/a:Medications/a:Medication">
622 <tr>
623 <td>
624 <strong class="clinical">
625 <xsl:value-of select="a:Product/a:ProductName/a:Text"/>
626 <xsl:if test="a:Product/a:BrandName">
627 <xsl:text xml:space="preserve"> (</xsl:text>
628 <xsl:value-of select="a:Product/a:BrandName/a:Text"/>
629 <xsl:text>)</xsl:text>
630 </xsl:if>
631 </strong>
632 </td>
633 <td>
634 <table class="internal">
635 <tbody>
636 <xsl:call-template name="dateTime">
637 <xsl:with-param name="dt" select="a:DateTime"/>
638 </xsl:call-template>
639 </tbody>
640 </table>
641 </td>
642 <td>
643 <xsl:value-of select="a:Status/a:Text"/>
644 </td>
645 <td>
646 <xsl:value-of select="a:Product/a:Form/a:Text"/>
647 </td>
648 <td>
649 <xsl:for-each select="a:Product/a:Strength">
650 <xsl:if test="position() > 1">
651 <xsl:text>/</xsl:text>
652 </xsl:if>
653 <xsl:value-of select="a:Value"/>
654 <xsl:text xml:space="preserve"> </xsl:text>
655 <xsl:value-of select="a:Units/a:Unit"/>
656 </xsl:for-each>
657 </td>
658 <td>
659 <xsl:value-of select="a:Quantity/a:Value"/>
660 <xsl:text xml:space="preserve"> </xsl:text>
661 <xsl:value-of select="a:Quantity/a:Units/a:Unit"/>
662 </td>
663 <td>
664 <table border="1" class="internal">
665 <tbody>
666 <xsl:apply-templates select="a:Directions"/>
667 <!-- call to /templates/directions.xsl -->
668 </tbody>
669 </table>
670 </td>
671 <td>
672 <xsl:for-each select="a:Indications/a:Indication">
673 <xsl:call-template name="problemDescription">
674 <xsl:with-param name="objID" select="a:InternalCCRLink/a:LinkID"/>
675 </xsl:call-template>
676 <br/>
677 </xsl:for-each>
678 </td>
679 <td>
680 <xsl:for-each select="a:PatientInstructions/a:Instruction">
681 <xsl:value-of select="a:Text"/>
682 <br/>
683 </xsl:for-each>
684 </td>
685 <td>
686 <xsl:for-each select="a:Refills/a:Refill">
687 <xsl:value-of select="a:Number"/>
688 <xsl:text xml:space="preserve"> </xsl:text>
689 </xsl:for-each>
690 </td>
691 <td>
693 <xsl:attribute name="href">
694 <xsl:text>#</xsl:text>
695 <xsl:value-of select="a:Source/a:Actor/a:ActorID"/>
696 </xsl:attribute>
697 <xsl:call-template name="actorName">
698 <xsl:with-param name="objID" select="a:Source/a:Actor/a:ActorID"/>
699 </xsl:call-template>
700 </a>
701 </td>
702 </tr>
703 </xsl:for-each>
704 </tbody>
705 </table>
706 </td>
707 </tr>
708 </xsl:if>
709 <xsl:if test="a:ContinuityOfCareRecord/a:Body/a:Immunizations">
710 <tr id="immunizationsrow">
711 <td>
712 <span class="header">Immunizations</span>
713 <br/>
714 <table class="list" id="immunizations">
715 <tbody>
716 <tr>
717 <th>Code</th>
718 <th>Vaccine</th>
719 <th>Date</th>
720 <th>Route</th>
721 <th>Site</th>
722 <th>Source</th>
723 </tr>
724 <xsl:for-each select="a:ContinuityOfCareRecord/a:Body/a:Immunizations/a:Immunization">
725 <tr>
726 <td>
727 <xsl:apply-templates select="a:Product/a:ProductName/a:Code"/>
728 </td>
729 <td>
730 <strong class="clinical">
731 <xsl:value-of select="a:Product/a:ProductName/a:Text"/>
732 <xsl:if test="a:Product/a:Form">
733 <xsl:text xml:space="preserve"> (</xsl:text>
734 <xsl:value-of select="a:Product/a:Form/a:Text"/>
735 <xsl:text>)</xsl:text>
736 </xsl:if>
737 </strong>
738 </td>
739 <td>
740 <table class="internal">
741 <tbody>
742 <xsl:call-template name="dateTime">
743 <xsl:with-param name="dt" select="a:DateTime"/>
744 </xsl:call-template>
745 </tbody>
746 </table>
747 </td>
748 <td>
749 <xsl:value-of select="a:Directions/a:Direction/a:Route/a:Text"/>
750 </td>
751 <td>
752 <xsl:value-of select="a:Directions/a:Direction/a:Site/a:Text"/>
753 </td>
754 <td>
756 <xsl:attribute name="href">
757 <xsl:text>#</xsl:text>
758 <xsl:value-of select="a:Source/a:Actor/a:ActorID"/>
759 </xsl:attribute>
760 <xsl:call-template name="actorName">
761 <xsl:with-param name="objID" select="a:Source/a:Actor/a:ActorID"/>
762 </xsl:call-template>
763 </a>
764 </td>
765 </tr>
766 </xsl:for-each>
767 </tbody>
768 </table>
769 </td>
770 </tr>
771 </xsl:if>
772 <xsl:if test="a:ContinuityOfCareRecord/a:Body/a:VitalSigns">
773 <tr id="vitalsignsrow">
774 <td>
775 <span class="header">Vital Signs</span>
776 <br/>
777 <table class="list" id="vitalsigns">
778 <tbody>
779 <tr>
780 <th>Vital Sign</th>
781 <th>Date</th>
782 <th>Result</th>
783 <th>Source</th>
784 </tr>
785 <xsl:for-each select="a:ContinuityOfCareRecord/a:Body/a:VitalSigns/a:Result">
786 <tr>
787 <td>
788 <xsl:value-of select="a:Description/a:Text"/>
789 </td>
790 <td>
791 <table class="internal">
792 <tbody>
793 <xsl:call-template name="dateTime">
794 <xsl:with-param name="dt" select="a:DateTime"/>
795 <xsl:with-param name="fmt">MMM dd, yyyy ':' hh:mm aa zzz</xsl:with-param>
796 </xsl:call-template>
797 </tbody>
798 </table>
799 </td>
800 <td>
801 <table class="internal">
802 <tbody>
803 <xsl:for-each select="a:Test">
804 <xsl:choose>
805 <xsl:when test="position() mod 2=0">
806 <tr class="even">
807 <td width="33%">
808 <strong class="clinical">
809 <xsl:value-of select="a:Description/a:Text"/>
810 </strong>
811 </td>
812 <td width="33%">
813 <xsl:value-of select="a:TestResult/a:Value"/>
814 <xsl:text xml:space="preserve"> </xsl:text>
815 <xsl:value-of select="a:TestResult/a:Units/a:Unit"/>
816 </td>
817 <td width="33%">
818 <xsl:value-of select="a:Flag/a:Text"/>
819 </td>
820 </tr>
821 </xsl:when>
822 <xsl:otherwise>
823 <tr class="odd">
824 <td width="33%">
825 <strong class="clinical">
826 <xsl:value-of select="a:Description/a:Text"/>
827 </strong>
828 </td>
829 <td width="33%">
830 <xsl:value-of select="a:TestResult/a:Value"/>
831 <xsl:text xml:space="preserve"> </xsl:text>
832 <xsl:value-of select="a:TestResult/a:Units/a:Unit"/>
833 </td>
834 <td width="33%">
835 <xsl:value-of select="a:Flag/a:Text"/>
836 </td>
837 </tr>
838 </xsl:otherwise>
839 </xsl:choose>
840 </xsl:for-each>
841 </tbody>
842 </table>
843 </td>
844 <td>
846 <xsl:attribute name="href">
847 <xsl:text>#</xsl:text>
848 <xsl:value-of select="a:Source/a:Actor/a:ActorID"/>
849 </xsl:attribute>
850 <xsl:call-template name="actorName">
851 <xsl:with-param name="objID" select="a:Source/a:Actor/a:ActorID"/>
852 </xsl:call-template>
853 </a>
854 </td>
855 </tr>
856 </xsl:for-each>
857 </tbody>
858 </table>
859 </td>
860 </tr>
861 </xsl:if>
862 <xsl:if test="a:ContinuityOfCareRecord/a:Body/a:Encounters">
863 <tr id="encountersrow">
864 <td>
865 <span class="header">Encounters</span>
866 <br/>
867 <table class="list" id="encounters">
868 <tbody>
869 <tr>
870 <th>Type</th>
871 <th>Date</th>
872 <th>Location</th>
873 <th>Status</th>
874 <th>Practitioner</th>
875 <th>Description</th>
876 <th>Indications</th>
877 <th>Source</th>
878 </tr>
879 <xsl:for-each select="a:ContinuityOfCareRecord/a:Body/a:Encounters/a:Encounter">
880 <tr>
881 <td>
882 <xsl:value-of select="a:Type/a:Text"/>
883 </td>
884 <td>
885 <table class="internal">
886 <tbody>
887 <xsl:call-template name="dateTime">
888 <xsl:with-param name="dt" select="a:DateTime"/>
889 </xsl:call-template>
890 </tbody>
891 </table>
892 </td>
893 <td>
894 <xsl:for-each select="a:Locations/a:Location">
895 <xsl:value-of select="a:Description/a:Text"/>
896 <xsl:call-template name="actorName">
897 <xsl:with-param name="objID" select="a:Actor/a:ActorID"/>
898 </xsl:call-template>
899 <br/>
900 </xsl:for-each>
901 </td>
902 <td>
903 <xsl:value-of select="a:Status/a:Text"/>
904 </td>
905 <td>
906 <xsl:for-each select="a:Practitioners/a:Practitioner">
907 <xsl:call-template name="actorName">
908 <xsl:with-param name="objID" select="a:ActorID"/>
909 </xsl:call-template>
910 <br/>
911 </xsl:for-each>
912 </td>
913 <td>
914 <strong class="clinical">
915 <xsl:value-of select="a:Description/a:Text"/>
916 </strong>
917 </td>
918 <td>
919 <xsl:for-each select="a:Indications/a:Indication">
920 <xsl:call-template name="problemDescription">
921 <xsl:with-param name="objID" select="a:InternalCCRLink/a:LinkID"/>
922 </xsl:call-template>
923 <br/>
924 </xsl:for-each>
925 </td>
926 <td>
928 <xsl:attribute name="href">
929 <xsl:text>#</xsl:text>
930 <xsl:value-of select="a:Source/a:Actor/a:ActorID"/>
931 </xsl:attribute>
932 <xsl:call-template name="actorName">
933 <xsl:with-param name="objID" select="a:Source/a:Actor/a:ActorID"/>
934 </xsl:call-template>
935 </a>
936 </td>
937 </tr>
938 </xsl:for-each>
939 </tbody>
940 </table>
941 </td>
942 </tr>
943 </xsl:if>
944 <xsl:if test="a:ContinuityOfCareRecord/a:Body/a:SocialHistory">
945 <tr id="socialhistoryrow">
946 <td>
947 <span class="header">Social History</span>
948 <br/>
949 <table class="list" id="socialhistory">
950 <tbody>
951 <tr>
952 <th>Type</th>
953 <th>Date</th>
954 <th>Code</th>
955 <th>Description</th>
956 <th>Status</th>
957 <th>Source</th>
958 </tr>
959 <xsl:for-each select="a:ContinuityOfCareRecord/a:Body/a:SocialHistory/a:SocialHistoryElement">
960 <tr>
961 <td>
962 <xsl:value-of select="a:Type/a:Text"/>
963 </td>
964 <td>
965 <table class="internal">
966 <tbody>
967 <xsl:call-template name="dateTime">
968 <xsl:with-param name="dt" select="a:DateTime"/>
969 </xsl:call-template>
970 </tbody>
971 </table>
972 </td>
973 <td>
974 <xsl:apply-templates select="a:Description/a:Code"/>
975 </td>
976 <td>
977 <strong class="clinical">
978 <span>
979 <xsl:value-of disable-output-escaping="yes" select="a:Description/a:Text"/>
980 </span>
981 </strong>
982 </td>
983 <td>
984 <xsl:value-of select="a:Status/a:Text"/>
985 </td>
986 <td>
988 <xsl:attribute name="href">
989 <xsl:text>#</xsl:text>
990 <xsl:value-of select="a:Source/a:Actor/a:ActorID"/>
991 </xsl:attribute>
992 <xsl:call-template name="actorName">
993 <xsl:with-param name="objID" select="a:Source/a:Actor/a:ActorID"/>
994 </xsl:call-template>
995 </a>
996 </td>
997 </tr>
998 </xsl:for-each>
999 </tbody>
1000 </table>
1001 </td>
1002 </tr>
1003 </xsl:if>
1004 <xsl:if test="a:ContinuityOfCareRecord/a:Body/a:FamilyHistory">
1005 <tr id="familyhistoryrow">
1006 <td>
1007 <span class="header">Family History</span>
1008 <br/>
1009 <table class="list" id="familyhistory">
1010 <tbody>
1011 <tr>
1012 <th>Type</th>
1013 <th>Date</th>
1014 <th>Code</th>
1015 <th>Description</th>
1016 <th>Relationship(s)</th>
1017 <th>Status</th>
1018 <th>Source</th>
1019 </tr>
1020 <xsl:for-each select="a:ContinuityOfCareRecord/a:Body/a:FamilyHistory/a:FamilyProblemHistory">
1021 <tr>
1022 <td>
1023 <xsl:value-of select="a:Type/a:Text"/>
1024 </td>
1025 <td>
1026 <table class="internal">
1027 <tbody>
1028 <xsl:call-template name="dateTime">
1029 <xsl:with-param name="dt" select="a:DateTime"/>
1030 </xsl:call-template>
1031 </tbody>
1032 </table>
1033 </td>
1034 <td>
1035 <xsl:apply-templates select="a:Problem/a:Description/a:Code"/>
1036 </td>
1037 <td>
1038 <table class="internal" id="familyhistoryproblem">
1039 <xsl:for-each select="a:Problem">
1040 <tr>
1041 <td>
1042 <strong class="clinical">
1043 <xsl:value-of select="a:Description/a:Text"/>
1044 </strong>
1045 </td>
1046 </tr>
1047 </xsl:for-each>
1048 </table>
1049 </td>
1050 <td>
1051 <xsl:value-of select="a:FamilyMember/a:ActorRole/a:Text"/>
1052 </td>
1053 <td>
1054 <xsl:value-of select="a:Status/a:Text"/>
1055 </td>
1056 <td>
1058 <xsl:attribute name="href">
1059 <xsl:text>#</xsl:text>
1060 <xsl:value-of select="a:Source/a:Actor/a:ActorID"/>
1061 </xsl:attribute>
1062 <xsl:call-template name="actorName">
1063 <xsl:with-param name="objID" select="a:Source/a:Actor/a:ActorID"/>
1064 </xsl:call-template>
1065 </a>
1066 </td>
1067 </tr>
1068 </xsl:for-each>
1069 </tbody>
1070 </table>
1071 </td>
1072 </tr>
1073 </xsl:if>
1074 <xsl:if test="a:ContinuityOfCareRecord/a:Body/a:Results/a:Result[a:Test/a:TestResult/a:Value!='']">
1075 <tr id="resultsrow">
1076 <td>
1077 <span class="header">Results (Discrete)</span>
1078 <br/>
1079 <table class="list" id="results">
1080 <tbody>
1081 <tr>
1082 <th>Test</th>
1083 <th>Date</th>
1084 <th>Result</th>
1085 <th>Source</th>
1086 </tr>
1087 <xsl:for-each select="a:ContinuityOfCareRecord/a:Body/a:Results/a:Result[a:Test/a:TestResult/a:Value!='']">
1088 <tr>
1089 <td>
1090 <xsl:value-of select="a:Description/a:Text"/>
1091 </td>
1092 <td>
1093 <table class="internal">
1094 <tbody>
1095 <xsl:call-template name="dateTime">
1096 <xsl:with-param name="dt" select="a:DateTime"/>
1097 <xsl:with-param name="fmt">MMM dd, yyyy ':' hh:mm aa zzz</xsl:with-param>
1098 </xsl:call-template>
1099 </tbody>
1100 </table>
1101 </td>
1102 <td>
1103 <table class="internal">
1104 <tbody>
1105 <xsl:for-each select="a:Test">
1106 <xsl:choose>
1107 <xsl:when test="position() mod 2=0">
1108 <tr class="even">
1109 <td width="33%">
1110 <strong class="clinical">
1111 <xsl:value-of select="a:Description/a:Text"/>
1112 </strong>
1113 </td>
1114 <td width="33%">
1115 <xsl:value-of select="a:TestResult/a:Value"/>
1116 <xsl:text xml:space="preserve"> </xsl:text>
1117 <xsl:value-of select="a:TestResult/a:Units/a:Unit"/>
1118 </td>
1119 <td width="33%">
1120 <xsl:value-of select="a:Flag/a:Text"/>
1121 </td>
1122 </tr>
1123 </xsl:when>
1124 <xsl:otherwise>
1125 <tr class="odd">
1126 <td width="33%">
1127 <strong class="clinical">
1128 <xsl:value-of select="a:Description/a:Text"/>
1129 </strong>
1130 </td>
1131 <td width="33%">
1132 <xsl:value-of select="a:TestResult/a:Value"/>
1133 <xsl:text xml:space="preserve"> </xsl:text>
1134 <xsl:value-of select="a:TestResult/a:Units/a:Unit"/>
1135 </td>
1136 <td width="33%">
1137 <xsl:value-of select="a:Flag/a:Text"/>
1138 </td>
1139 </tr>
1140 </xsl:otherwise>
1141 </xsl:choose>
1142 </xsl:for-each>
1143 </tbody>
1144 </table>
1145 </td>
1146 <td>
1148 <xsl:attribute name="href">
1149 <xsl:text>#</xsl:text>
1150 <xsl:value-of select="a:Source/a:Actor/a:ActorID"/>
1151 </xsl:attribute>
1152 <xsl:call-template name="actorName">
1153 <xsl:with-param name="objID" select="a:Source/a:Actor/a:ActorID"/>
1154 </xsl:call-template>
1155 </a>
1156 </td>
1157 </tr>
1158 </xsl:for-each>
1159 </tbody>
1160 </table>
1161 </td>
1162 </tr>
1163 </xsl:if>
1164 <xsl:if test="a:ContinuityOfCareRecord/a:Body/a:Results/a:Result[a:Test/a:TestResult/a:Description/a:Text!='']">
1165 <tr id="resultsreportrow">
1166 <td>
1167 <span class="header">Results (Report)</span>
1168 <br/>
1169 <table class="list" id="resultsreport">
1170 <tbody>
1171 <tr>
1172 <th>Test</th>
1173 <th>Date</th>
1174 <th>Result</th>
1175 <th>Source</th>
1176 </tr>
1177 <xsl:for-each select="a:ContinuityOfCareRecord/a:Body/a:Results/a:Result[a:Test/a:TestResult/a:Description/a:Text!='']">
1178 <tr>
1179 <td>
1180 <xsl:value-of select="a:Description/a:Text"/>
1181 </td>
1182 <td>
1183 <table class="internal">
1184 <tbody>
1185 <xsl:call-template name="dateTime">
1186 <xsl:with-param name="dt" select="a:DateTime"/>
1187 <xsl:with-param name="fmt">MMM dd, yyyy ':' hh:mm aa zzz</xsl:with-param>
1188 </xsl:call-template>
1189 </tbody>
1190 </table>
1191 </td>
1192 <td>
1193 <table class="internal">
1194 <tbody>
1195 <xsl:for-each select="a:Test">
1196 <xsl:choose>
1197 <xsl:when test="position() mod 2=0">
1198 <tr class="even">
1199 <td width="20%">
1200 <strong class="clinical">
1201 <xsl:value-of select="a:Description/a:Text"/>
1202 </strong>
1203 </td>
1204 <td width="65%">
1205 <span>
1206 <xsl:value-of disable-output-escaping="yes" select="a:TestResult/a:Description/a:Text"/>
1207 </span>
1208 </td>
1209 <td width="15%">
1210 <xsl:value-of select="a:Flag/a:Text"/>
1211 </td>
1212 </tr>
1213 </xsl:when>
1214 <xsl:otherwise>
1215 <tr class="odd">
1216 <td width="20%">
1217 <strong class="clinical">
1218 <xsl:value-of select="a:Description/a:Text"/>
1219 </strong>
1220 </td>
1221 <td width="65%">
1222 <xsl:value-of disable-output-escaping="yes" select="a:TestResult/a:Description/a:Text"/>
1223 </td>
1224 <td width="15%">
1225 <xsl:value-of select="a:Flag/a:Text"/>
1226 </td>
1227 </tr>
1228 </xsl:otherwise>
1229 </xsl:choose>
1230 </xsl:for-each>
1231 </tbody>
1232 </table>
1233 </td>
1234 <td>
1236 <xsl:attribute name="href">
1237 <xsl:text>#</xsl:text>
1238 <xsl:value-of select="a:Source/a:Actor/a:ActorID"/>
1239 </xsl:attribute>
1240 <xsl:call-template name="actorName">
1241 <xsl:with-param name="objID" select="a:Source/a:Actor/a:ActorID"/>
1242 </xsl:call-template>
1243 </a>
1244 </td>
1245 </tr>
1246 </xsl:for-each>
1247 </tbody>
1248 </table>
1249 </td>
1250 </tr>
1251 </xsl:if>
1252 <xsl:if test="a:ContinuityOfCareRecord/a:Body/a:Payers">
1253 <tr id="insurancerow">
1254 <td>
1255 <span class="header">Insurance</span>
1256 <br/>
1257 <table class="list" id="insurance">
1258 <tbody>
1259 <tr>
1260 <th>Type</th>
1261 <th>Date</th>
1262 <th>Identification Numbers</th>
1263 <th>Payment Provider</th>
1264 <th>Subscriber</th>
1265 <th>Source</th>
1266 </tr>
1267 <xsl:for-each select="a:ContinuityOfCareRecord/a:Body/a:Payers/a:Payer">
1268 <tr>
1269 <td>
1270 <xsl:value-of select="a:Type/a:Text"/>
1271 </td>
1272 <td>
1273 <table class="internal">
1274 <tbody>
1275 <xsl:for-each select="a:DateTime">
1276 <xsl:call-template name="dateTime">
1277 <xsl:with-param name="dt" select="."/>
1278 <xsl:with-param name="fmt">MMM dd, yyyy ':' hh:mm aa zzz</xsl:with-param>
1279 </xsl:call-template>
1280 </xsl:for-each>
1281 </tbody>
1282 </table>
1283 </td>
1284 <td>
1285 <table border="1" class="internal">
1286 <tbody>
1287 <xsl:for-each select="a:IDs">
1288 <xsl:choose>
1289 <xsl:when test="position() mod 2=0">
1290 <tr class="even">
1291 <td width="50%">
1292 <xsl:value-of select="a:Type/a:Text"/>:</td>
1293 <td width="50%">
1294 <xsl:value-of select="a:ID"/>
1295 </td>
1296 </tr>
1297 </xsl:when>
1298 <xsl:otherwise>
1299 <tr class="odd">
1300 <td width="50%">
1301 <xsl:value-of select="a:Type/a:Text"/>:</td>
1302 <td width="50%">
1303 <xsl:value-of select="a:ID"/>
1304 </td>
1305 </tr>
1306 </xsl:otherwise>
1307 </xsl:choose>
1308 </xsl:for-each>
1309 </tbody>
1310 </table>
1311 </td>
1312 <td>
1314 <xsl:attribute name="href">
1315 <xsl:text>#</xsl:text>
1316 <xsl:value-of select="a:Source/a:Actor/a:ActorID"/>
1317 </xsl:attribute>
1318 <xsl:call-template name="actorName">
1319 <xsl:with-param name="objID" select="a:PaymentProvider/a:ActorID"/>
1320 </xsl:call-template>
1321 </a>
1322 </td>
1323 <td>
1325 <xsl:attribute name="href">
1326 <xsl:text>#</xsl:text>
1327 <xsl:value-of select="a:Source/a:Actor/a:ActorID"/>
1328 </xsl:attribute>
1329 <xsl:call-template name="actorName">
1330 <xsl:with-param name="objID" select="a:Subscriber/a:ActorID"/>
1331 </xsl:call-template>
1332 </a>
1333 </td>
1334 <td>
1336 <xsl:attribute name="href">
1337 <xsl:text>#</xsl:text>
1338 <xsl:value-of select="a:Source/a:Actor/a:ActorID"/>
1339 </xsl:attribute>
1340 <xsl:call-template name="actorName">
1341 <xsl:with-param name="objID" select="a:Source/a:Actor/a:ActorID"/>
1342 </xsl:call-template>
1343 </a>
1344 </td>
1345 </tr>
1346 </xsl:for-each>
1347 </tbody>
1348 </table>
1349 </td>
1350 </tr>
1351 </xsl:if>
1352 <xsl:if test="a:ContinuityOfCareRecord/a:Body/a:PlanOfCare">
1353 <xsl:if test="a:ContinuityOfCareRecord/a:Body/a:PlanOfCare/a:Plan[a:Type/a:Text='Treatment Recommendation']">
1354 <tr id="planofcarerow">
1355 <td>
1356 <span class="header">Plan Of Care Recommendations</span>
1357 <br/>
1358 <table class="list" id="planofcare">
1359 <tbody>
1360 <tr>
1361 <th>Description</th>
1362 <th>Recommendation</th>
1363 <th>Goal</th>
1364 <th>Status</th>
1365 <th>Source</th>
1366 </tr>
1367 <xsl:for-each select="a:ContinuityOfCareRecord/a:Body/a:PlanOfCare/a:Plan[a:Type/a:Text='Treatment Recommendation']">
1368 <tr>
1369 <td>
1370 <xsl:value-of select="a:Description/a:Text"/>
1371 </td>
1372 <td>
1373 <xsl:value-of disable-output-escaping="yes" select="a:OrderRequest/a:Description/a:Text"/>
1374 </td>
1375 <td>
1376 <xsl:value-of disable-output-escaping="yes" select="a:OrderRequest/a:Goals/a:Goal/a:Description/a:Text"/>
1377 </td>
1378 <td>
1379 <xsl:value-of select="a:Status/a:Text"/>
1380 </td>
1381 <td>
1383 <xsl:attribute name="href">
1384 <xsl:text>#</xsl:text>
1385 <xsl:value-of select="a:Source/a:Actor/a:ActorID"/>
1386 </xsl:attribute>
1387 <xsl:call-template name="actorName">
1388 <xsl:with-param name="objID" select="a:Source/a:Actor/a:ActorID"/>
1389 </xsl:call-template>
1390 </a>
1391 </td>
1392 </tr>
1393 </xsl:for-each>
1394 </tbody>
1395 </table>
1396 </td>
1397 </tr>
1398 </xsl:if>
1399 <xsl:if test="a:ContinuityOfCareRecord/a:Body/a:PlanOfCare/a:Plan[a:Type/a:Text='Order']">
1400 <tr id="planofcareordersrow">
1401 <td>
1402 <span class="header">Plan Of Care Orders</span>
1403 <br/>
1404 <table class="list" id="planofcareorders">
1405 <tbody>
1406 <tr>
1407 <th>Descripion</th>
1408 <th>Plan Status</th>
1409 <th>Type</th>
1410 <th>Date</th>
1411 <th>Procedure</th>
1412 <th>Schedule</th>
1413 <th>Location</th>
1414 <th>Substance</th>
1415 <th>Method</th>
1416 <th>Position</th>
1417 <th>Site</th>
1418 <th>Status</th>
1419 <th>Source</th>
1420 </tr>
1421 <xsl:for-each select="a:ContinuityOfCareRecord/a:Body/a:PlanOfCare/a:Plan[a:Type/a:Text='Order']">
1422 <tr>
1423 <td>
1424 <xsl:apply-templates select="a:Description/a:Text"/>
1425 </td>
1426 <td>
1427 <xsl:value-of select="a:Status/a:Text"/>
1428 </td>
1429 <td>
1430 <xsl:value-of select="a:OrderRequest/a:Procedures/a:Procedure/a:Type/a:Text"/>
1431 </td>
1432 <td>
1433 <table class="internal">
1434 <tbody>
1435 <xsl:call-template name="dateTime">
1436 <xsl:with-param name="dt" select="a:OrderRequest/a:Procedures/a:Procedure/a:DateTime"/>
1437 </xsl:call-template>
1438 </tbody>
1439 </table>
1440 </td>
1441 <td>
1442 <xsl:apply-templates select="a:OrderRequest/a:Procedures/a:Procedure/a:Description/a:Text"/>
1443 </td>
1444 <td>
1445 <span>Every </span>
1446 <xsl:apply-templates select="a:OrderRequest/a:Procedures/a:Procedure/a:Interval/a:Value"/>
1447 <xsl:text xml:space="preserve"> </xsl:text>
1448 <xsl:value-of select="a:OrderRequest/a:Procedures/a:Procedure/a:Interval/a:Units/a:Unit"/>
1449 <span> for </span>
1450 <xsl:value-of select="a:OrderRequest/a:Procedures/a:Procedure/a:Duration/a:Value"/>
1451 <xsl:text xml:space="preserve"> </xsl:text>
1452 <xsl:value-of select="a:OrderRequest/a:Procedures/a:Procedure/a:Duration/a:Units/a:Unit"/>
1453 </td>
1454 <td>
1455 <xsl:for-each select="a:OrderRequest/a:Procedures/a:Procedure/a:Locations">
1456 <xsl:value-of select="a:Location/a:Description/a:Text"/>
1457 <xsl:if test="position() != last()">
1458 <br/>
1459 </xsl:if>
1460 </xsl:for-each>
1461 </td>
1462 <td>
1463 <xsl:value-of select="a:OrderRequest/a:Procedures/a:Procedure/a:Substance/a:Text"/>
1464 </td>
1465 <td>
1466 <xsl:value-of select="a:OrderRequest/a:Procedures/a:Procedure/a:Method/a:Text"/>
1467 </td>
1468 <td>
1469 <xsl:value-of select="a:OrderRequest/a:Procedures/a:Procedure/a:Position/a:Text"/>
1470 </td>
1471 <td>
1472 <xsl:value-of select="a:OrderRequest/a:Procedures/a:Procedure/a:Site/a:Text"/>
1473 </td>
1474 <td/>
1475 <td>
1477 <xsl:attribute name="href">
1478 <xsl:text>#</xsl:text>
1479 <xsl:value-of select="a:Source/a:Actor/a:ActorID"/>
1480 </xsl:attribute>
1481 <xsl:call-template name="actorName">
1482 <xsl:with-param name="objID" select="a:Source/a:Actor/a:ActorID"/>
1483 </xsl:call-template>
1484 </a>
1485 </td>
1486 </tr>
1487 </xsl:for-each>
1488 </tbody>
1489 </table>
1490 </td>
1491 </tr>
1492 </xsl:if>
1493 </xsl:if>
1494 <xsl:if test="a:ContinuityOfCareRecord/a:Body/a:HealthCareProviders">
1495 <tr id="healthcareprovidersrow">
1496 <td>
1497 <span class="header">Health Care Providers</span>
1498 <br/>
1499 <table class="list" id="healthcareproviders">
1500 <tbody>
1501 <tr>
1502 <th>Role</th>
1503 <th>Name</th>
1504 </tr>
1505 <xsl:for-each select="a:ContinuityOfCareRecord/a:Body/a:HealthCareProviders/a:Provider">
1506 <tr>
1507 <td>
1508 <xsl:value-of select="a:ActorRole/a:Text"/>
1509 </td>
1510 <td>
1512 <xsl:attribute name="href">
1513 <xsl:text>#</xsl:text>
1514 <xsl:value-of select="a:Source/a:Actor/a:ActorID"/>
1515 </xsl:attribute>
1516 <xsl:call-template name="actorName">
1517 <xsl:with-param name="objID" select="a:ActorID"/>
1518 </xsl:call-template>
1519 </a>
1520 </td>
1521 </tr>
1522 </xsl:for-each>
1523 </tbody>
1524 </table>
1525 </td>
1526 </tr>
1527 </xsl:if>
1528 <xsl:if test="a:ContinuityOfCareRecord/a:References">
1529 <tr id="referencesrow">
1530 <td>
1531 <span class="header">References</span>
1532 <br/>
1533 <table class="list" id="references">
1534 <tbody>
1535 <tr>
1536 <th>Type</th>
1537 <th>Date</th>
1538 <th>Description</th>
1539 <th>Location</th>
1540 <th>Source</th>
1541 </tr>
1542 <xsl:for-each select="a:ContinuityOfCareRecord/a:References/a:Reference">
1543 <tr>
1544 <td>
1545 <xsl:value-of select="a:Type/a:Text"/>
1546 </td>
1547 <td>
1548 <table class="internal">
1549 <tbody>
1550 <xsl:call-template name="dateTime">
1551 <xsl:with-param name="dt" select="a:DateTime"/>
1552 </xsl:call-template>
1553 </tbody>
1554 </table>
1555 </td>
1556 <td>
1557 <strong class="clinical">
1558 <xsl:value-of select="a:Description/a:Text"/>
1559 </strong>
1560 </td>
1561 <td>
1562 <a target="_blank">
1563 <xsl:attribute name="href">
1564 <xsl:value-of select="a:Locations/a:Location/a:Description/a:Text"/>
1565 </xsl:attribute>
1566 <xsl:value-of select="a:Locations/a:Location/a:Description/a:Text"/>
1567 </a>
1568 </td>
1569 <td>
1571 <xsl:attribute name="href">
1572 <xsl:text>#</xsl:text>
1573 <xsl:value-of select="a:Source/a:Actor/a:ActorID"/>
1574 </xsl:attribute>
1575 <xsl:call-template name="actorName">
1576 <xsl:with-param name="objID" select="a:Source/a:Actor/a:ActorID"/>
1577 </xsl:call-template>
1578 </a>
1579 </td>
1580 </tr>
1581 </xsl:for-each>
1582 </tbody>
1583 </table>
1584 </td>
1585 </tr>
1586 </xsl:if>
1587 </span>
1588 <tr>
1589 <td/>
1590 <td/>
1591 </tr>
1592 </tbody>
1593 </table>
1594 </td>
1595 </tr>
1596 <tr>
1597 <td/>
1598 </tr>
1599 </tbody>
1600 </table>
1601 <br/>
1602 <span id="actors">
1603 <span class="header">Additional Information About People &amp; Organizations</span>
1604 <xsl:if test="a:ContinuityOfCareRecord/a:Actors/a:Actor[a:Person]">
1605 <span id="people">
1606 <h4>People</h4>
1607 <table class="list" id="actorstable">
1608 <tbody>
1609 <tr>
1610 <th>Name</th>
1611 <th>Specialty</th>
1612 <th>Relation</th>
1613 <th>Identification Numbers</th>
1614 <th>Phone</th>
1615 <th>Address/ E-mail</th>
1616 </tr>
1617 <xsl:for-each select="a:ContinuityOfCareRecord/a:Actors/a:Actor">
1618 <xsl:sort data-type="text" order="ascending" select="a:Person/a:Name/a:DisplayName|a:Person/a:Name/a:CurrentName/a:Family"/>
1619 <xsl:if test="a:Person">
1620 <tr>
1621 <td>
1623 <xsl:attribute name="name">
1624 <xsl:value-of select="a:ActorObjectID"/>
1625 </xsl:attribute>
1626 <xsl:call-template name="actorName">
1627 <xsl:with-param name="objID" select="a:ActorObjectID"/>
1628 </xsl:call-template>
1629 </a>
1630 </td>
1631 <td>
1632 <xsl:value-of select="a:Specialty/a:Text"/>
1633 </td>
1634 <td>
1635 <xsl:value-of select="a:Relation/a:Text"/>
1636 </td>
1637 <td>
1638 <table class="internal">
1639 <tbody>
1640 <xsl:for-each select="a:IDs">
1641 <tr>
1642 <td width="50%">
1643 <xsl:value-of select="a:Type/a:Text"/>
1644 </td>
1645 <td width="50%">
1646 <xsl:value-of select="a:ID"/>
1647 </td>
1648 </tr>
1649 </xsl:for-each>
1650 </tbody>
1651 </table>
1652 </td>
1653 <td>
1654 <table class="internal">
1655 <tbody>
1656 <xsl:for-each select="a:Telephone">
1657 <tr>
1658 <td width="50%">
1659 <xsl:value-of select="a:Type/a:Text"/>
1660 </td>
1661 <td width="50%">
1662 <xsl:value-of select="a:Value"/>
1663 </td>
1664 </tr>
1665 </xsl:for-each>
1666 </tbody>
1667 </table>
1668 </td>
1669 <td>
1670 <xsl:for-each select="a:Address">
1671 <xsl:if test="a:Type">
1673 <xsl:value-of select="a:Type/a:Text"/>:</b>
1674 <br/>
1675 </xsl:if>
1676 <xsl:if test="a:Line1">
1677 <xsl:value-of select="a:Line1"/>
1678 <br/>
1679 </xsl:if>
1680 <xsl:if test="a:Line2">
1681 <xsl:value-of select="a:Line2"/>
1682 <br/>
1683 </xsl:if>
1684 <xsl:if test="a:City">
1685 <xsl:value-of select="a:City"/>,
1686 </xsl:if>
1687 <xsl:value-of select="a:State"/>
1688 <xsl:value-of select="a:PostalCode"/>
1689 <br/>
1690 </xsl:for-each>
1691 <xsl:for-each select="a:EMail">
1692 <br/>
1693 <xsl:value-of select="a:Value"/>
1694 </xsl:for-each>
1695 </td>
1696 </tr>
1697 </xsl:if>
1698 </xsl:for-each>
1699 </tbody>
1700 </table>
1701 </span>
1702 </xsl:if>
1703 <xsl:if test="a:ContinuityOfCareRecord/a:Actors/a:Actor[a:Organization]">
1704 <span id="organizations">
1705 <h4>Organizations</h4>
1706 <table class="list" id="organizationstable">
1707 <tbody>
1708 <tr>
1709 <th>Name</th>
1710 <th>Specialty</th>
1711 <th>Relation</th>
1712 <th>Identification Numbers</th>
1713 <th>Phone</th>
1714 <th>Address/ E-mail</th>
1715 </tr>
1716 <xsl:for-each select="a:ContinuityOfCareRecord/a:Actors/a:Actor">
1717 <xsl:sort data-type="text" order="ascending" select="a:Organization/a:Name"/>
1718 <xsl:if test="a:Organization">
1719 <tr>
1720 <td>
1722 <xsl:attribute name="name">
1723 <xsl:value-of select="a:ActorObjectID"/>
1724 </xsl:attribute>
1725 <xsl:value-of select="a:Organization/a:Name"/>
1726 </a>
1727 </td>
1728 <td>
1729 <xsl:value-of select="a:Specialty/a:Text"/>
1730 </td>
1731 <td>
1732 <xsl:value-of select="a:Relation/a:Text"/>
1733 </td>
1734 <td>
1735 <table class="internal">
1736 <tbody>
1737 <xsl:for-each select="a:IDs">
1738 <tr>
1739 <td width="50%">
1740 <xsl:value-of select="a:Type/a:Text"/>
1741 </td>
1742 <td width="50%">
1743 <xsl:value-of select="a:ID"/>
1744 </td>
1745 </tr>
1746 </xsl:for-each>
1747 </tbody>
1748 </table>
1749 </td>
1750 <td>
1751 <table class="internal">
1752 <tbody>
1753 <xsl:for-each select="a:Telephone">
1754 <tr>
1755 <td width="50%">
1756 <xsl:value-of select="a:Type/a:Text"/>
1757 </td>
1758 <td width="50%">
1759 <xsl:value-of select="a:Value"/>
1760 </td>
1761 </tr>
1762 </xsl:for-each>
1763 </tbody>
1764 </table>
1765 </td>
1766 <td>
1767 <xsl:for-each select="a:Address">
1768 <xsl:if test="a:Type">
1770 <xsl:value-of select="a:Type/a:Text"/>:</b>
1771 <br/>
1772 </xsl:if>
1773 <xsl:if test="a:Line1">
1774 <xsl:value-of select="a:Line1"/>
1775 <br/>
1776 </xsl:if>
1777 <xsl:if test="a:Line2">
1778 <xsl:value-of select="a:Line2"/>
1779 <br/>
1780 </xsl:if>
1781 <xsl:if test="a:City">
1782 <xsl:value-of select="a:City"/>,
1783 </xsl:if>
1784 <xsl:value-of select="a:State"/>
1785 <xsl:value-of select="a:PostalCode"/>
1786 <br/>
1787 </xsl:for-each>
1788 <xsl:for-each select="a:EMail">
1789 <br/>
1790 <xsl:value-of select="a:Value"/>
1791 </xsl:for-each>
1792 </td>
1793 </tr>
1794 </xsl:if>
1795 </xsl:for-each>
1796 </tbody>
1797 </table>
1798 </span>
1799 </xsl:if>
1800 <xsl:if test="a:ContinuityOfCareRecord/a:Actors/a:Actor[a:InformationSystem]">
1801 <span id="informationsystems">
1802 <h4>Information Systems</h4>
1803 <table class="list" id="informationsystemstable">
1804 <tbody>
1805 <tr>
1806 <th>Name</th>
1807 <th>Type</th>
1808 <th>Version</th>
1809 <th>Identification Numbers</th>
1810 <th>Phone</th>
1811 <th>Address/ E-mail</th>
1812 </tr>
1813 <xsl:for-each select="a:ContinuityOfCareRecord/a:Actors/a:Actor">
1814 <xsl:sort data-type="text" order="ascending" select="a:InformationSystem/a:Name"/>
1815 <xsl:if test="a:InformationSystem">
1816 <tr>
1817 <td>
1819 <xsl:attribute name="name">
1820 <xsl:value-of select="a:ActorObjectID"/>
1821 </xsl:attribute>
1822 <xsl:value-of select="a:InformationSystem/a:Name"/>
1823 </a>
1824 </td>
1825 <td>
1826 <xsl:value-of select="a:InformationSystem/a:Type"/>
1827 </td>
1828 <td>
1829 <xsl:value-of select="a:InformationSystem/a:Version"/>
1830 </td>
1831 <td>
1832 <table class="internal">
1833 <tbody>
1834 <xsl:for-each select="a:IDs">
1835 <tr>
1836 <td width="50%">
1837 <xsl:value-of select="a:Type/a:Text"/>
1838 </td>
1839 <td width="50%">
1840 <xsl:value-of select="a:ID"/>
1841 </td>
1842 </tr>
1843 </xsl:for-each>
1844 </tbody>
1845 </table>
1846 </td>
1847 <td>
1848 <table class="internal">
1849 <tbody>
1850 <xsl:for-each select="a:Telephone">
1851 <tr>
1852 <td width="50%">
1853 <xsl:value-of select="a:Type/a:Text"/>
1854 </td>
1855 <td width="50%">
1856 <xsl:value-of select="a:Value"/>
1857 </td>
1858 </tr>
1859 </xsl:for-each>
1860 </tbody>
1861 </table>
1862 </td>
1863 <td>
1864 <xsl:for-each select="a:Address">
1865 <xsl:if test="Type">
1867 <xsl:value-of select="a:Type/a:Text"/>:</b>
1868 <br/>
1869 </xsl:if>
1870 <xsl:if test="a:Line1">
1871 <xsl:value-of select="a:Line1"/>
1872 <br/>
1873 </xsl:if>
1874 <xsl:if test="a:Line2">
1875 <xsl:value-of select="a:Line2"/>
1876 <br/>
1877 </xsl:if>
1878 <xsl:if test="a:City">
1879 <xsl:value-of select="a:City"/>,
1880 </xsl:if>
1881 <xsl:value-of select="a:State"/>
1882 <xsl:value-of select="a:PostalCode"/>
1883 <br/>
1884 </xsl:for-each>
1885 <xsl:for-each select="a:EMail">
1886 <br/>
1887 <xsl:value-of select="a:Value"/>
1888 </xsl:for-each>
1889 </td>
1890 </tr>
1891 </xsl:if>
1892 </xsl:for-each>
1893 </tbody>
1894 </table>
1895 </span>
1896 </xsl:if>
1897 </span>
1898 <xsl:call-template name="footer"/>
1899 </body>
1900 </html>
1901 </xsl:template>
1902 <!-- date.format-date.template -->
1903 <!-- This is from the EXSLT.org Library (http://www.exslt.org/) -->
1904 <date:months>
1905 <date:month abbr="Jan" length="31">January</date:month>
1906 <date:month abbr="Feb" length="28">February</date:month>
1907 <date:month abbr="Mar" length="31">March</date:month>
1908 <date:month abbr="Apr" length="30">April</date:month>
1909 <date:month abbr="May" length="31">May</date:month>
1910 <date:month abbr="Jun" length="30">June</date:month>
1911 <date:month abbr="Jul" length="31">July</date:month>
1912 <date:month abbr="Aug" length="31">August</date:month>
1913 <date:month abbr="Sep" length="30">September</date:month>
1914 <date:month abbr="Oct" length="31">October</date:month>
1915 <date:month abbr="Nov" length="30">November</date:month>
1916 <date:month abbr="Dec" length="31">December</date:month>
1917 </date:months>
1918 <date:days>
1919 <date:day abbr="Sun">Sunday</date:day>
1920 <date:day abbr="Mon">Monday</date:day>
1921 <date:day abbr="Tue">Tuesday</date:day>
1922 <date:day abbr="Wed">Wednesday</date:day>
1923 <date:day abbr="Thu">Thursday</date:day>
1924 <date:day abbr="Fri">Friday</date:day>
1925 <date:day abbr="Sat">Saturday</date:day>
1926 </date:days>
1927 <xsl:template name="date:format-date">
1928 <xsl:param name="date-time"/>
1929 <xsl:param name="pattern"/>
1930 <xsl:variable name="formatted">
1931 <xsl:choose>
1932 <xsl:when test="starts-with($date-time, '---')">
1933 <xsl:call-template name="date:_format-date">
1934 <xsl:with-param name="year" select="'NaN'"/>
1935 <xsl:with-param name="month" select="'NaN'"/>
1936 <xsl:with-param name="day" select="number(substring($date-time, 4, 2))"/>
1937 <xsl:with-param name="pattern" select="$pattern"/>
1938 </xsl:call-template>
1939 </xsl:when>
1940 <xsl:when test="starts-with($date-time, '--')">
1941 <xsl:call-template name="date:_format-date">
1942 <xsl:with-param name="year" select="'NaN'"/>
1943 <xsl:with-param name="month" select="number(substring($date-time, 3, 2))"/>
1944 <xsl:with-param name="day" select="number(substring($date-time, 6, 2))"/>
1945 <xsl:with-param name="pattern" select="$pattern"/>
1946 </xsl:call-template>
1947 </xsl:when>
1948 <xsl:otherwise>
1949 <xsl:variable name="neg" select="starts-with($date-time, '-')"/>
1950 <xsl:variable name="no-neg">
1951 <xsl:choose>
1952 <xsl:when test="$neg or starts-with($date-time, '+')">
1953 <xsl:value-of select="substring($date-time, 2)"/>
1954 </xsl:when>
1955 <xsl:otherwise>
1956 <xsl:value-of select="$date-time"/>
1957 </xsl:otherwise>
1958 </xsl:choose>
1959 </xsl:variable>
1960 <xsl:variable name="no-neg-length" select="string-length($no-neg)"/>
1961 <xsl:variable name="timezone">
1962 <xsl:choose>
1963 <xsl:when test="substring($no-neg, $no-neg-length) = 'Z'">Z</xsl:when>
1964 <xsl:otherwise>
1965 <xsl:variable name="tz" select="substring($no-neg, $no-neg-length - 5)"/>
1966 <xsl:value-of select="$tz"/>
1967 </xsl:otherwise>
1968 </xsl:choose>
1969 </xsl:variable>
1970 <xsl:if test="not(string($timezone)) or $timezone = 'Z' or (substring($timezone, 2, 2) &lt;= 23 and substring($timezone, 5, 2) &lt;= 59)">
1971 <xsl:variable name="dt" select="substring($no-neg, 1, $no-neg-length - string-length($timezone))"/>
1972 <xsl:variable name="dt-length" select="string-length($dt)"/>
1973 <xsl:choose>
1974 <xsl:when test="substring($dt, 3, 1) = ':' and substring($dt, 6, 1) = ':'">
1975 <xsl:variable name="hour" select="substring($dt, 1, 2)"/>
1976 <xsl:variable name="min" select="substring($dt, 4, 2)"/>
1977 <xsl:variable name="sec" select="substring($dt, 7)"/>
1978 <xsl:if test="$hour &lt;= 23 and $min &lt;= 59 and $sec &lt;= 60">
1979 <xsl:call-template name="date:_format-date">
1980 <xsl:with-param name="year" select="'NaN'"/>
1981 <xsl:with-param name="month" select="'NaN'"/>
1982 <xsl:with-param name="day" select="'NaN'"/>
1983 <xsl:with-param name="hour" select="$hour"/>
1984 <xsl:with-param name="minute" select="$min"/>
1985 <xsl:with-param name="second" select="$sec"/>
1986 <xsl:with-param name="timezone" select="$timezone"/>
1987 <xsl:with-param name="pattern" select="$pattern"/>
1988 </xsl:call-template>
1989 </xsl:if>
1990 </xsl:when>
1991 <xsl:otherwise>
1992 <xsl:variable name="year" select="substring($dt, 1, 4) * (($neg * -2) + 1)"/>
1993 <xsl:choose>
1994 <xsl:when test="not(number($year))"/>
1995 <xsl:when test="$dt-length = 4">
1996 <xsl:call-template name="date:_format-date">
1997 <xsl:with-param name="year" select="$year"/>
1998 <xsl:with-param name="timezone" select="$timezone"/>
1999 <xsl:with-param name="pattern" select="$pattern"/>
2000 </xsl:call-template>
2001 </xsl:when>
2002 <xsl:when test="substring($dt, 5, 1) = '-'">
2003 <xsl:variable name="month" select="substring($dt, 6, 2)"/>
2004 <xsl:choose>
2005 <xsl:when test="not($month &lt;= 12)"/>
2006 <xsl:when test="$dt-length = 7">
2007 <xsl:call-template name="date:_format-date">
2008 <xsl:with-param name="year" select="$year"/>
2009 <xsl:with-param name="month" select="$month"/>
2010 <xsl:with-param name="timezone" select="$timezone"/>
2011 <xsl:with-param name="pattern" select="$pattern"/>
2012 </xsl:call-template>
2013 </xsl:when>
2014 <xsl:when test="substring($dt, 8, 1) = '-'">
2015 <xsl:variable name="day" select="substring($dt, 9, 2)"/>
2016 <xsl:if test="$day &lt;= 31">
2017 <xsl:choose>
2018 <xsl:when test="$dt-length = 10">
2019 <xsl:call-template name="date:_format-date">
2020 <xsl:with-param name="year" select="$year"/>
2021 <xsl:with-param name="month" select="$month"/>
2022 <xsl:with-param name="day" select="$day"/>
2023 <xsl:with-param name="timezone" select="$timezone"/>
2024 <xsl:with-param name="pattern" select="$pattern"/>
2025 </xsl:call-template>
2026 </xsl:when>
2027 <xsl:when test="substring($dt, 11, 1) = 'T' and substring($dt, 14, 1) = ':' and substring($dt, 17, 1) = ':'">
2028 <xsl:variable name="hour" select="substring($dt, 12, 2)"/>
2029 <xsl:variable name="min" select="substring($dt, 15, 2)"/>
2030 <xsl:variable name="sec" select="substring($dt, 18)"/>
2031 <xsl:if test="$hour &lt;= 23 and $min &lt;= 59 and $sec &lt;= 60">
2032 <xsl:call-template name="date:_format-date">
2033 <xsl:with-param name="year" select="$year"/>
2034 <xsl:with-param name="month" select="$month"/>
2035 <xsl:with-param name="day" select="$day"/>
2036 <xsl:with-param name="hour" select="$hour"/>
2037 <xsl:with-param name="minute" select="$min"/>
2038 <xsl:with-param name="second" select="$sec"/>
2039 <xsl:with-param name="timezone" select="$timezone"/>
2040 <xsl:with-param name="pattern" select="$pattern"/>
2041 </xsl:call-template>
2042 </xsl:if>
2043 </xsl:when>
2044 </xsl:choose>
2045 </xsl:if>
2046 </xsl:when>
2047 </xsl:choose>
2048 </xsl:when>
2049 </xsl:choose>
2050 </xsl:otherwise>
2051 </xsl:choose>
2052 </xsl:if>
2053 </xsl:otherwise>
2054 </xsl:choose>
2055 </xsl:variable>
2056 <xsl:value-of select="$formatted"/>
2057 </xsl:template>
2058 <xsl:template name="date:_format-date">
2059 <xsl:param name="year"/>
2060 <xsl:param name="month" select="1"/>
2061 <xsl:param name="day" select="1"/>
2062 <xsl:param name="hour" select="0"/>
2063 <xsl:param name="minute" select="0"/>
2064 <xsl:param name="second" select="0"/>
2065 <xsl:param name="timezone" select="'Z'"/>
2066 <xsl:param name="pattern" select="''"/>
2067 <xsl:variable name="char" select="substring($pattern, 1, 1)"/>
2068 <xsl:choose>
2069 <xsl:when test="not($pattern)"/>
2070 <xsl:when test="$char = &quot;'&quot;">
2071 <xsl:choose>
2072 <xsl:when test="substring($pattern, 2, 1) = &quot;'&quot;">
2073 <xsl:text>'</xsl:text>
2074 <xsl:call-template name="date:_format-date">
2075 <xsl:with-param name="year" select="$year"/>
2076 <xsl:with-param name="month" select="$month"/>
2077 <xsl:with-param name="day" select="$day"/>
2078 <xsl:with-param name="hour" select="$hour"/>
2079 <xsl:with-param name="minute" select="$minute"/>
2080 <xsl:with-param name="second" select="$second"/>
2081 <xsl:with-param name="timezone" select="$timezone"/>
2082 <xsl:with-param name="pattern" select="substring($pattern, 3)"/>
2083 </xsl:call-template>
2084 </xsl:when>
2085 <xsl:otherwise>
2086 <xsl:variable name="literal-value" select="substring-before(substring($pattern, 2), &quot;'&quot;)"/>
2087 <xsl:value-of select="$literal-value"/>
2088 <xsl:call-template name="date:_format-date">
2089 <xsl:with-param name="year" select="$year"/>
2090 <xsl:with-param name="month" select="$month"/>
2091 <xsl:with-param name="day" select="$day"/>
2092 <xsl:with-param name="hour" select="$hour"/>
2093 <xsl:with-param name="minute" select="$minute"/>
2094 <xsl:with-param name="second" select="$second"/>
2095 <xsl:with-param name="timezone" select="$timezone"/>
2096 <xsl:with-param name="pattern" select="substring($pattern, string-length($literal-value) + 2)"/>
2097 </xsl:call-template>
2098 </xsl:otherwise>
2099 </xsl:choose>
2100 </xsl:when>
2101 <xsl:when test="not(contains('abcdefghjiklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ', $char))">
2102 <xsl:value-of select="$char"/>
2103 <xsl:call-template name="date:_format-date">
2104 <xsl:with-param name="year" select="$year"/>
2105 <xsl:with-param name="month" select="$month"/>
2106 <xsl:with-param name="day" select="$day"/>
2107 <xsl:with-param name="hour" select="$hour"/>
2108 <xsl:with-param name="minute" select="$minute"/>
2109 <xsl:with-param name="second" select="$second"/>
2110 <xsl:with-param name="timezone" select="$timezone"/>
2111 <xsl:with-param name="pattern" select="substring($pattern, 2)"/>
2112 </xsl:call-template>
2113 </xsl:when>
2114 <xsl:when test="not(contains('GyMdhHmsSEDFwWakKz', $char))">
2115 <xsl:message>
2116 Invalid token in format string: <xsl:value-of select="$char"/>
2117 </xsl:message>
2118 <xsl:call-template name="date:_format-date">
2119 <xsl:with-param name="year" select="$year"/>
2120 <xsl:with-param name="month" select="$month"/>
2121 <xsl:with-param name="day" select="$day"/>
2122 <xsl:with-param name="hour" select="$hour"/>
2123 <xsl:with-param name="minute" select="$minute"/>
2124 <xsl:with-param name="second" select="$second"/>
2125 <xsl:with-param name="timezone" select="$timezone"/>
2126 <xsl:with-param name="pattern" select="substring($pattern, 2)"/>
2127 </xsl:call-template>
2128 </xsl:when>
2129 <xsl:otherwise>
2130 <xsl:variable name="next-different-char" select="substring(translate($pattern, $char, ''), 1, 1)"/>
2131 <xsl:variable name="pattern-length">
2132 <xsl:choose>
2133 <xsl:when test="$next-different-char">
2134 <xsl:value-of select="string-length(substring-before($pattern, $next-different-char))"/>
2135 </xsl:when>
2136 <xsl:otherwise>
2137 <xsl:value-of select="string-length($pattern)"/>
2138 </xsl:otherwise>
2139 </xsl:choose>
2140 </xsl:variable>
2141 <xsl:choose>
2142 <xsl:when test="$char = 'G'">
2143 <xsl:choose>
2144 <xsl:when test="string($year) = 'NaN'"/>
2145 <xsl:when test="$year > 0">AD</xsl:when>
2146 <xsl:otherwise>BC</xsl:otherwise>
2147 </xsl:choose>
2148 </xsl:when>
2149 <xsl:when test="$char = 'M'">
2150 <xsl:choose>
2151 <xsl:when test="string($month) = 'NaN'"/>
2152 <xsl:when test="$pattern-length >= 3">
2153 <xsl:variable name="month-node" select="document('')/*/date:months/date:month[number($month)]"/>
2154 <xsl:choose>
2155 <xsl:when test="$pattern-length >= 4">
2156 <xsl:value-of select="$month-node"/>
2157 </xsl:when>
2158 <xsl:otherwise>
2159 <xsl:value-of select="$month-node/@abbr"/>
2160 </xsl:otherwise>
2161 </xsl:choose>
2162 </xsl:when>
2163 <xsl:when test="$pattern-length = 2">
2164 <xsl:value-of select="format-number($month, '00')"/>
2165 </xsl:when>
2166 <xsl:otherwise>
2167 <xsl:value-of select="$month"/>
2168 </xsl:otherwise>
2169 </xsl:choose>
2170 </xsl:when>
2171 <xsl:when test="$char = 'E'">
2172 <xsl:choose>
2173 <xsl:when test="string($year) = 'NaN' or string($month) = 'NaN' or string($day) = 'NaN'"/>
2174 <xsl:otherwise>
2175 <xsl:variable name="month-days" select="sum(document('')/*/date:months/date:month[position() &lt; $month]/@length)"/>
2176 <xsl:variable name="days" select="$month-days + $day + boolean(((not(boolean($year mod 4)) and $year mod 100) or not(boolean($year mod 400))) and $month > 2)"/>
2177 <xsl:variable name="y-1" select="$year - 1"/>
2178 <xsl:variable name="dow" select="(($y-1 + floor($y-1 div 4) - floor($y-1 div 100) + floor($y-1 div 400) + $days) mod 7) + 1"/>
2179 <xsl:variable name="day-node" select="document('')/*/date:days/date:day[number($dow)]"/>
2180 <xsl:choose>
2181 <xsl:when test="$pattern-length >= 4">
2182 <xsl:value-of select="$day-node"/>
2183 </xsl:when>
2184 <xsl:otherwise>
2185 <xsl:value-of select="$day-node/@abbr"/>
2186 </xsl:otherwise>
2187 </xsl:choose>
2188 </xsl:otherwise>
2189 </xsl:choose>
2190 </xsl:when>
2191 <xsl:when test="$char = 'a'">
2192 <xsl:choose>
2193 <xsl:when test="string($hour) = 'NaN'"/>
2194 <xsl:when test="$hour >= 12">PM</xsl:when>
2195 <xsl:otherwise>AM</xsl:otherwise>
2196 </xsl:choose>
2197 </xsl:when>
2198 <xsl:when test="$char = 'z'">
2199 <xsl:choose>
2200 <xsl:when test="$timezone = 'Z'">UTC</xsl:when>
2201 <xsl:otherwise>UTC<xsl:value-of select="$timezone"/>
2202 </xsl:otherwise>
2203 </xsl:choose>
2204 </xsl:when>
2205 <xsl:otherwise>
2206 <xsl:variable name="padding">
2207 <xsl:choose>
2208 <xsl:when test="$pattern-length > 10">
2209 <xsl:call-template name="str:padding">
2210 <xsl:with-param name="length" select="$pattern-length"/>
2211 <xsl:with-param name="chars" select="'0'"/>
2212 </xsl:call-template>
2213 </xsl:when>
2214 <xsl:otherwise>
2215 <xsl:value-of select="substring('0000000000', 1, $pattern-length)"/>
2216 </xsl:otherwise>
2217 </xsl:choose>
2218 </xsl:variable>
2219 <xsl:choose>
2220 <xsl:when test="$char = 'y'">
2221 <xsl:choose>
2222 <xsl:when test="string($year) = 'NaN'"/>
2223 <xsl:when test="$pattern-length > 2">
2224 <xsl:value-of select="format-number($year, $padding)"/>
2225 </xsl:when>
2226 <xsl:otherwise>
2227 <xsl:value-of select="format-number(substring($year, string-length($year) - 1), $padding)"/>
2228 </xsl:otherwise>
2229 </xsl:choose>
2230 </xsl:when>
2231 <xsl:when test="$char = 'd'">
2232 <xsl:choose>
2233 <xsl:when test="string($day) = 'NaN'"/>
2234 <xsl:otherwise>
2235 <xsl:value-of select="format-number($day, $padding)"/>
2236 </xsl:otherwise>
2237 </xsl:choose>
2238 </xsl:when>
2239 <xsl:when test="$char = 'h'">
2240 <xsl:variable name="h" select="$hour mod 12"/>
2241 <xsl:choose>
2242 <xsl:when test="string($hour) = 'NaN'"/>
2243 <xsl:when test="$h">
2244 <xsl:value-of select="format-number($h, $padding)"/>
2245 </xsl:when>
2246 <xsl:otherwise>
2247 <xsl:value-of select="format-number(12, $padding)"/>
2248 </xsl:otherwise>
2249 </xsl:choose>
2250 </xsl:when>
2251 <xsl:when test="$char = 'H'">
2252 <xsl:choose>
2253 <xsl:when test="string($hour) = 'NaN'"/>
2254 <xsl:otherwise>
2255 <xsl:value-of select="format-number($hour, $padding)"/>
2256 </xsl:otherwise>
2257 </xsl:choose>
2258 </xsl:when>
2259 <xsl:when test="$char = 'k'">
2260 <xsl:choose>
2261 <xsl:when test="string($hour) = 'NaN'"/>
2262 <xsl:when test="$hour">
2263 <xsl:value-of select="format-number($hour, $padding)"/>
2264 </xsl:when>
2265 <xsl:otherwise>
2266 <xsl:value-of select="format-number(24, $padding)"/>
2267 </xsl:otherwise>
2268 </xsl:choose>
2269 </xsl:when>
2270 <xsl:when test="$char = 'K'">
2271 <xsl:choose>
2272 <xsl:when test="string($hour) = 'NaN'"/>
2273 <xsl:otherwise>
2274 <xsl:value-of select="format-number($hour mod 12, $padding)"/>
2275 </xsl:otherwise>
2276 </xsl:choose>
2277 </xsl:when>
2278 <xsl:when test="$char = 'm'">
2279 <xsl:choose>
2280 <xsl:when test="string($minute) = 'NaN'"/>
2281 <xsl:otherwise>
2282 <xsl:value-of select="format-number($minute, $padding)"/>
2283 </xsl:otherwise>
2284 </xsl:choose>
2285 </xsl:when>
2286 <xsl:when test="$char = 's'">
2287 <xsl:choose>
2288 <xsl:when test="string($second) = 'NaN'"/>
2289 <xsl:otherwise>
2290 <xsl:value-of select="format-number($second, $padding)"/>
2291 </xsl:otherwise>
2292 </xsl:choose>
2293 </xsl:when>
2294 <xsl:when test="$char = 'S'">
2295 <xsl:choose>
2296 <xsl:when test="string($second) = 'NaN'"/>
2297 <xsl:otherwise>
2298 <xsl:value-of select="format-number(substring-after($second, '.'), $padding)"/>
2299 </xsl:otherwise>
2300 </xsl:choose>
2301 </xsl:when>
2302 <xsl:when test="$char = 'F'">
2303 <xsl:choose>
2304 <xsl:when test="string($day) = 'NaN'"/>
2305 <xsl:otherwise>
2306 <xsl:value-of select="floor($day div 7) + 1"/>
2307 </xsl:otherwise>
2308 </xsl:choose>
2309 </xsl:when>
2310 <xsl:when test="string($year) = 'NaN' or string($month) = 'NaN' or string($day) = 'NaN'"/>
2311 <xsl:otherwise>
2312 <xsl:variable name="month-days" select="sum(document('')/*/date:months/date:month[position() &lt; $month]/@length)"/>
2313 <xsl:variable name="days" select="$month-days + $day + boolean(((not($year mod 4) and $year mod 100) or not($year mod 400)) and $month > 2)"/>
2314 <xsl:choose>
2315 <xsl:when test="$char = 'D'">
2316 <xsl:value-of select="format-number($days, $padding)"/>
2317 </xsl:when>
2318 <xsl:when test="$char = 'w'">
2319 <xsl:call-template name="date:_week-in-year">
2320 <xsl:with-param name="days" select="$days"/>
2321 <xsl:with-param name="year" select="$year"/>
2322 </xsl:call-template>
2323 </xsl:when>
2324 <xsl:when test="$char = 'W'">
2325 <xsl:variable name="y-1" select="$year - 1"/>
2326 <xsl:variable name="day-of-week" select="(($y-1 + floor($y-1 div 4) - floor($y-1 div 100) + floor($y-1 div 400) + $days) mod 7) + 1"/>
2327 <xsl:choose>
2328 <xsl:when test="($day - $day-of-week) mod 7">
2329 <xsl:value-of select="floor(($day - $day-of-week) div 7) + 2"/>
2330 </xsl:when>
2331 <xsl:otherwise>
2332 <xsl:value-of select="floor(($day - $day-of-week) div 7) + 1"/>
2333 </xsl:otherwise>
2334 </xsl:choose>
2335 </xsl:when>
2336 </xsl:choose>
2337 </xsl:otherwise>
2338 </xsl:choose>
2339 </xsl:otherwise>
2340 </xsl:choose>
2341 <xsl:call-template name="date:_format-date">
2342 <xsl:with-param name="year" select="$year"/>
2343 <xsl:with-param name="month" select="$month"/>
2344 <xsl:with-param name="day" select="$day"/>
2345 <xsl:with-param name="hour" select="$hour"/>
2346 <xsl:with-param name="minute" select="$minute"/>
2347 <xsl:with-param name="second" select="$second"/>
2348 <xsl:with-param name="timezone" select="$timezone"/>
2349 <xsl:with-param name="pattern" select="substring($pattern, $pattern-length + 1)"/>
2350 </xsl:call-template>
2351 </xsl:otherwise>
2352 </xsl:choose>
2353 </xsl:template>
2354 <xsl:template name="date:_week-in-year">
2355 <xsl:param name="days"/>
2356 <xsl:param name="year"/>
2357 <xsl:variable name="y-1" select="$year - 1"/>
2358 <!-- this gives the day of the week, counting from Sunday = 0 -->
2359 <xsl:variable name="day-of-week" select="($y-1 + floor($y-1 div 4) - floor($y-1 div 100) + floor($y-1 div 400) + $days) mod 7"/>
2360 <!-- this gives the day of the week, counting from Monday = 1 -->
2361 <xsl:variable name="dow">
2362 <xsl:choose>
2363 <xsl:when test="$day-of-week">
2364 <xsl:value-of select="$day-of-week"/>
2365 </xsl:when>
2366 <xsl:otherwise>7</xsl:otherwise>
2367 </xsl:choose>
2368 </xsl:variable>
2369 <xsl:variable name="start-day" select="($days - $dow + 7) mod 7"/>
2370 <xsl:variable name="week-number" select="floor(($days - $dow + 7) div 7)"/>
2371 <xsl:choose>
2372 <xsl:when test="$start-day >= 4">
2373 <xsl:value-of select="$week-number + 1"/>
2374 </xsl:when>
2375 <xsl:otherwise>
2376 <xsl:choose>
2377 <xsl:when test="not($week-number)">
2378 <xsl:call-template name="date:_week-in-year">
2379 <xsl:with-param name="days" select="365 + ((not($y-1 mod 4) and $y-1 mod 100) or not($y-1 mod 400))"/>
2380 <xsl:with-param name="year" select="$y-1"/>
2381 </xsl:call-template>
2382 </xsl:when>
2383 <xsl:otherwise>
2384 <xsl:value-of select="$week-number"/>
2385 </xsl:otherwise>
2386 </xsl:choose>
2387 </xsl:otherwise>
2388 </xsl:choose>
2389 </xsl:template>
2390 <!-- str.padding.template.xsl -->
2391 <!-- This is from the EXSLT.org Library (http://www.exslt.org/) -->
2392 <xsl:template name="str:padding">
2393 <xsl:param name="length" select="0"/>
2394 <xsl:param name="chars" select="' '"/>
2395 <xsl:choose>
2396 <xsl:when test="not($length) or not($chars)"/>
2397 <xsl:otherwise>
2398 <xsl:variable name="string" select="concat($chars, $chars, $chars, $chars, $chars, $chars, $chars, $chars, $chars, $chars)"/>
2399 <xsl:choose>
2400 <xsl:when test="string-length($string) >= $length">
2401 <xsl:value-of select="substring($string, 1, $length)"/>
2402 </xsl:when>
2403 <xsl:otherwise>
2404 <xsl:call-template name="str:padding">
2405 <xsl:with-param name="length" select="$length"/>
2406 <xsl:with-param name="chars" select="$string"/>
2407 </xsl:call-template>
2408 </xsl:otherwise>
2409 </xsl:choose>
2410 </xsl:otherwise>
2411 </xsl:choose>
2412 </xsl:template>
2413 <!-- actor.xsl -->
2414 <!-- Returns the name of the actor, if there is no name it returns the ActorObjectID that was passed in -->
2415 <xsl:template name="actorName">
2416 <xsl:param name="objID"/>
2417 <xsl:for-each select="/a:ContinuityOfCareRecord/a:Actors/a:Actor">
2418 <xsl:variable name="thisObjID" select="a:ActorObjectID"/>
2419 <xsl:if test="$objID = $thisObjID">
2420 <xsl:choose>
2421 <xsl:when test="a:Person">
2422 <xsl:choose>
2423 <xsl:when test="a:Person/a:Name/a:DisplayName">
2424 <xsl:value-of select="a:Person/a:Name/a:DisplayName"/>
2425 </xsl:when>
2426 <xsl:when test="a:Person/a:Name/a:CurrentName">
2427 <xsl:value-of select="a:Person/a:Name/a:CurrentName/a:Given"/>
2428 <xsl:text xml:space="preserve"> </xsl:text>
2429 <xsl:value-of select="a:Person/a:Name/a:CurrentName/a:Middle"/>
2430 <xsl:text xml:space="preserve"> </xsl:text>
2431 <xsl:value-of select="a:Person/a:Name/a:CurrentName/a:Family"/>
2432 <xsl:text xml:space="preserve"> </xsl:text>
2433 <xsl:value-of select="a:Person/a:Name/a:CurrentName/a:Suffix"/>
2434 <xsl:text xml:space="preserve"> </xsl:text>
2435 <xsl:value-of select="a:Person/a:Name/a:CurrentName/a:Title"/>
2436 <xsl:text xml:space="preserve"> </xsl:text>
2437 </xsl:when>
2438 <xsl:when test="a:Person/a:Name/a:BirthName">
2439 <xsl:value-of select="a:Person/a:Name/a:BirthName/a:Given"/>
2440 <xsl:text xml:space="preserve"> </xsl:text>
2441 <xsl:value-of select="a:Person/a:Name/a:BirthName/a:Middle"/>
2442 <xsl:text xml:space="preserve"> </xsl:text>
2443 <xsl:value-of select="a:Person/a:Name/a:BirthName/a:Family"/>
2444 <xsl:text xml:space="preserve"> </xsl:text>
2445 <xsl:value-of select="a:Person/a:Name/a:BirthName/a:Suffix"/>
2446 <xsl:text xml:space="preserve"> </xsl:text>
2447 <xsl:value-of select="a:Person/a:Name/a:BirthName/a:Title"/>
2448 <xsl:text xml:space="preserve"> </xsl:text>
2449 </xsl:when>
2450 <xsl:when test="a:Person/a:Name/a:AdditionalName">
2451 <xsl:for-each select="a:Person/a:Name/a:AdditionalName">
2452 <xsl:value-of select="a:Given"/>
2453 <xsl:text xml:space="preserve"> </xsl:text>
2454 <xsl:value-of select="a:Middle"/>
2455 <xsl:text xml:space="preserve"> </xsl:text>
2456 <xsl:value-of select="a:Family"/>
2457 <xsl:text xml:space="preserve"> </xsl:text>
2458 <xsl:value-of select="a:Suffix"/>
2459 <xsl:text xml:space="preserve"> </xsl:text>
2460 <xsl:value-of select="a:Title"/>
2461 <xsl:text xml:space="preserve"> </xsl:text>
2462 <xsl:if test="position() != last()">
2463 <br/>
2464 </xsl:if>
2465 </xsl:for-each>
2466 </xsl:when>
2467 </xsl:choose>
2468 </xsl:when>
2469 <xsl:when test="a:Organization">
2470 <xsl:value-of select="a:Organization/a:Name"/>
2471 </xsl:when>
2472 <xsl:when test="a:InformationSystem">
2473 <xsl:value-of select="a:InformationSystem/a:Name"/>
2474 <xsl:text xml:space="preserve"> </xsl:text>
2475 <xsl:if test="a:InformationSystem/a:Version">
2476 <xsl:value-of select="a:InformationSystem/a:Version"/>
2477 <xsl:text xml:space="preserve"> </xsl:text>
2478 </xsl:if>
2479 <xsl:if test="a:InformationSystem/a:Type">(<xsl:value-of select="a:InformationSystem/a:Type"/>)</xsl:if>
2480 </xsl:when>
2481 <xsl:otherwise>
2482 <xsl:value-of select="$objID"/>
2483 </xsl:otherwise>
2484 </xsl:choose>
2485 </xsl:if>
2486 </xsl:for-each>
2487 </xsl:template>
2488 <!-- code.xsl -->
2489 <xsl:template match="a:Code">
2490 <xsl:value-of select="a:Value"/>
2491 <xsl:if test="a:CodingSystem">
2492 <xsl:text xml:space="preserve"> </xsl:text>(<xsl:value-of select="a:CodingSystem"/>)
2493 </xsl:if>
2494 </xsl:template>
2495 <!--datetime. xsl -->
2496 <!-- Displays the DateTime. If ExactDateTime is present, it will format according
2497 to the 'fmt' variable. The default format is: Oct 31, 2005 -->
2498 <xsl:template match="DateTime" name="dateTime">
2499 <xsl:param name="dt" select="."/>
2500 <xsl:param name="fmt">MMM dd, yyyy</xsl:param>
2501 <tr>
2502 <xsl:if test="$dt/a:Type/a:Text">
2503 <td>
2504 <xsl:value-of select="$dt/a:Type/a:Text"/>:</td>
2505 </xsl:if>
2506 <xsl:choose>
2507 <xsl:when test="$dt/a:ExactDateTime">
2508 <td>
2509 <xsl:call-template name="date:format-date">
2510 <xsl:with-param name="date-time">
2511 <xsl:value-of select="$dt/a:ExactDateTime"/>
2512 </xsl:with-param>
2513 <xsl:with-param name="pattern" select="$fmt"/>
2514 </xsl:call-template>
2515 </td>
2516 </xsl:when>
2517 <xsl:when test="$dt/a:Age">
2518 <td>
2519 <xsl:value-of select="$dt/a:Age/a:Value"/>
2520 <xsl:text xml:space="preserve"> </xsl:text>
2521 <xsl:value-of select="$dt/a:Age/a:Units/a:Unit"/>
2522 </td>
2523 </xsl:when>
2524 <xsl:when test="$dt/a:ApproximateDateTime">
2525 <td>
2526 <xsl:value-of select="$dt/a:ApproximateDateTime/a:Text"/>
2527 </td>
2528 </xsl:when>
2529 <xsl:when test="$dt/a:DateTimeRange">
2530 <td>
2531 <xsl:for-each select="$dt/a:DateTimeRange/a:BeginRange">
2532 <xsl:choose>
2533 <xsl:when test="$dt/a:ExactDateTime">
2534 <xsl:call-template name="date:format-date">
2535 <xsl:with-param name="date-time">
2536 <xsl:value-of select="$dt/a:ExactDateTime"/>
2537 </xsl:with-param>
2538 <xsl:with-param name="pattern" select="$fmt"/>
2539 </xsl:call-template>
2540 </xsl:when>
2541 <xsl:when test="$dt/a:Age">
2542 <xsl:value-of select="$dt/a:Age/a:Value"/>
2543 <xsl:text xml:space="preserve"> </xsl:text>
2544 <xsl:value-of select="$dt/a:Age/a:Units/a:Unit"/>
2545 </xsl:when>
2546 <xsl:when test="$dt/a:ApproximateDateTime">
2547 <xsl:value-of select="$dt/a:ApproximateDateTime/a:Text"/>
2548 </xsl:when>
2549 <xsl:otherwise/>
2550 </xsl:choose>
2551 </xsl:for-each>
2552 <xsl:text xml:space="preserve"> </xsl:text>
2553 <xsl:text>-</xsl:text>
2554 <xsl:text xml:space="preserve"> </xsl:text>
2555 <xsl:for-each select="$dt/a:DateTimeRange/a:EndRange">
2556 <xsl:choose>
2557 <xsl:when test="$dt/a:ExactDateTime">
2558 <xsl:call-template name="date:format-date">
2559 <xsl:with-param name="date-time">
2560 <xsl:value-of select="$dt/a:ExactDateTime"/>
2561 </xsl:with-param>
2562 <xsl:with-param name="pattern" select="$fmt"/>
2563 </xsl:call-template>
2564 </xsl:when>
2565 <xsl:when test="$dt/a:Age">
2566 <xsl:value-of select="$dt/a:Age/a:Value"/>
2567 <xsl:text xml:space="preserve"> </xsl:text>
2568 <xsl:value-of select="$dt/a:Age/a:Units/a:Unit"/>
2569 </xsl:when>
2570 <xsl:when test="$dt/a:ApproximateDateTime">
2571 <xsl:value-of select="$dt/a:ApproximateDateTime/a:Text"/>
2572 </xsl:when>
2573 <xsl:otherwise/>
2574 </xsl:choose>
2575 </xsl:for-each>
2576 </td>
2577 </xsl:when>
2578 <xsl:otherwise/>
2579 </xsl:choose>
2580 </tr>
2581 </xsl:template>
2582 <!-- defaultCSS.xsl -->
2583 <xsl:template name="defaultCCS">
2584 <style type="text/css">&lt;!--
2586 font-size: small;
2587 font-family: Arial, sans-serif;
2590 font-size: 150%;
2592 strong.clinical {
2593 color: #3300FF;
2596 margin-left: 20px
2598 span.header{
2599 font-weight: bold;
2600 font-size: medium;
2601 line-height: 16pt;
2602 padding-top: 10px;
2604 table.list {
2605 padding-bottom: 5px;
2606 border: thin solid #cccccc;
2607 border-style-internal: thin solid #cccccc;
2608 BORDER-COLLAPSE: collapse;
2609 background: white;
2610 background-image: none
2612 table.list th {
2613 text-align: left;
2614 FONT-WEIGHT: bold;
2615 COLOR: white;
2616 background: #006699;
2617 background-image: none
2619 table.list td {
2620 padding: 5px;
2621 border: thin solid #cccccc;
2622 vertical-align: top;
2624 table.internal {
2625 border: none;
2627 table.internal td {
2628 vertical-align: top;
2629 padding: 1px;
2630 border: none;
2632 table.internal tr.even{
2633 background: #CEFFFF;
2634 background-image: none
2636 --&gt;</style>
2637 </xsl:template>
2638 <!-- directions.xsl -->
2639 <xsl:template match="a:Directions">
2640 <xsl:for-each select="a:Direction">
2641 <xsl:choose>
2642 <xsl:when test="position() mod 2=0">
2643 <tr class="even">
2644 <xsl:choose>
2645 <xsl:when test="a:Description/a:Text">
2646 <td>
2647 <xsl:value-of select="a:Description/a:Text"/>
2648 </td>
2649 </xsl:when>
2650 <xsl:otherwise>
2651 <td>
2652 <xsl:value-of select="a:DeliveryMethod/a:Text"/>
2653 <xsl:text xml:space="preserve"> </xsl:text>
2654 <xsl:value-of select="a:Dose/a:Value"/>
2655 <xsl:text xml:space="preserve"> </xsl:text>
2656 <xsl:value-of select="a:Dose/a:Units/a:Unit"/>
2657 <xsl:text xml:space="preserve"> </xsl:text>
2658 <xsl:value-of select="a:Route/a:Text"/>
2659 <xsl:text xml:space="preserve"> </xsl:text>
2660 <xsl:value-of select="a:Frequency/a:Value"/>
2661 <xsl:if test="a:Duration">
2662 <xsl:text xml:space="preserve"> </xsl:text>(for <xsl:value-of select="a:Duration/a:Value"/>
2663 <xsl:text xml:space="preserve"> </xsl:text>
2664 <xsl:value-of select="a:Duration/a:Units/a:Unit"/>)
2665 </xsl:if>
2666 </td>
2667 <xsl:if test="a:MultipleDirectionModifier/a:ObjectAttribute">
2668 <td>
2669 <xsl:if test="a:MultipleDirectionModifier/a:Text">
2670 <xsl:value-of select="a:MultipleDirectionModifier/a:Text"/>
2671 <xsl:text xml:space="preserve"> </xsl:text>
2672 </xsl:if>
2673 <xsl:for-each select="a:MultipleDirectionModifier/a:ObjectAttribute">
2674 <xsl:value-of select="a:Attribute"/>
2675 <br/>
2676 <xsl:value-of select="a:AttributeValue/a:Value"/>
2677 </xsl:for-each>
2678 </td>
2679 </xsl:if>
2680 </xsl:otherwise>
2681 </xsl:choose>
2682 </tr>
2683 </xsl:when>
2684 <xsl:otherwise>
2685 <tr class="odd">
2686 <xsl:choose>
2687 <xsl:when test="a:Description/a:Text">
2688 <td>
2689 <xsl:value-of select="a:Description/a:Text"/>
2690 </td>
2691 </xsl:when>
2692 <xsl:otherwise>
2693 <td>
2694 <xsl:value-of select="a:DeliveryMethod/a:Text"/>
2695 <xsl:text xml:space="preserve"> </xsl:text>
2696 <xsl:value-of select="a:Dose/a:Value"/>
2697 <xsl:text xml:space="preserve"> </xsl:text>
2698 <xsl:value-of select="a:Dose/a:Units/a:Unit"/>
2699 <xsl:text xml:space="preserve"> </xsl:text>
2700 <xsl:value-of select="a:Route/a:Text"/>
2701 <xsl:text xml:space="preserve"> </xsl:text>
2702 <xsl:value-of select="a:Frequency/a:Value"/>
2703 <xsl:if test="a:Duration">
2704 <xsl:text xml:space="preserve"> </xsl:text>(for <xsl:value-of select="a:Duration/a:Value"/>
2705 <xsl:text xml:space="preserve"> </xsl:text>
2706 <xsl:value-of select="a:Duration/a:Units/a:Unit"/>)
2707 </xsl:if>
2708 </td>
2709 <xsl:if test="a:MultipleDirectionModifier/a:ObjectAttribute">
2710 <td>
2711 <xsl:for-each select="a:MultipleDirectionModifier/a:ObjectAttribute">
2712 <xsl:value-of select="a:Attribute"/>
2713 <br/>
2714 <xsl:value-of select="a:AttributeValue/a:Value"/>
2715 </xsl:for-each>
2716 </td>
2717 </xsl:if>
2718 </xsl:otherwise>
2719 </xsl:choose>
2720 </tr>
2721 </xsl:otherwise>
2722 </xsl:choose>
2723 </xsl:for-each>
2724 </xsl:template>
2725 <!-- footer.xsl -->
2726 <!-- HTML Footer for CCR.XSL -->
2727 <xsl:template name="footer">
2728 <br/>
2729 <hr/>
2730 <table cellspacing="3">
2731 <tbody>
2732 <tr>
2733 <th>
2734 <font color="#CCCCCC" size="2">
2735 <!-- The stylesheet used to generate this view of the CCR was provided by the American Academy of Family Physicians and the CCR Acceleration Task Force -->
2736 The stylesheet used to generate this view of the CCR was provided by Garden Health.
2737 </font>
2738 </th>
2739 </tr>
2740 <tr>
2741 <td/>
2742 </tr>
2743 <tr>
2744 <td>
2745 <font color="#CCCCCC" size="3">
2746 <strong>Powered by the <a href="http://www.astm.org/cgi-bin/SoftCart.exe/DATABASE.CART/REDLINE_PAGES/E2369.htm?E+mystore" style="color:#CCCCCC;">ASTM E2369-05 Specification for the Continuity of Care Record (CCR)</a>
2747 </strong>
2748 </font>
2749 </td>
2750 </tr>
2751 </tbody>
2752 </table>
2753 </xsl:template>
2754 <!-- problemDescription.xsl -->
2755 <!-- Returns the description of the problem, if there is no name it returns the ObjectID that was passed in -->
2756 <xsl:template name="problemDescription">
2757 <xsl:param name="objID"/>
2758 <xsl:for-each select="/a:ContinuityOfCareRecord/a:Body/a:Problems/a:Problem">
2759 <xsl:variable name="thisObjID" select="a:CCRDataObjectID"/>
2760 <xsl:if test="$objID = $thisObjID">
2761 <xsl:choose>
2762 <xsl:when test="a:Description/a:Text">
2763 <xsl:value-of select="a:Description/a:Text"/>
2764 </xsl:when>
2765 <xsl:otherwise>
2766 <xsl:value-of select="$objID"/>
2767 </xsl:otherwise>
2768 </xsl:choose>
2769 </xsl:if>
2770 </xsl:for-each>
2771 </xsl:template>
2772 </xsl:stylesheet>