PageRenderTime 84ms CodeModel.GetById 21ms RepoModel.GetById 1ms app.codeStats 0ms

/CDA.xsl

https://github.com/jayrawk26/sample_ccdas
Extensible Stylesheet Language Transformations | 2542 lines | 2510 code | 32 blank | 0 comment | 0 complexity | e330de00bed62bd99c47765931a112e0 MD5 | raw file

Large files files are truncated, but you can click here to view the full file

  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. Revision History: 04/06/14 Rick Geimer security hot fixes: Addressed javascript in nonXMLBody/text/reference/@value and non-sanitized copy of all table attributes.
  13. Revision History: 04/07/14 Rick Geimer more security fixes. Limited copy of only legal CDA table attributes to XHTML output.
  14. Revision History: 04/07/14 Rick Geimer more security fixes. Fixed some bugs from the hot fix on 4/6 ($uc and $lc swapped during some translates). Added limit-external-images param that defaults to yes. When set to yes, no URIs with colons (protocol URLs) or beginning with double slashes (protocol relative URLs) are allowed in observation media. I'll revise later to add a whitelist capability.
  15. Revision History: 04/13/14 Rick Geimer more security fixes. Added sandbox attribute to iframe. Added td to the list of elements with restricted table attributes (missed that one previously). Fixed some typos. Cleaned up CSS styles. Merged the table templates since they all use the same code. Fixed a bug with styleCode processing that could result in lost data. Added external-image-whitelist param.
  16. Specification: ANSI/HL7 CDAR2
  17. The current version and documentation are available at http://www.lantanagroup.com/resources/tools/.
  18. We welcome feedback and contributions to tools@lantanagroup.com
  19. The stylesheet is the cumulative work of several developers; the most significant prior milestones were the foundation work from HL7
  20. Germany and Finland (Tyylitiedosto) and HL7 US (Calvin Beebe), and the presentation approach from Tony Schaller, medshare GmbH provided at IHIC 2009.
  21. -->
  22. <!-- LICENSE INFORMATION
  23. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
  24. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
  25. -->
  26. <xsl:stylesheet version="1.0"
  27. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  28. xmlns:n1="urn:hl7-org:v3"
  29. xmlns:in="urn:lantana-com:inline-variable-data">
  30. <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"/>
  31. <xsl:param name="limit-external-images" select="'yes'"/>
  32. <!-- A vertical bar separated list of URI prefixes, such as "http://www.example.com|https://www.example.com" -->
  33. <xsl:param name="external-image-whitelist"/>
  34. <!-- string processing variables -->
  35. <xsl:variable name="lc" select="'abcdefghijklmnopqrstuvwxyz'" />
  36. <xsl:variable name="uc" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'" />
  37. <!-- removes the following characters, in addition to line breaks "':;?`{}“”„‚’ -->
  38. <xsl:variable name="simple-sanitizer-match"><xsl:text>&#10;&#13;&#34;&#39;&#58;&#59;&#63;&#96;&#123;&#125;&#8220;&#8221;&#8222;&#8218;&#8217;</xsl:text></xsl:variable>
  39. <xsl:variable name="simple-sanitizer-replace" select="'***************'"/>
  40. <xsl:variable name="javascript-injection-warning">WARNING: Javascript injection attempt detected in source CDA document. Terminating</xsl:variable>
  41. <xsl:variable name="malicious-content-warning">WARNING: Potentially malicious content found in CDA document.</xsl:variable>
  42. <!-- global variable title -->
  43. <xsl:variable name="title">
  44. <xsl:choose>
  45. <xsl:when test="string-length(/n1:ClinicalDocument/n1:title) &gt;= 1">
  46. <xsl:value-of select="/n1:ClinicalDocument/n1:title"/>
  47. </xsl:when>
  48. <xsl:when test="/n1:ClinicalDocument/n1:code/@displayName">
  49. <xsl:value-of select="/n1:ClinicalDocument/n1:code/@displayName"/>
  50. </xsl:when>
  51. <xsl:otherwise>
  52. <xsl:text>Clinical Document</xsl:text>
  53. </xsl:otherwise>
  54. </xsl:choose>
  55. </xsl:variable>
  56. <!-- Main -->
  57. <xsl:template match="/">
  58. <xsl:apply-templates select="n1:ClinicalDocument"/>
  59. </xsl:template>
  60. <!-- produce browser rendered, human readable clinical document -->
  61. <xsl:template match="n1:ClinicalDocument">
  62. <html>
  63. <head>
  64. <xsl:comment> Do NOT edit this HTML directly: it was generated via an XSLT transformation from a CDA Release 2 XML document. </xsl:comment>
  65. <title>
  66. <xsl:value-of select="$title"/>
  67. </title>
  68. <xsl:call-template name="addCSS"/>
  69. </head>
  70. <body>
  71. <h1 class="h1center">
  72. <xsl:value-of select="$title"/>
  73. </h1>
  74. <!-- START display top portion of clinical document -->
  75. <xsl:call-template name="recordTarget"/>
  76. <xsl:call-template name="documentGeneral"/>
  77. <xsl:call-template name="documentationOf"/>
  78. <xsl:call-template name="author"/>
  79. <xsl:call-template name="componentOf"/>
  80. <xsl:call-template name="participant"/>
  81. <xsl:call-template name="dataEnterer"/>
  82. <xsl:call-template name="authenticator"/>
  83. <xsl:call-template name="informant"/>
  84. <xsl:call-template name="informationRecipient"/>
  85. <xsl:call-template name="legalAuthenticator"/>
  86. <xsl:call-template name="custodian"/>
  87. <!-- END display top portion of clinical document -->
  88. <!-- produce table of contents -->
  89. <xsl:if test="not(//n1:nonXMLBody)">
  90. <xsl:if test="count(/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component[n1:section]) &gt; 1">
  91. <xsl:call-template name="make-tableofcontents"/>
  92. </xsl:if>
  93. </xsl:if>
  94. <hr align="left" color="teal" size="2"/>
  95. <!-- produce human readable document content -->
  96. <xsl:apply-templates select="n1:component/n1:structuredBody|n1:component/n1:nonXMLBody"/>
  97. <br/>
  98. <br/>
  99. </body>
  100. </html>
  101. </xsl:template>
  102. <!-- generate table of contents -->
  103. <xsl:template name="make-tableofcontents">
  104. <h2>
  105. <a name="toc">Table of Contents</a>
  106. </h2>
  107. <ul>
  108. <xsl:for-each select="n1:component/n1:structuredBody/n1:component/n1:section/n1:title">
  109. <li>
  110. <a href="#{generate-id(.)}">
  111. <xsl:value-of select="."/>
  112. </a>
  113. </li>
  114. </xsl:for-each>
  115. </ul>
  116. </xsl:template>
  117. <!-- header elements -->
  118. <xsl:template name="documentGeneral">
  119. <table class="header_table">
  120. <tbody>
  121. <tr>
  122. <td class="td_header_role_name">
  123. <span class="td_label">
  124. <xsl:text>Document Id</xsl:text>
  125. </span>
  126. </td>
  127. <td class="td_header_role_value">
  128. <xsl:call-template name="show-id">
  129. <xsl:with-param name="id" select="n1:id"/>
  130. </xsl:call-template>
  131. </td>
  132. </tr>
  133. <tr>
  134. <td class="td_header_role_name">
  135. <span class="td_label">
  136. <xsl:text>Document Created:</xsl:text>
  137. </span>
  138. </td>
  139. <td class="td_header_role_value">
  140. <xsl:call-template name="show-time">
  141. <xsl:with-param name="datetime" select="n1:effectiveTime"/>
  142. </xsl:call-template>
  143. </td>
  144. </tr>
  145. </tbody>
  146. </table>
  147. </xsl:template>
  148. <!-- confidentiality -->
  149. <xsl:template name="confidentiality">
  150. <table class="header_table">
  151. <tbody>
  152. <td class="td_header_role_name">
  153. <xsl:text>Confidentiality</xsl:text>
  154. </td>
  155. <td class="td_header_role_value">
  156. <xsl:choose>
  157. <xsl:when test="n1:confidentialityCode/@code = &apos;N&apos;">
  158. <xsl:text>Normal</xsl:text>
  159. </xsl:when>
  160. <xsl:when test="n1:confidentialityCode/@code = &apos;R&apos;">
  161. <xsl:text>Restricted</xsl:text>
  162. </xsl:when>
  163. <xsl:when test="n1:confidentialityCode/@code = &apos;V&apos;">
  164. <xsl:text>Very restricted</xsl:text>
  165. </xsl:when>
  166. </xsl:choose>
  167. <xsl:if test="n1:confidentialityCode/n1:originalText">
  168. <xsl:text> </xsl:text>
  169. <xsl:value-of select="n1:confidentialityCode/n1:originalText"/>
  170. </xsl:if>
  171. </td>
  172. </tbody>
  173. </table>
  174. </xsl:template>
  175. <!-- author -->
  176. <xsl:template name="author">
  177. <xsl:if test="n1:author">
  178. <table class="header_table">
  179. <tbody>
  180. <xsl:for-each select="n1:author/n1:assignedAuthor">
  181. <tr>
  182. <td class="td_header_role_name">
  183. <span class="td_label">
  184. <xsl:text>Author</xsl:text>
  185. </span>
  186. </td>
  187. <td class="td_header_role_value">
  188. <xsl:choose>
  189. <xsl:when test="n1:assignedPerson/n1:name">
  190. <xsl:call-template name="show-name">
  191. <xsl:with-param name="name" select="n1:assignedPerson/n1:name"/>
  192. </xsl:call-template>
  193. <xsl:if test="n1:representedOrganization">
  194. <xsl:text>, </xsl:text>
  195. <xsl:call-template name="show-name">
  196. <xsl:with-param name="name" select="n1:representedOrganization/n1:name"/>
  197. </xsl:call-template>
  198. </xsl:if>
  199. </xsl:when>
  200. <xsl:when test="n1:assignedAuthoringDevice/n1:softwareName">
  201. <xsl:value-of select="n1:assignedAuthoringDevice/n1:softwareName"/>
  202. </xsl:when>
  203. <xsl:when test="n1:representedOrganization">
  204. <xsl:call-template name="show-name">
  205. <xsl:with-param name="name" select="n1:representedOrganization/n1:name"/>
  206. </xsl:call-template>
  207. </xsl:when>
  208. <xsl:otherwise>
  209. <xsl:for-each select="n1:id">
  210. <xsl:call-template name="show-id">
  211. <xsl:with-param name="id" select="."/>
  212. </xsl:call-template>
  213. <br/>
  214. </xsl:for-each>
  215. </xsl:otherwise>
  216. </xsl:choose>
  217. </td>
  218. </tr>
  219. <xsl:if test="n1:addr | n1:telecom">
  220. <tr>
  221. <td class="td_header_role_name">
  222. <span class="td_label">Contact info</span>
  223. </td>
  224. <td class="td_header_role_value">
  225. <xsl:call-template name="show-contactInfo">
  226. <xsl:with-param name="contact" select="."/>
  227. </xsl:call-template>
  228. </td>
  229. </tr>
  230. </xsl:if>
  231. </xsl:for-each>
  232. </tbody>
  233. </table>
  234. </xsl:if>
  235. </xsl:template>
  236. <!-- authenticator -->
  237. <xsl:template name="authenticator">
  238. <xsl:if test="n1:authenticator">
  239. <table class="header_table">
  240. <tbody>
  241. <tr>
  242. <xsl:for-each select="n1:authenticator">
  243. <tr>
  244. <td class="td_header_role_name">
  245. <span class="td_label">
  246. <xsl:text>Signed </xsl:text>
  247. </span>
  248. </td>
  249. <td class="td_header_role_value">
  250. <xsl:call-template name="show-name">
  251. <xsl:with-param name="name" select="n1:assignedEntity/n1:assignedPerson/n1:name"/>
  252. </xsl:call-template>
  253. <xsl:text> at </xsl:text>
  254. <xsl:call-template name="show-time">
  255. <xsl:with-param name="datetime" select="n1:time"/>
  256. </xsl:call-template>
  257. </td>
  258. </tr>
  259. <xsl:if test="n1:assignedEntity/n1:addr | n1:assignedEntity/n1:telecom">
  260. <tr>
  261. <td class="td_header_role_name">
  262. <span class="td_label">Contact info</span>
  263. </td>
  264. <td class="td_header_role_value">
  265. <xsl:call-template name="show-contactInfo">
  266. <xsl:with-param name="contact" select="n1:assignedEntity"/>
  267. </xsl:call-template>
  268. </td>
  269. </tr>
  270. </xsl:if>
  271. </xsl:for-each>
  272. </tr>
  273. </tbody>
  274. </table>
  275. </xsl:if>
  276. </xsl:template>
  277. <!-- legalAuthenticator -->
  278. <xsl:template name="legalAuthenticator">
  279. <xsl:if test="n1:legalAuthenticator">
  280. <table class="header_table">
  281. <tbody>
  282. <tr>
  283. <td class="td_header_role_name">
  284. <span class="td_label">
  285. <xsl:text>Legal authenticator</xsl:text>
  286. </span>
  287. </td>
  288. <td class="td_header_role_value">
  289. <xsl:call-template name="show-assignedEntity">
  290. <xsl:with-param name="asgnEntity" select="n1:legalAuthenticator/n1:assignedEntity"/>
  291. </xsl:call-template>
  292. <xsl:text> </xsl:text>
  293. <xsl:call-template name="show-sig">
  294. <xsl:with-param name="sig" select="n1:legalAuthenticator/n1:signatureCode"/>
  295. </xsl:call-template>
  296. <xsl:if test="n1:legalAuthenticator/n1:time/@value">
  297. <xsl:text> at </xsl:text>
  298. <xsl:call-template name="show-time">
  299. <xsl:with-param name="datetime" select="n1:legalAuthenticator/n1:time"/>
  300. </xsl:call-template>
  301. </xsl:if>
  302. </td>
  303. </tr>
  304. <xsl:if test="n1:legalAuthenticator/n1:assignedEntity/n1:addr | n1:legalAuthenticator/n1:assignedEntity/n1:telecom">
  305. <tr>
  306. <td class="td_header_role_name">
  307. <span class="td_label">Contact info</span>
  308. </td>
  309. <td class="td_header_role_value">
  310. <xsl:call-template name="show-contactInfo">
  311. <xsl:with-param name="contact" select="n1:legalAuthenticator/n1:assignedEntity"/>
  312. </xsl:call-template>
  313. </td>
  314. </tr>
  315. </xsl:if>
  316. </tbody>
  317. </table>
  318. </xsl:if>
  319. </xsl:template>
  320. <!-- dataEnterer -->
  321. <xsl:template name="dataEnterer">
  322. <xsl:if test="n1:dataEnterer">
  323. <table class="header_table">
  324. <tbody>
  325. <tr>
  326. <td class="td_header_role_name">
  327. <span class="td_label">
  328. <xsl:text>Entered by</xsl:text>
  329. </span>
  330. </td>
  331. <td class="td_header_role_value">
  332. <xsl:call-template name="show-assignedEntity">
  333. <xsl:with-param name="asgnEntity" select="n1:dataEnterer/n1:assignedEntity"/>
  334. </xsl:call-template>
  335. </td>
  336. </tr>
  337. <xsl:if test="n1:dataEnterer/n1:assignedEntity/n1:addr | n1:dataEnterer/n1:assignedEntity/n1:telecom">
  338. <tr>
  339. <td class="td_header_role_name">
  340. <span class="td_label">Contact info</span>
  341. </td>
  342. <td class="td_header_role_value">
  343. <xsl:call-template name="show-contactInfo">
  344. <xsl:with-param name="contact" select="n1:dataEnterer/n1:assignedEntity"/>
  345. </xsl:call-template>
  346. </td>
  347. </tr>
  348. </xsl:if>
  349. </tbody>
  350. </table>
  351. </xsl:if>
  352. </xsl:template>
  353. <!-- componentOf -->
  354. <xsl:template name="componentOf">
  355. <xsl:if test="n1:componentOf">
  356. <table class="header_table">
  357. <tbody>
  358. <xsl:for-each select="n1:componentOf/n1:encompassingEncounter">
  359. <xsl:if test="n1:id">
  360. <xsl:choose>
  361. <xsl:when test="n1:code">
  362. <tr>
  363. <td class="td_header_role_name">
  364. <span class="td_label">
  365. <xsl:text>Encounter Id</xsl:text>
  366. </span>
  367. </td>
  368. <td class="td_header_role_value">
  369. <xsl:call-template name="show-id">
  370. <xsl:with-param name="id" select="n1:id"/>
  371. </xsl:call-template>
  372. </td>
  373. </tr>
  374. <tr>
  375. <td class="td_header_role_name">
  376. <span class="td_label">
  377. <xsl:text>Encounter Type</xsl:text>
  378. </span>
  379. </td>
  380. <td class="td_header_role_value">
  381. <xsl:call-template name="show-code">
  382. <xsl:with-param name="code" select="n1:code"/>
  383. </xsl:call-template>
  384. </td>
  385. </tr>
  386. </xsl:when>
  387. <xsl:otherwise>
  388. <tr>
  389. <td class="td_header_role_name">
  390. <span class="td_label">
  391. <xsl:text>Encounter Id</xsl:text>
  392. </span>
  393. </td>
  394. <td class="td_header_role_value">
  395. <xsl:call-template name="show-id">
  396. <xsl:with-param name="id" select="n1:id"/>
  397. </xsl:call-template>
  398. </td>
  399. </tr>
  400. </xsl:otherwise>
  401. </xsl:choose>
  402. </xsl:if>
  403. <tr>
  404. <td class="td_header_role_name">
  405. <span class="td_label">
  406. <xsl:text>Encounter Date</xsl:text>
  407. </span>
  408. </td>
  409. <td class="td_header_role_value">
  410. <xsl:if test="n1:effectiveTime">
  411. <xsl:choose>
  412. <xsl:when test="n1:effectiveTime/@value">
  413. <xsl:text>&#160;at&#160;</xsl:text>
  414. <xsl:call-template name="show-time">
  415. <xsl:with-param name="datetime" select="n1:effectiveTime"/>
  416. </xsl:call-template>
  417. </xsl:when>
  418. <xsl:when test="n1:effectiveTime/n1:low">
  419. <xsl:text>&#160;From&#160;</xsl:text>
  420. <xsl:call-template name="show-time">
  421. <xsl:with-param name="datetime" select="n1:effectiveTime/n1:low"/>
  422. </xsl:call-template>
  423. <xsl:if test="n1:effectiveTime/n1:high">
  424. <xsl:text> to </xsl:text>
  425. <xsl:call-template name="show-time">
  426. <xsl:with-param name="datetime" select="n1:effectiveTime/n1:high"/>
  427. </xsl:call-template>
  428. </xsl:if>
  429. </xsl:when>
  430. </xsl:choose>
  431. </xsl:if>
  432. </td>
  433. </tr>
  434. <xsl:if test="n1:location/n1:healthCareFacility">
  435. <tr>
  436. <td class="td_header_role_name">
  437. <span class="td_label">
  438. <xsl:text>Encounter Location</xsl:text>
  439. </span>
  440. </td>
  441. <td class="td_header_role_value">
  442. <xsl:choose>
  443. <xsl:when test="n1:location/n1:healthCareFacility/n1:location/n1:name">
  444. <xsl:call-template name="show-name">
  445. <xsl:with-param name="name" select="n1:location/n1:healthCareFacility/n1:location/n1:name"/>
  446. </xsl:call-template>
  447. <xsl:for-each select="n1:location/n1:healthCareFacility/n1:serviceProviderOrganization/n1:name">
  448. <xsl:text> of </xsl:text>
  449. <xsl:call-template name="show-name">
  450. <xsl:with-param name="name" select="n1:location/n1:healthCareFacility/n1:serviceProviderOrganization/n1:name"/>
  451. </xsl:call-template>
  452. </xsl:for-each>
  453. </xsl:when>
  454. <xsl:when test="n1:location/n1:healthCareFacility/n1:code">
  455. <xsl:call-template name="show-code">
  456. <xsl:with-param name="code" select="n1:location/n1:healthCareFacility/n1:code"/>
  457. </xsl:call-template>
  458. </xsl:when>
  459. <xsl:otherwise>
  460. <xsl:if test="n1:location/n1:healthCareFacility/n1:id">
  461. <xsl:text>id: </xsl:text>
  462. <xsl:for-each select="n1:location/n1:healthCareFacility/n1:id">
  463. <xsl:call-template name="show-id">
  464. <xsl:with-param name="id" select="."/>
  465. </xsl:call-template>
  466. </xsl:for-each>
  467. </xsl:if>
  468. </xsl:otherwise>
  469. </xsl:choose>
  470. </td>
  471. </tr>
  472. </xsl:if>
  473. <xsl:if test="n1:responsibleParty">
  474. <tr>
  475. <td class="td_header_role_name">
  476. <span class="td_label">
  477. <xsl:text>Responsible party</xsl:text>
  478. </span>
  479. </td>
  480. <td class="td_header_role_value">
  481. <xsl:call-template name="show-assignedEntity">
  482. <xsl:with-param name="asgnEntity" select="n1:responsibleParty/n1:assignedEntity"/>
  483. </xsl:call-template>
  484. </td>
  485. </tr>
  486. </xsl:if>
  487. <xsl:if test="n1:responsibleParty/n1:assignedEntity/n1:addr | n1:responsibleParty/n1:assignedEntity/n1:telecom">
  488. <tr>
  489. <td class="td_header_role_name">
  490. <span class="td_label">Contact info</span>
  491. </td>
  492. <td class="td_header_role_value">
  493. <xsl:call-template name="show-contactInfo">
  494. <xsl:with-param name="contact" select="n1:responsibleParty/n1:assignedEntity"/>
  495. </xsl:call-template>
  496. </td>
  497. </tr>
  498. </xsl:if>
  499. </xsl:for-each>
  500. </tbody>
  501. </table>
  502. </xsl:if>
  503. </xsl:template>
  504. <!-- custodian -->
  505. <xsl:template name="custodian">
  506. <xsl:if test="n1:custodian">
  507. <table class="header_table">
  508. <tbody>
  509. <tr>
  510. <td class="td_header_role_name">
  511. <span class="td_label">
  512. <xsl:text>Document maintained by</xsl:text>
  513. </span>
  514. </td>
  515. <td class="td_header_role_value">
  516. <xsl:choose>
  517. <xsl:when test="n1:custodian/n1:assignedCustodian/n1:representedCustodianOrganization/n1:name">
  518. <xsl:call-template name="show-name">
  519. <xsl:with-param name="name" select="n1:custodian/n1:assignedCustodian/n1:representedCustodianOrganization/n1:name"/>
  520. </xsl:call-template>
  521. </xsl:when>
  522. <xsl:otherwise>
  523. <xsl:for-each select="n1:custodian/n1:assignedCustodian/n1:representedCustodianOrganization/n1:id">
  524. <xsl:call-template name="show-id"/>
  525. <xsl:if test="position()!=last()">
  526. <br/>
  527. </xsl:if>
  528. </xsl:for-each>
  529. </xsl:otherwise>
  530. </xsl:choose>
  531. </td>
  532. </tr>
  533. <xsl:if test="n1:custodian/n1:assignedCustodian/n1:representedCustodianOrganization/n1:addr | n1:custodian/n1:assignedCustodian/n1:representedCustodianOrganization/n1:telecom">
  534. <tr>
  535. <td class="td_header_role_name">
  536. <span class="td_label">Contact info</span>
  537. </td>
  538. <td class="td_header_role_value">
  539. <xsl:call-template name="show-contactInfo">
  540. <xsl:with-param name="contact" select="n1:custodian/n1:assignedCustodian/n1:representedCustodianOrganization"/>
  541. </xsl:call-template>
  542. </td>
  543. </tr>
  544. </xsl:if>
  545. </tbody>
  546. </table>
  547. </xsl:if>
  548. </xsl:template>
  549. <!-- documentationOf -->
  550. <xsl:template name="documentationOf">
  551. <xsl:if test="n1:documentationOf">
  552. <table class="header_table">
  553. <tbody>
  554. <xsl:for-each select="n1:documentationOf">
  555. <xsl:if test="n1:serviceEvent/@classCode and n1:serviceEvent/n1:code">
  556. <xsl:variable name="displayName">
  557. <xsl:call-template name="show-actClassCode">
  558. <xsl:with-param name="clsCode" select="n1:serviceEvent/@classCode"/>
  559. </xsl:call-template>
  560. </xsl:variable>
  561. <xsl:if test="$displayName">
  562. <tr>
  563. <td class="td_header_role_name">
  564. <span class="td_label">
  565. <xsl:call-template name="firstCharCaseUp">
  566. <xsl:with-param name="data" select="$displayName"/>
  567. </xsl:call-template>
  568. </span>
  569. </td>
  570. <td class="td_header_role_value">
  571. <xsl:call-template name="show-code">
  572. <xsl:with-param name="code" select="n1:serviceEvent/n1:code"/>
  573. </xsl:call-template>
  574. <xsl:if test="n1:serviceEvent/n1:effectiveTime">
  575. <xsl:choose>
  576. <xsl:when test="n1:serviceEvent/n1:effectiveTime/@value">
  577. <xsl:text>&#160;at&#160;</xsl:text>
  578. <xsl:call-template name="show-time">
  579. <xsl:with-param name="datetime" select="n1:serviceEvent/n1:effectiveTime"/>
  580. </xsl:call-template>
  581. </xsl:when>
  582. <xsl:when test="n1:serviceEvent/n1:effectiveTime/n1:low">
  583. <xsl:text>&#160;from&#160;</xsl:text>
  584. <xsl:call-template name="show-time">
  585. <xsl:with-param name="datetime" select="n1:serviceEvent/n1:effectiveTime/n1:low"/>
  586. </xsl:call-template>
  587. <xsl:if test="n1:serviceEvent/n1:effectiveTime/n1:high">
  588. <xsl:text> to </xsl:text>
  589. <xsl:call-template name="show-time">
  590. <xsl:with-param name="datetime" select="n1:serviceEvent/n1:effectiveTime/n1:high"/>
  591. </xsl:call-template>
  592. </xsl:if>
  593. </xsl:when>
  594. </xsl:choose>
  595. </xsl:if>
  596. </td>
  597. </tr>
  598. </xsl:if>
  599. </xsl:if>
  600. <xsl:for-each select="n1:serviceEvent/n1:performer">
  601. <xsl:variable name="displayName">
  602. <xsl:call-template name="show-participationType">
  603. <xsl:with-param name="ptype" select="@typeCode"/>
  604. </xsl:call-template>
  605. <xsl:text> </xsl:text>
  606. <xsl:if test="n1:functionCode/@code">
  607. <xsl:call-template name="show-participationFunction">
  608. <xsl:with-param name="pFunction" select="n1:functionCode/@code"/>
  609. </xsl:call-template>
  610. </xsl:if>
  611. </xsl:variable>
  612. <tr>
  613. <td class="td_header_role_name">
  614. <span class="td_label">
  615. <xsl:call-template name="firstCharCaseUp">
  616. <xsl:with-param name="data" select="$displayName"/>
  617. </xsl:call-template>
  618. </span>
  619. </td>
  620. <td class="td_header_role_value">
  621. <xsl:call-template name="show-assignedEntity">
  622. <xsl:with-param name="asgnEntity" select="n1:assignedEntity"/>
  623. </xsl:call-template>
  624. </td>
  625. </tr>
  626. </xsl:for-each>
  627. </xsl:for-each>
  628. </tbody>
  629. </table>
  630. </xsl:if>
  631. </xsl:template>
  632. <!-- inFulfillmentOf -->
  633. <xsl:template name="inFulfillmentOf">
  634. <xsl:if test="n1:infulfillmentOf">
  635. <table class="header_table">
  636. <tbody>
  637. <xsl:for-each select="n1:inFulfillmentOf">
  638. <tr>
  639. <td class="td_header_role_name">
  640. <span class="td_label">
  641. <xsl:text>In fulfillment of</xsl:text>
  642. </span>
  643. </td>
  644. <td class="td_header_role_value">
  645. <xsl:for-each select="n1:order">
  646. <xsl:for-each select="n1:id">
  647. <xsl:call-template name="show-id"/>
  648. </xsl:for-each>
  649. <xsl:for-each select="n1:code">
  650. <xsl:text>&#160;</xsl:text>
  651. <xsl:call-template name="show-code">
  652. <xsl:with-param name="code" select="."/>
  653. </xsl:call-template>
  654. </xsl:for-each>
  655. <xsl:for-each select="n1:priorityCode">
  656. <xsl:text>&#160;</xsl:text>
  657. <xsl:call-template name="show-code">
  658. <xsl:with-param name="code" select="."/>
  659. </xsl:call-template>
  660. </xsl:for-each>
  661. </xsl:for-each>
  662. </td>
  663. </tr>
  664. </xsl:for-each>
  665. </tbody>
  666. </table>
  667. </xsl:if>
  668. </xsl:template>
  669. <!-- informant -->
  670. <xsl:template name="informant">
  671. <xsl:if test="n1:informant">
  672. <table class="header_table">
  673. <tbody>
  674. <xsl:for-each select="n1:informant">
  675. <tr>
  676. <td class="td_header_role_name">
  677. <span class="td_label">
  678. <xsl:text>Informant</xsl:text>
  679. </span>
  680. </td>
  681. <td class="td_header_role_value">
  682. <xsl:if test="n1:assignedEntity">
  683. <xsl:call-template name="show-assignedEntity">
  684. <xsl:with-param name="asgnEntity" select="n1:assignedEntity"/>
  685. </xsl:call-template>
  686. </xsl:if>
  687. <xsl:if test="n1:relatedEntity">
  688. <xsl:call-template name="show-relatedEntity">
  689. <xsl:with-param name="relatedEntity" select="n1:relatedEntity"/>
  690. </xsl:call-template>
  691. </xsl:if>
  692. </td>
  693. </tr>
  694. <xsl:choose>
  695. <xsl:when test="n1:assignedEntity/n1:addr | n1:assignedEntity/n1:telecom">
  696. <tr>
  697. <td class="td_header_role_name">
  698. <span class="td_label">Contact info</span>
  699. </td>
  700. <td class="td_header_role_value">
  701. <xsl:if test="n1:assignedEntity">
  702. <xsl:call-template name="show-contactInfo">
  703. <xsl:with-param name="contact" select="n1:assignedEntity"/>
  704. </xsl:call-template>
  705. </xsl:if>
  706. </td>
  707. </tr>
  708. </xsl:when>
  709. <xsl:when test="n1:relatedEntity/n1:addr | n1:relatedEntity/n1:telecom">
  710. <tr>
  711. <td class="td_header_role_name">
  712. <span class="td_label">Contact info</span>
  713. </td>
  714. <td class="td_header_role_value">
  715. <xsl:if test="n1:relatedEntity">
  716. <xsl:call-template name="show-contactInfo">
  717. <xsl:with-param name="contact" select="n1:relatedEntity"/>
  718. </xsl:call-template>
  719. </xsl:if>
  720. </td>
  721. </tr>
  722. </xsl:when>
  723. </xsl:choose>
  724. </xsl:for-each>
  725. </tbody>
  726. </table>
  727. </xsl:if>
  728. </xsl:template>
  729. <!-- informantionRecipient -->
  730. <xsl:template name="informationRecipient">
  731. <xsl:if test="n1:informationRecipient">
  732. <table class="header_table">
  733. <tbody>
  734. <xsl:for-each select="n1:informationRecipient">
  735. <tr>
  736. <td class="td_header_role_name">
  737. <span class="td_label">
  738. <xsl:text>Information recipient:</xsl:text>
  739. </span>
  740. </td>
  741. <td class="td_header_role_value">
  742. <xsl:choose>
  743. <xsl:when test="n1:intendedRecipient/n1:informationRecipient/n1:name">
  744. <xsl:for-each select="n1:intendedRecipient/n1:informationRecipient">
  745. <xsl:call-template name="show-name">
  746. <xsl:with-param name="name" select="n1:name"/>
  747. </xsl:call-template>
  748. <xsl:if test="position() != last()">
  749. <br/>
  750. </xsl:if>
  751. </xsl:for-each>
  752. </xsl:when>
  753. <xsl:otherwise>
  754. <xsl:for-each select="n1:intendedRecipient">
  755. <xsl:for-each select="n1:id">
  756. <xsl:call-template name="show-id"/>
  757. </xsl:for-each>
  758. <xsl:if test="position() != last()">
  759. <br/>
  760. </xsl:if>
  761. <br/>
  762. </xsl:for-each>
  763. </xsl:otherwise>
  764. </xsl:choose>
  765. </td>
  766. </tr>
  767. <xsl:if test="n1:intendedRecipient/n1:addr | n1:intendedRecipient/n1:telecom">
  768. <tr>
  769. <td class="td_header_role_name">
  770. <span class="td_label">Contact info</span>
  771. </td>
  772. <td class="td_header_role_value">
  773. <xsl:call-template name="show-contactInfo">
  774. <xsl:with-param name="contact" select="n1:intendedRecipient"/>
  775. </xsl:call-template>
  776. </td>
  777. </tr>
  778. </xsl:if>
  779. </xsl:for-each>
  780. </tbody>
  781. </table>
  782. </xsl:if>
  783. </xsl:template>
  784. <!-- participant -->
  785. <xsl:template name="participant">
  786. <xsl:if test="n1:participant">
  787. <table class="header_table">
  788. <tbody>
  789. <xsl:for-each select="n1:participant">
  790. <tr>
  791. <td class="td_header_role_name">
  792. <xsl:variable name="participtRole">
  793. <xsl:call-template name="translateRoleAssoCode">
  794. <xsl:with-param name="classCode" select="n1:associatedEntity/@classCode"/>
  795. <xsl:with-param name="code" select="n1:associatedEntity/n1:code"/>
  796. </xsl:call-template>
  797. </xsl:variable>
  798. <xsl:choose>
  799. <xsl:when test="$participtRole">
  800. <span class="td_label">
  801. <xsl:call-template name="firstCharCaseUp">
  802. <xsl:with-param name="data" select="$participtRole"/>
  803. </xsl:call-template>
  804. </span>
  805. </xsl:when>
  806. <xsl:otherwise>
  807. <span class="td_label">
  808. <xsl:text>Participant</xsl:text>
  809. </span>
  810. </xsl:otherwise>
  811. </xsl:choose>
  812. </td>
  813. <td class="td_header_role_value">
  814. <xsl:if test="n1:functionCode">
  815. <xsl:call-template name="show-code">
  816. <xsl:with-param name="code" select="n1:functionCode"/>
  817. </xsl:call-template>
  818. </xsl:if>
  819. <xsl:call-template name="show-associatedEntity">
  820. <xsl:with-param name="assoEntity" select="n1:associatedEntity"/>
  821. </xsl:call-template>
  822. <xsl:if test="n1:time">
  823. <xsl:if test="n1:time/n1:low">
  824. <xsl:text> from </xsl:text>
  825. <xsl:call-template name="show-time">
  826. <xsl:with-param name="datetime" select="n1:time/n1:low"/>
  827. </xsl:call-template>
  828. </xsl:if>
  829. <xsl:if test="n1:time/n1:high">
  830. <xsl:text> to </xsl:text>
  831. <xsl:call-template name="show-time">
  832. <xsl:with-param name="datetime" select="n1:time/n1:high"/>
  833. </xsl:call-template>
  834. </xsl:if>
  835. </xsl:if>
  836. <xsl:if test="position() != last()">
  837. <br/>
  838. </xsl:if>
  839. </td>
  840. </tr>
  841. <xsl:if test="n1:associatedEntity/n1:addr | n1:associatedEntity/n1:telecom">
  842. <tr>
  843. <td class="td_header_role_name">
  844. <span class="td_label">
  845. <xsl:text>Contact info</xsl:text>
  846. </span>
  847. </td>
  848. <td class="td_header_role_value">
  849. <xsl:call-template name="show-contactInfo">
  850. <xsl:with-param name="contact" select="n1:associatedEntity"/>
  851. </xsl:call-template>
  852. </td>
  853. </tr>
  854. </xsl:if>
  855. </xsl:for-each>
  856. </tbody>
  857. </table>
  858. </xsl:if>
  859. </xsl:template>
  860. <!-- recordTarget -->
  861. <xsl:template name="recordTarget">
  862. <table class="header_table">
  863. <xsl:for-each select="/n1:ClinicalDocument/n1:recordTarget/n1:patientRole">
  864. <xsl:if test="not(n1:id/@nullFlavor)">
  865. <tr>
  866. <td class="td_header_role_name">
  867. <span class="td_label">
  868. <xsl:text>Patient</xsl:text>
  869. </span>
  870. </td>

Large files files are truncated, but you can click here to view the full file