Documentation cleanups, minor optimization of setting $allow, and disable debugging...
[openemr.git] / ccr / ccd / templates / datetime.xsl
blob48593ae81feb66f139e16d64d06291dc98d6839e
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!--
3 Conversion of CCR to Level 3 CCD
5 Orginal Author: Ken Miller
6 Solventus LLC
7 ken.miller@solventus.coms
9 Contributors:
10 Richard Braman, EHR Doctors, Inc rbraman@ehrdoctors.com
11 George Lilly (WorldVistA glilly@glilly.net)
12 xxxx - Oroville Hospital
14 Date: 2010-05-5
15 Version: 0.1
17 License :
19 This program is free software: you can redistribute it and/or modify
20 it under the terms of the GNU General Public License as published by
21 the Free Software Foundation, either version 3 of the License, or
22 (at your option) any later version.
24 This program is distributed in the hope that it will be useful,
25 but WITHOUT ANY WARRANTY; without even the implied warranty of
26 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27 GNU General Public License for more details.
29 You should have received a copy of the GNU General Public License
30 along with this program. If not, see http://www.gnu.org/licenses.
32 -->
33 <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:a="urn:astm-org:CCR" xmlns:date="http://exslt.org/dates-and-times" exclude-result-prefixes="a date">
34 <!-- Displays the DateTime. If ExactDateTime is present, it will format according
35 to the 'fmt' variable. The default format is: Oct 31, 2005 -->
36 <xsl:import href="../lib/date.format-date.template.xsl"/>
37 <xsl:template name="dateTime" match="a:DateTime">
38 <xsl:param name="dt" select="."/>
39 <xsl:param name="fmt">MMM dd, yyyy</xsl:param>
40 <xsl:for-each select="$dt">
41 <tr>
42 <xsl:if test="$dt/a:Type/a:Text">
43 <td>
44 <xsl:value-of select="a:Type/a:Text"/>:
45 </td>
46 </xsl:if>
47 <xsl:choose>
48 <xsl:when test="a:ExactDateTime">
49 <td>
50 <xsl:call-template name="date:format-date">
51 <xsl:with-param name="date-time">
52 <xsl:value-of select="a:ExactDateTime"/>
53 </xsl:with-param>
54 <xsl:with-param name="pattern" select="$fmt"/>
55 </xsl:call-template>
56 </td>
57 </xsl:when>
58 <xsl:when test="$dt/a:Age">
59 <td>
60 <xsl:value-of select="$dt/a:Age/a:Value"/>
61 <xsl:text xml:space="preserve"> </xsl:text>
62 <xsl:value-of select="$dt/a:Age/a:Units/a:Unit"/>
63 </td>
64 </xsl:when>
65 <xsl:when test="$dt/a:ApproximateDateTime">
66 <td>
67 <xsl:value-of select="$dt/a:ApproximateDateTime/a:Text"/>
68 </td>
69 </xsl:when>
70 <xsl:when test="$dt/a:DateTimeRange">
71 <td>
72 <xsl:for-each select="$dt/a:DateTimeRange/a:BeginRange">
73 <xsl:choose>
74 <xsl:when test="$dt/a:ExactDateTime">
75 <xsl:call-template name="date:format-date">
76 <xsl:with-param name="date-time">
77 <xsl:value-of select="$dt/a:ExactDateTime"/>
78 </xsl:with-param>
79 <xsl:with-param name="pattern" select="$fmt"/>
80 </xsl:call-template>
81 </xsl:when>
82 <xsl:when test="$dt/a:Age">
83 <xsl:value-of select="$dt/a:Age/a:Value"/>
84 <xsl:text xml:space="preserve"> </xsl:text>
85 <xsl:value-of select="$dt/a:Age/a:Units/a:Unit"/>
86 </xsl:when>
87 <xsl:when test="$dt/a:ApproximateDateTime">
88 <xsl:value-of select="$dt/a:ApproximateDateTime/a:Text"/>
89 </xsl:when>
90 <xsl:otherwise/>
91 </xsl:choose>
92 </xsl:for-each><xsl:text xml:space="preserve"> </xsl:text>
93 -<xsl:text xml:space="preserve"> </xsl:text>
94 <xsl:for-each select="$dt/a:DateTimeRange/a:EndRange">
95 <xsl:choose>
96 <xsl:when test="$dt/a:ExactDateTime">
97 <xsl:call-template name="date:format-date">
98 <xsl:with-param name="date-time">
99 <xsl:value-of select="$dt/a:ExactDateTime"/>
100 </xsl:with-param>
101 <xsl:with-param name="pattern" select="$fmt"/>
102 </xsl:call-template>
103 </xsl:when>
104 <xsl:when test="$dt/a:Age">
105 <xsl:value-of select="$dt/a:Age/a:Value"/>
106 <xsl:text xml:space="preserve"> </xsl:text>
107 <xsl:value-of select="$dt/a:Age/a:Units/a:Unit"/>
108 </xsl:when>
109 <xsl:when test="$dt/a:ApproximateDateTime">
110 <xsl:value-of select="$dt/a:ApproximateDateTime/a:Text"/>
111 </xsl:when>
112 <xsl:otherwise/>
113 </xsl:choose>
114 </xsl:for-each>
115 </td>
116 </xsl:when>
117 <xsl:otherwise/>
118 </xsl:choose>
119 </tr>
120 </xsl:for-each>
121 </xsl:template>
122 </xsl:stylesheet>