test-patient-generator 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,255 @@
1
+ require 'set'
2
+
3
+ module HQMF
4
+ # Contains functions that can be used to randomly generate fields for patients.
5
+ # Also includes utility functions for randomly generating numbers and dates or choosing options within a range.
6
+ class Randomizer
7
+ UNIQUE_PATIENT_IDS = Set.new # Used to make sure we don't duplicate randomly generated patient IDs
8
+
9
+ # Add trivial demographics info to a Record. Trivial fields are ones that identify a patient as unique to a human eye
10
+ # but have no impact on CQM, e.g. address. This is essentially an upsert, so any preexisting info will be wiped.
11
+ #
12
+ # @param [Record] The Record to which we will be adding random demographics
13
+ # @return The Record that was given to us with the following fields randomly generated:
14
+ # race/ethnicity, language, last name
15
+ def self.randomize_demographics(patient)
16
+ race_and_ethnicity = randomize_race_and_ethnicity
17
+ patient.race = {"code" => race_and_ethnicity[:race], "code_set" => "CDC-RE"}
18
+ patient.ethnicity = {"code" => race_and_ethnicity[:ethnicity], "code_set" => "CDC-RE"}
19
+
20
+ patient.languages = []
21
+ patient.languages << randomize_language
22
+ patient.first = randomize_first_name(patient.gender) if patient.gender
23
+ patient.last = randomize_last_name
24
+ patient.medical_record_number = randomize_patient_id
25
+
26
+ patient
27
+ end
28
+
29
+ # Picks a race based on 2010 census estimates
30
+ #
31
+ # Pacific Islander 0.2%
32
+ # American Indian 0.9%
33
+ # Asian 4.8%
34
+ # Black persons 12.6%
35
+ # Hispanic 16.3%
36
+ # White 63.7%
37
+ def self.randomize_race_and_ethnicity
38
+ race_percent = rand(999)
39
+
40
+ case race_percent
41
+ when 0..1
42
+ {race: '2076-8', ethnicity: '2186-5'} # pacific islander
43
+ when 2..10
44
+ {race: '1002-5', ethnicity: '2186-5'} # american indian
45
+ when 11..58
46
+ {race: '2028-9', ethnicity: '2186-5'} # asian
47
+ when 59..184
48
+ {race: '2054-5', ethnicity: '2186-5'} # black
49
+ when 185..347
50
+ {race: '2106-3', ethnicity: '2135-2'} # hispanic
51
+ when 348..984
52
+ {race: '2106-3', ethnicity: '2186-5'} # white (not hispanic)
53
+ when 985..999
54
+ {race: '2131-1', ethnicity: '2186-5'} # other
55
+ end
56
+ end
57
+
58
+ # Picks spoken language based on 2010 census estamates
59
+ #
60
+ # 80.3% english
61
+ # 12.3% spanish
62
+ # 00.9% chinese
63
+ # 00.7% french
64
+ # 00.4% german
65
+ # 00.4% korean
66
+ # 00.4% vietnamese
67
+ # 00.3% italian
68
+ # 00.3% portuguese
69
+ # 00.3% russian
70
+ # 00.2% japanese
71
+ # 00.2% polish
72
+ # 00.1% greek
73
+ # 00.1% persian
74
+ # 00.1% us sign
75
+ # 03.0% other
76
+ def self.randomize_language
77
+ language_percent = rand(999)
78
+
79
+ case language_percent
80
+ when 0..802
81
+ 'en-US' # english
82
+ when 802..925
83
+ 'es-US' # spanish
84
+ when 926..932
85
+ 'fr-US' # french
86
+ when 933..935
87
+ 'it-US' # italian
88
+ when 936..938
89
+ 'pt-US' # portuguese
90
+ when 939..942
91
+ 'de-US' # german
92
+ when 943..943
93
+ 'el-US' # greek
94
+ when 944..946
95
+ 'ru-US' # russian
96
+ when 947..948
97
+ 'pl-US' # polish
98
+ when 949..949
99
+ 'fa-US' # persian
100
+ when 950..958
101
+ 'zh-US' # chinese
102
+ when 959..960
103
+ 'ja-US' # japanese
104
+ when 961..964
105
+ 'ko-US' # korean
106
+ when 965..968
107
+ 'vi-US' # vietnamese
108
+ when 969..969
109
+ 'sgn-US' # us sign language
110
+ when 970..999
111
+ other = ["aa","ab","ae","af","ak","am","an","ar","as","av","ay","az","ba","be","bg","bh","bi","bm","bn","bo","br","bs","ca","ce","ch","co","cr","cs","cu","cv","cy","da",
112
+ "dv","dz","ee","eo","et","eu","ff","fi","fj","fo","fy","ga","gd","gl","gn","gu","gv","ha","he","hi","ho","hr","ht","hu","hy","hz","ia","id","ie","ig","ii","ik",
113
+ "io","is","iu","jv","ka","kg","ki","kj","kk","kl","km","kn","kr","ks","ku","kv","kw","ky","la","lb","lg","li","ln","lo","lt","lu","lv","mg","mh","mi","mk","ml",
114
+ "mn","mr","ms","mt","my","na","nb","nd","ne","ng","nl","nn","no","nr","nv","ny","oc","oj","om","or","os","pa","pi","ps","qu","rm","rn","ro","rw","sa","sc","sd",
115
+ "se","sg","si","sk","sl","sm","sn","so","sq","sr","ss","st","su","sv","sw","ta","te","tg","th","ti","tk","tl","tn","to","tr","ts","tt","tw","ty","ug","uk","ur",
116
+ "uz","ve","vo","wa","wo","xh","yi","yo","za","zu"].sample
117
+ "#{other}-US" # other
118
+ end
119
+ end
120
+
121
+ # Pick a forename at random appropriate for the supplied gender.
122
+ #
123
+ # @param [String] gender The gender of the patient for whom we're generating a name. Expected to be either 'M' or 'F'.
124
+ # @return A suitable forename.
125
+ def self.randomize_first_name(gender)
126
+ # 300 most popular forenames according to US census 1990
127
+ forenames = {
128
+ 'M' => %w{James John Robert Michael William David Richard Charles Joseph Thomas Christopher Daniel Paul Mark Donald George Kenneth Steven Edward Brian Ronald Anthony Kevin Jason Matthew Gary Timothy Jose Larry Jeffrey Frank Scott Eric Stephen Andrew Raymond Gregory Joshua Jerry Dennis Walter Patrick Peter Harold Douglas Henry Carl Arthur Ryan Roger Joe Juan Jack Albert Jonathan Justin Terry Gerald Keith Samuel Willie Ralph Lawrence Nicholas Roy Benjamin Bruce Brandon Adam Harry Fred Wayne Billy Steve Louis Jeremy Aaron Randy Howard Eugene Carlos Russell Bobby Victor Martin Ernest Phillip Todd Jesse Craig Alan Shawn Clarence Sean Philip Chris Johnny Earl Jimmy Antonio Danny Bryan Tony Luis Mike Stanley Leonard Nathan Dale Manuel Rodney Curtis Norman Allen Marvin Vincent Glenn Jeffery Travis Jeff Chad Jacob Lee Melvin Alfred Kyle Francis Bradley Jesus Herbert Frederick Ray Joel Edwin Don Eddie Ricky Troy Randall Barry Alexander Bernard Mario Leroy Francisco Marcus Micheal Theodore Clifford Miguel Oscar Jay Jim Tom Calvin Alex Jon Ronnie Bill Lloyd Tommy Leon Derek Warren Darrell Jerome Floyd Leo Alvin Tim Wesley Gordon Dean Greg Jorge Dustin Pedro Derrick Dan Lewis Zachary Corey Herman Maurice Vernon Roberto Clyde Glen Hector Shane Ricardo Sam Rick Lester Brent Ramon Charlie Tyler Gilbert Gene Marc Reginald Ruben Brett Angel Nathaniel Rafael Leslie Edgar Milton Raul Ben Chester Cecil Duane Franklin Andre Elmer Brad Gabriel Ron Mitchell Roland Arnold Harvey Jared Adrian Karl Cory Claude Erik Darryl Jamie Neil Jessie Christian Javier Fernando Clinton Ted Mathew Tyrone Darren Lonnie Lance Cody Julio Kelly Kurt Allan Nelson Guy Clayton Hugh Max Dwayne Dwight Armando Felix Jimmie Everett Jordan Ian Wallace Ken Bob Jaime Casey Alfredo Alberto Dave Ivan Johnnie Sidney Byron Julian Isaac Morris Clifton Willard Daryl Ross Virgil Andy Marshall Salvador Perry Kirk Sergio Marion Tracy Seth Kent Terrance Rene Eduardo Terrence Enrique Freddie Wade},
129
+ 'F' => %w{Mary Patricia Linda Barbara Elizabeth Jennifer Maria Susan Margaret Dorothy Lisa Nancy Karen Betty Helen Sandra Donna Carol Ruth Sharon Michelle Laura Sarah Kimberly Deborah Jessica Shirley Cynthia Angela Melissa Brenda Amy Anna Rebecca Virginia Kathleen Pamela Martha Debra Amanda Stephanie Carolyn Christine Marie Janet Catherine Frances Ann Joyce Diane Alice Julie Heather Teresa Doris Gloria Evelyn Jean Cheryl Mildred Katherine Joan Ashley Judith Rose Janice Kelly Nicole Judy Christina Kathy Theresa Beverly Denise Tammy Irene Jane Lori Rachel Marilyn Andrea Kathryn Louise Sara Anne Jacqueline Wanda Bonnie Julia Ruby Lois Tina Phyllis Norma Paula Diana Annie Lillian Emily Robin Peggy Crystal Gladys Rita Dawn Connie Florence Tracy Edna Tiffany Carmen Rosa Cindy Grace Wendy Victoria Edith Kim Sherry Sylvia Josephine Thelma Shannon Sheila Ethel Ellen Elaine Marjorie Carrie Charlotte Monica Esther Pauline Emma Juanita Anita Rhonda Hazel Amber Eva Debbie April Leslie Clara Lucille Jamie Joanne Eleanor Valerie Danielle Megan Alicia Suzanne Michele Gail Bertha Darlene Veronica Jill Erin Geraldine Lauren Cathy Joann Lorraine Lynn Sally Regina Erica Beatrice Dolores Bernice Audrey Yvonne Annette June Samantha Marion Dana Stacy Ana Renee Ida Vivian Roberta Holly Brittany Melanie Loretta Yolanda Jeanette Laurie Katie Kristen Vanessa Alma Sue Elsie Beth Jeanne Vicki Carla Tara Rosemary Eileen Terri Gertrude Lucy Tonya Ella Stacey Wilma Gina Kristin Jessie Natalie Agnes Vera Willie Charlene Bessie Delores Melinda Pearl Arlene Maureen Colleen Allison Tamara Joy Georgia Constance Lillie Claudia Jackie Marcia Tanya Nellie Minnie Marlene Heidi Glenda Lydia Viola Courtney Marian Stella Caroline Dora Jo Vickie Mattie Terry Maxine Irma Mabel Marsha Myrtle Lena Christy Deanna Patsy Hilda Gwendolyn Jennie Nora Margie Nina Cassandra Leah Penny Kay Priscilla Naomi Carole Brandy Olga Billie Dianne Tracey Leona Jenny Felicia Sonia Miriam Velma Becky Bobbie Violet Kristina Toni Misty Mae Shelly Daisy Ramona Sherri Erika Katrina Claire}
130
+ }
131
+
132
+ forenames[gender][rand(forenames[gender].length)]
133
+ end
134
+
135
+ # Pick a surname at random.
136
+ #
137
+ # @return A surname.
138
+ def self.randomize_last_name
139
+ # 500 most popular surnames according to US census 1990
140
+ surnames = %w{Smith Johnson Williams Jones Brown Davis Miller Wilson Moore Taylor Anderson Thomas Jackson White Harris Martin Thompson Garcia Martinez Robinson Clark Rodriguez Lewis Lee Walker Hall Allen Young Hernandez King Wright Lopez Hill Scott Green Adams Baker Gonzalez Nelson Carter Mitchell Perez Roberts Turner Phillips Campbell Parker Evans Edwards Collins Stewart Sanchez Morris Rogers Reed Cook Morgan Bell Murphy Bailey Rivera Cooper Richardson Cox Howard Ward Torres Peterson Gray Ramirez James Watson Brooks Kelly Sanders Price Bennett Wood Barnes Ross Henderson Coleman Jenkins Perry Powell Long Patterson Hughes Flores Washington Butler Simmons Foster Gonzales Bryant Alexander Russell Griffin Diaz Hayes Myers Ford Hamilton Graham Sullivan Wallace Woods Cole West Jordan Owens Reynolds Fisher Ellis Harrison Gibson Mcdonald Cruz Marshall Ortiz Gomez Murray Freeman Wells Webb Simpson Stevens Tucker Porter Hunter Hicks Crawford Henry Boyd Mason Morales Kennedy Warren Dixon Ramos Reyes Burns Gordon Shaw Holmes Rice Robertson Hunt Black Daniels Palmer Mills Nichols Grant Knight Ferguson Rose Stone Hawkins Dunn Perkins Hudson Spencer Gardner Stephens Payne Pierce Berry Matthews Arnold Wagner Willis Ray Watkins Olson Carroll Duncan Snyder Hart Cunningham Bradley Lane Andrews Ruiz Harper Fox Riley Armstrong Carpenter Weaver Greene Lawrence Elliott Chavez Sims Austin Peters Kelley Franklin Lawson Fields Gutierrez Ryan Schmidt Carr Vasquez Castillo Wheeler Chapman Oliver Montgomery Richards Williamson Johnston Banks Meyer Bishop Mccoy Howell Alvarez Morrison Hansen Fernandez Garza Harvey Little Burton Stanley Nguyen George Jacobs Reid Kim Fuller Lynch Dean Gilbert Garrett Romero Welch Larson Frazier Burke Hanson Day Mendoza Moreno Bowman Medina Fowler Brewer Hoffman Carlson Silva Pearson Holland Douglas Fleming Jensen Vargas Byrd Davidson Hopkins May Terry Herrera Wade Soto Walters Curtis Neal Caldwell Lowe Jennings Barnett Graves Jimenez Horton Shelton Barrett Obrien Castro Sutton Gregory Mckinney Lucas Miles Craig Rodriquez Chambers Holt Lambert Fletcher Watts Bates Hale Rhodes Pena Beck Newman Haynes Mcdaniel Mendez Bush Vaughn Parks Dawson Santiago Norris Hardy Love Steele Curry Powers Schultz Barker Guzman Page Munoz Ball Keller Chandler Weber Leonard Walsh Lyons Ramsey Wolfe Schneider Mullins Benson Sharp Bowen Daniel Barber Cummings Hines Baldwin Griffith Valdez Hubbard Salazar Reeves Warner Stevenson Burgess Santos Tate Cross Garner Mann Mack Moss Thornton Dennis Mcgee Farmer Delgado Aguilar Vega Glover Manning Cohen Harmon Rodgers Robbins Newton Todd Blair Higgins Ingram Reese Cannon Strickland Townsend Potter Goodwin Walton Rowe Hampton Ortega Patton Swanson Joseph Francis Goodman Maldonado Yates Becker Erickson Hodges Rios Conner Adkins Webster Norman Malone Hammond Flowers Cobb Moody Quinn Blake Maxwell Pope Floyd Osborne Paul Mccarthy Guerrero Lindsey Estrada Sandoval Gibbs Tyler Gross Fitzgerald Stokes Doyle Sherman Saunders Wise Colon Gill Alvarado Greer Padilla Simon Waters Nunez Ballard Schwartz Mcbride Houston Christensen Klein Pratt Briggs Parsons Mclaughlin Zimmerman French Buchanan Moran Copeland Roy Pittman Brady Mccormick Holloway Brock Poole Frank Logan Owen Bass Marsh Drake Wong Jefferson Park Morton Abbott Sparks Patrick Norton Huff Clayton Massey Lloyd Figueroa Carson Bowers Roberson Barton Tran Lamb Harrington Casey Boone Cortez Clarke Mathis Singleton Wilkins Cain Bryan Underwood Hogan Mckenzie Collier Luna Phelps Mcguire Allison Bridges Wilkerson Nash Summers Atkins}
141
+
142
+ surnames[rand(surnames.length)]
143
+ end
144
+
145
+ # Create an address at random
146
+ #
147
+ # @return An address hash
148
+ def self.randomize_address
149
+ streetnames = %w{Park Main Oak Pine Maple Cedar Elm Lake Hill Second Washington}
150
+ zipcodes = {
151
+ '01000' => {'city' => 'Springfield', 'state'=> 'MA'},
152
+ '01200' => {'city' => 'Springfield', 'state'=> 'MA'},
153
+ '01400' => {'city' => 'Worcester', 'state'=> 'MA'},
154
+ '02000' => {'city' => 'Brockton', 'state'=> 'MA'},
155
+ '02100' => {'city' => 'Boston', 'state'=> 'MA'},
156
+ '02500' => {'city' => 'Cape Cod', 'state'=> 'MA'},
157
+ '03000' => {'city' => 'Manchester', 'state'=> 'NH'},
158
+ '03300' => {'city' => 'Concord', 'state'=> 'NH'},
159
+ '03500' => {'city' => 'White River Junction', 'state'=> 'VT'},
160
+ '03800' => {'city' => 'Portsmouth', 'state'=> 'NH'},
161
+ '04000' => {'city' => 'Portland', 'state'=> 'ME'},
162
+ '04400' => {'city' => 'Bangor', 'state'=> 'ME'},
163
+ '05400' => {'city' => 'Burlington', 'state'=> 'VT'},
164
+ '06000' => {'city' => 'Hartford', 'state'=> 'CT'},
165
+ '06500' => {'city' => 'New Haven', 'state'=> 'CT'}
166
+ }
167
+
168
+ zip = zipcodes.keys[rand(zipcodes.length)]
169
+ street = "#{rand(100)} #{streetnames[rand(streetnames.length)]} Street"
170
+
171
+ {
172
+ 'street' => street,
173
+ 'city' => zipcodes[zip]['city'],
174
+ 'state' => zipcodes[zip]['state'],
175
+ 'postalCode' => zip
176
+ }.to_json
177
+ end
178
+
179
+ # Randomize patient IDs for a given patients. We ensure that this ID is unique.
180
+ #
181
+ # @return The same patient with a random, non-duplicate ID assigned.
182
+ def self.randomize_patient_id
183
+ # Keep trying to add a new ID to the set. Return the ID when we find one that's unique.
184
+ loop do
185
+ id = (0...10).map{ ('0'..'9').to_a[rand(10)] }.join.to_s
186
+ break id if UNIQUE_PATIENT_IDS.size < UNIQUE_PATIENT_IDS.add(id).size
187
+ end
188
+ end
189
+
190
+ # More accurately, randomize a believable birthdate. Given a patient, find all coded entries that
191
+ # have age-related implications and make sure the patient is at least that old. Since that is complicated,
192
+ # for now let's just make them 45
193
+ #
194
+ # @param A patient with coded entries that dictate potential birthdates
195
+ # @return A realistic birthdate for the given patient
196
+ def self.randomize_birthdate(patient)
197
+ Time.now
198
+ end
199
+
200
+ # Randomly generate a Range object that is within a lower and upper bounds. It is guaranteed that the high of the
201
+ # returned range will be no earlier than the low time.
202
+ #
203
+ # @param [Time] earliest_time The lowest possible value for the low in this Range. nil implies unbounded.
204
+ # @param [Time] latest_time The highest possible value for the high in this Range. nil implies unbounded.
205
+ # @return A Range that represents a start time and end time within the acceptable bounds supplied.
206
+ def self.randomize_range(earliest_time, latest_time)
207
+ earliest_time ||= Time.now.advance(years: -18)
208
+ latest_time ||= Time.now.to_i
209
+
210
+ low = Time.at(Randomizer.between(earliest_time.to_i, latest_time.to_i))
211
+ high = Time.at(Randomizer.between(low, latest_time.to_i))
212
+
213
+ low = Value.new("TS", nil, Value.time_to_ts(low), true, false, false)
214
+ high = Value.new("TS", nil, Value.time_to_ts(high), true, false, false)
215
+
216
+ time = Range.new("IVL_TS", low, high, 1)
217
+ end
218
+
219
+ # Return a set of randomly selected numbers between two bounds
220
+ #
221
+ # @param [int] min The lower inclusive bound
222
+ # @param [int] max The upper inclusive bound
223
+ # @param [int] least The minimum count to return
224
+ # @param [int] most The maximum count to return
225
+ # @return [String] A JSON format array of numbers
226
+ def self.n_between(min, max, least=1, most=1)
227
+ count = least + rand(1 + most - least).to_i
228
+ result = []
229
+
230
+ count.times do
231
+ result << between(min, max)
232
+ end
233
+
234
+ result.to_json
235
+ end
236
+
237
+ # Return a randomly selected number between two bounds
238
+ #
239
+ # @param [int] min The lower inclusive bound
240
+ # @param [int] max The upper inclusive bound
241
+ # @return [int] A random number between the min and max bounds
242
+ def self.between(min, max)
243
+ span = max.to_i - min.to_i + 1
244
+ min.to_i + rand(span)
245
+ end
246
+
247
+ # Pick true or false according to the supplied probability
248
+ #
249
+ # @param [int] probability the probability of getting true as a percentage
250
+ # @return [boolean] true or false
251
+ def self.percent(probability)
252
+ return rand(100) < probability
253
+ end
254
+ end
255
+ end
data/public/cda.xsl ADDED
@@ -0,0 +1 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
  Title: CDA XSL StyleSheet
1
3
  Original Filename: cda.xsl
2
4
  Version: 3.0
3
5
  Revision History: 08/12/08 Jingdong Li updated
4
6
  Revision History: 12/11/09 KH updated
5
7
  Revision History: 03/30/10 Jingdong Li updated.
6
8
  Revision History: 08/25/10 Jingdong Li updated
7
9
  Revision History: 09/17/10 Jingdong Li updated
8
10
  Revision History: 01/05/11 Jingdong Li updated
9
11
  Specification: ANSI/HL7 CDAR2
10
12
  The current version and documentation are available at http://www.lantanagroup.com/resources/tools/.
11
13
  We welcome feedback and contributions to tools@lantanagroup.com
12
14
  The stylesheet is the cumulative work of several developers; the most significant prior milestones were the foundation work from HL7
13
15
  Germany and Finland (Tyylitiedosto) and HL7 US (Calvin Beebe), and the presentation approach from Tony Schaller, medshare GmbH provided at IHIC 2009.
14
- ->
15
16
  Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
16
17
  You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
17
- ->
18
18
  <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"/>
19
19
  <!-- global variable title -->
20
20
  <xsl:variable name="title">
21
21
  <xsl:choose>
22
22
  <xsl:when test="string-length(/n1:ClinicalDocument/n1:title) &gt;= 1">
23
23
  <xsl:value-of select="/n1:ClinicalDocument/n1:title"/>
24
24
  </xsl:when>
25
25
  <xsl:when test="/n1:ClinicalDocument/n1:code/@displayName">
26
26
  <xsl:value-of select="/n1:ClinicalDocument/n1:code/@displayName"/>
27
27
  </xsl:when>
28
28
  <xsl:otherwise>
29
29
  <xsl:text>Clinical Document</xsl:text>
30
30
  </xsl:otherwise>
31
31
  </xsl:choose>
32
32
  </xsl:variable>
33
33
  <!-- Main -->
34
34
  <xsl:template match="/">
35
35
  <xsl:apply-templates select="n1:ClinicalDocument"/>
36
36
  </xsl:template>
37
37
  <!-- produce browser rendered, human readable clinical document -->
38
38
  <xsl:template match="n1:ClinicalDocument">
39
39
  <html>
40
40
  <head>
41
41
  <xsl:comment> Do NOT edit this HTML directly: it was generated via an XSLT transformation from a CDA Release 2 XML document. </xsl:comment>
42
42
  <title>
43
43
  <xsl:value-of select="$title"/>
44
44
  </title>
45
45
  <xsl:call-template name="addCSS"/>
46
46
  </head>
47
47
  <body>
48
48
  <h1 class="h1center">
49
49
  <xsl:value-of select="$title"/>
50
50
  </h1>
51
51
  <!-- START display top portion of clinical document -->
52
52
  <xsl:call-template name="recordTarget"/>
53
53
  <xsl:call-template name="documentGeneral"/>
54
54
  <xsl:call-template name="documentationOf"/>
55
55
  <xsl:call-template name="author"/>
56
56
  <xsl:call-template name="componentof"/>
57
57
  <xsl:call-template name="participant"/>
58
58
  <xsl:call-template name="dataEnterer"/>
59
59
  <xsl:call-template name="authenticator"/>
60
60
  <xsl:call-template name="informant"/>
61
61
  <xsl:call-template name="informationRecipient"/>
62
62
  <xsl:call-template name="legalAuthenticator"/>
63
63
  <xsl:call-template name="custodian"/>
64
64
  <!-- END display top portion of clinical document -->
65
65
  <!-- produce table of contents -->
66
66
  <xsl:if test="not(//n1:nonXMLBody)">
67
67
  <xsl:if test="count(/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component[n1:section]) &gt; 1">
68
68
  <xsl:call-template name="make-tableofcontents"/>
69
69
  </xsl:if>
70
70
  </xsl:if>
71
71
  <hr align="left" color="teal" size="2" width="80%"/>
72
72
  <div id="patient_information_by_section" style="display:block">
73
73
  <!-- produce human readable document content -->
74
74
  <xsl:apply-templates select="n1:component/n1:structuredBody|n1:component/n1:nonXMLBody"/>
75
75
  </div>
76
76
  <br/>
77
77
  <br/>
78
78
  </body>
79
79
  </html>
80
80
  </xsl:template>
81
81
  <!-- generate table of contents -->
82
82
  <xsl:template name="make-tableofcontents">
83
83
  <h2>
84
84
  <a name="toc">Table of Contents</a>
85
85
  </h2>
86
86
  <ul>
87
87
  <xsl:for-each select="n1:component/n1:structuredBody/n1:component/n1:section/n1:title">
88
88
  <li>
89
89
  <a href="#{generate-id(.)}">
90
90
  <xsl:value-of select="."/>
91
91
  </a>
92
92
  </li>
93
93
  </xsl:for-each>
94
94
  </ul>
95
95
  </xsl:template>
96
96
  <!-- header elements -->
97
97
  <xsl:template name="documentGeneral">
98
98
  <table class="header_table">
99
99
  <tbody>
100
100
  <tr>
101
101
  <td width="20%" bgcolor="#3399ff">
102
102
  <span class="td_label">
103
103
  <xsl:text>Document Id</xsl:text>
104
104
  </span>
105
105
  </td>
106
106
  <td width="80%">
107
107
  <xsl:call-template name="show-id">
108
108
  <xsl:with-param name="id" select="n1:id"/>
109
109
  </xsl:call-template>
110
110
  </td>
111
111
  </tr>
112
112
  <tr>
113
113
  <td width="20%" bgcolor="#3399ff">
114
114
  <span class="td_label">
115
115
  <xsl:text>Document Created:</xsl:text>
116
116
  </span>
117
117
  </td>
118
118
  <td width="80%">
119
119
  <xsl:call-template name="show-time">
120
120
  <xsl:with-param name="datetime" select="n1:effectiveTime"/>
121
121
  </xsl:call-template>
122
122
  </td>
123
123
  </tr>
124
124
  </tbody>
125
125
  </table>
126
126
  </xsl:template>
127
127
  <!-- confidentiality -->
128
128
  <xsl:template name="confidentiality">
129
129
  <table class="header_table">
130
130
  <tbody>
131
131
  <td width="20%" bgcolor="#3399ff">
132
132
  <xsl:text>Confidentiality</xsl:text>
133
133
  </td>
134
134
  <td width="80%">
135
135
  <xsl:choose>
136
136
  <xsl:when test="n1:confidentialityCode/@code = &apos;N&apos;">
137
137
  <xsl:text>Normal</xsl:text>
138
138
  </xsl:when>
139
139
  <xsl:when test="n1:confidentialityCode/@code = &apos;R&apos;">
140
140
  <xsl:text>Restricted</xsl:text>
141
141
  </xsl:when>
142
142
  <xsl:when test="n1:confidentialityCode/@code = &apos;V&apos;">
143
143
  <xsl:text>Very restricted</xsl:text>
144
144
  </xsl:when>
145
145
  </xsl:choose>
146
146
  <xsl:if test="n1:confidentialityCode/n1:originalText">
147
147
  <xsl:text> </xsl:text>
148
148
  <xsl:value-of select="n1:confidentialityCode/n1:originalText"/>
149
149
  </xsl:if>
150
150
  </td>
151
151
  </tbody>
152
152
  </table>
153
153
  </xsl:template>
154
154
  <!-- author -->
155
155
  <xsl:template name="author">
156
156
  <xsl:if test="n1:author">
157
157
  <table class="header_table">
158
158
  <tbody>
159
159
  <xsl:for-each select="n1:author/n1:assignedAuthor">
160
160
  <tr>
161
161
  <td width="20%" bgcolor="#3399ff">
162
162
  <span class="td_label">
163
163
  <xsl:text>Author</xsl:text>
164
164
  </span>
165
165
  </td>
166
166
  <td width="80%">
167
167
  <xsl:choose>
168
168
  <xsl:when test="n1:assignedPerson/n1:name">
169
169
  <xsl:call-template name="show-name">
170
170
  <xsl:with-param name="name" select="n1:assignedPerson/n1:name"/>
171
171
  </xsl:call-template>
172
172
  <xsl:if test="n1:representedOrganization">
173
173
  <xsl:text>, </xsl:text>
174
174
  <xsl:call-template name="show-name">
175
175
  <xsl:with-param name="name" select="n1:representedOrganization/n1:name"/>
176
176
  </xsl:call-template>
177
177
  </xsl:if>
178
178
  </xsl:when>
179
179
  <xsl:when test="n1:assignedAuthoringDevice/n1:softwareName">
180
180
  <xsl:value-of select="n1:assignedAuthoringDevice/n1:softwareName"/>
181
181
  </xsl:when>
182
182
  <xsl:when test="n1:representedOrganization">
183
183
  <xsl:call-template name="show-name">
184
184
  <xsl:with-param name="name" select="n1:representedOrganization/n1:name"/>
185
185
  </xsl:call-template>
186
186
  </xsl:when>
187
187
  <xsl:otherwise>
188
188
  <xsl:for-each select="n1:id">
189
189
  <xsl:call-template name="show-id"/>
190
190
  <br/>
191
191
  </xsl:for-each>
192
192
  </xsl:otherwise>
193
193
  </xsl:choose>
194
194
  </td>
195
195
  </tr>
196
196
  <xsl:if test="n1:addr | n1:telecom">
197
197
  <tr>
198
198
  <td bgcolor="#3399ff">
199
199
  <span class="td_label">
200
200
  <xsl:text>Contact info</xsl:text>
201
201
  </span>
202
202
  </td>
203
203
  <td>
204
204
  <xsl:call-template name="show-contactInfo">
205
205
  <xsl:with-param name="contact" select="."/>
206
206
  </xsl:call-template>
207
207
  </td>
208
208
  </tr>
209
209
  </xsl:if>
210
210
  </xsl:for-each>
211
211
  </tbody>
212
212
  </table>
213
213
  </xsl:if>
214
214
  </xsl:template>
215
215
  <!-- authenticator -->
216
216
  <xsl:template name="authenticator">
217
217
  <xsl:if test="n1:authenticator">
218
218
  <table class="header_table">
219
219
  <tbody>
220
220
  <tr>
221
221
  <xsl:for-each select="n1:authenticator">
222
222
  <tr>
223
223
  <td width="20%" bgcolor="#3399ff">
224
224
  <span class="td_label">
225
225
  <xsl:text>Signed </xsl:text>
226
226
  </span>
227
227
  </td>
228
228
  <td width="80%">
229
229
  <xsl:call-template name="show-name">
230
230
  <xsl:with-param name="name" select="n1:assignedEntity/n1:assignedPerson/n1:name"/>
231
231
  </xsl:call-template>
232
232
  <xsl:text> at </xsl:text>
233
233
  <xsl:call-template name="show-time">
234
234
  <xsl:with-param name="date" select="n1:time"/>
235
235
  </xsl:call-template>
236
236
  </td>
237
237
  </tr>
238
238
  <xsl:if test="n1:assignedEntity/n1:addr | n1:assignedEntity/n1:telecom">
239
239
  <tr>
240
240
  <td bgcolor="#3399ff">
241
241
  <span class="td_label">
242
242
  <xsl:text>Contact info</xsl:text>
243
243
  </span>
244
244
  </td>
245
245
  <td width="80%">
246
246
  <xsl:call-template name="show-contactInfo">
247
247
  <xsl:with-param name="contact" select="n1:assignedEntity"/>
248
248
  </xsl:call-template>
249
249
  </td>
250
250
  </tr>
251
251
  </xsl:if>
252
252
  </xsl:for-each>
253
253
  </tr>
254
254
  </tbody>
255
255
  </table>
256
256
  </xsl:if>
257
257
  </xsl:template>
258
258
  <!-- legalAuthenticator -->
259
259
  <xsl:template name="legalAuthenticator">
260
260
  <xsl:if test="n1:legalAuthenticator">
261
261
  <table class="header_table">
262
262
  <tbody>
263
263
  <tr>
264
264
  <td width="20%" bgcolor="#3399ff">
265
265
  <span class="td_label">
266
266
  <xsl:text>Legal authenticator</xsl:text>
267
267
  </span>
268
268
  </td>
269
269
  <td width="80%">
270
270
  <xsl:call-template name="show-assignedEntity">
271
271
  <xsl:with-param name="asgnEntity" select="n1:legalAuthenticator/n1:assignedEntity"/>
272
272
  </xsl:call-template>
273
273
  <xsl:text> </xsl:text>
274
274
  <xsl:call-template name="show-sig">
275
275
  <xsl:with-param name="sig" select="n1:legalAuthenticator/n1:signatureCode"/>
276
276
  </xsl:call-template>
277
277
  <xsl:if test="n1:legalAuthenticator/n1:time/@value">
278
278
  <xsl:text> at </xsl:text>
279
279
  <xsl:call-template name="show-time">
280
280
  <xsl:with-param name="datetime" select="n1:legalAuthenticator/n1:time"/>
281
281
  </xsl:call-template>
282
282
  </xsl:if>
283
283
  </td>
284
284
  </tr>
285
285
  <xsl:if test="n1:legalAuthenticator/n1:assignedEntity/n1:addr | n1:legalAuthenticator/n1:assignedEntity/n1:telecom">
286
286
  <tr>
287
287
  <td bgcolor="#3399ff">
288
288
  <span class="td_label">
289
289
  <xsl:text>Contact info</xsl:text>
290
290
  </span>
291
291
  </td>
292
292
  <td>
293
293
  <xsl:call-template name="show-contactInfo">
294
294
  <xsl:with-param name="contact" select="n1:legalAuthenticator/n1:assignedEntity"/>
295
295
  </xsl:call-template>
296
296
  </td>
297
297
  </tr>
298
298
  </xsl:if>
299
299
  </tbody>
300
300
  </table>
301
301
  </xsl:if>
302
302
  </xsl:template>
303
303
  <!-- dataEnterer -->
304
304
  <xsl:template name="dataEnterer">
305
305
  <xsl:if test="n1:dataEnterer">
306
306
  <table class="header_table">
307
307
  <tbody>
308
308
  <tr>
309
309
  <td width="20%" bgcolor="#3399ff">
310
310
  <span class="td_label">
311
311
  <xsl:text>Entered by</xsl:text>
312
312
  </span>
313
313
  </td>
314
314
  <td width="80%">
315
315
  <xsl:call-template name="show-assignedEntity">
316
316
  <xsl:with-param name="asgnEntity" select="n1:dataEnterer/n1:assignedEntity"/>
317
317
  </xsl:call-template>
318
318
  </td>
319
319
  </tr>
320
320
  <xsl:if test="n1:dataEnterer/n1:assignedEntity/n1:addr | n1:dataEnterer/n1:assignedEntity/n1:telecom">
321
321
  <tr>
322
322
  <td bgcolor="#3399ff">
323
323
  <span class="td_label">
324
324
  <xsl:text>Contact info</xsl:text>
325
325
  </span>
326
326
  </td>
327
327
  <td>
328
328
  <xsl:call-template name="show-contactInfo">
329
329
  <xsl:with-param name="contact" select="n1:dataEnterer/n1:assignedEntity"/>
330
330
  </xsl:call-template>
331
331
  </td>
332
332
  </tr>
333
333
  </xsl:if>
334
334
  </tbody>
335
335
  </table>
336
336
  </xsl:if>
337
337
  </xsl:template>
338
338
  <!-- componentOf -->
339
339
  <xsl:template name="componentof">
340
340
  <xsl:if test="n1:componentOf">
341
341
  <table class="header_table">
342
342
  <tbody>
343
343
  <xsl:for-each select="n1:componentOf/n1:encompassingEncounter">
344
344
  <xsl:if test="n1:id">
345
345
  <tr>
346
346
  <xsl:choose>
347
347
  <xsl:when test="n1:code">
348
348
  <td width="20%" bgcolor="#3399ff">
349
349
  <span class="td_label">
350
350
  <xsl:text>Encounter Id</xsl:text>
351
351
  </span>
352
352
  </td>
353
353
  <td width="30%">
354
354
  <xsl:call-template name="show-id">
355
355
  <xsl:with-param name="id" select="n1:id"/>
356
356
  </xsl:call-template>
357
357
  </td>
358
358
  <td width="15%" bgcolor="#3399ff">
359
359
  <span class="td_label">
360
360
  <xsl:text>Encounter Type</xsl:text>
361
361
  </span>
362
362
  </td>
363
363
  <td>
364
364
  <xsl:call-template name="show-code">
365
365
  <xsl:with-param name="code" select="n1:code"/>
366
366
  </xsl:call-template>
367
367
  </td>
368
368
  </xsl:when>
369
369
  <xsl:otherwise>
370
370
  <td width="20%" bgcolor="#3399ff">
371
371
  <span class="td_label">
372
372
  <xsl:text>Encounter Id</xsl:text>
373
373
  </span>
374
374
  </td>
375
375
  <td>
376
376
  <xsl:call-template name="show-id">
377
377
  <xsl:with-param name="id" select="n1:id"/>
378
378
  </xsl:call-template>
379
379
  </td>
380
380
  </xsl:otherwise>
381
381
  </xsl:choose>
382
382
  </tr>
383
383
  </xsl:if>
384
384
  <tr>
385
385
  <td width="20%" bgcolor="#3399ff">
386
386
  <span class="td_label">
387
387
  <xsl:text>Encounter Date</xsl:text>
388
388
  </span>
389
389
  </td>
390
390
  <td colspan="3">
391
391
  <xsl:if test="n1:effectiveTime">
392
392
  <xsl:choose>
393
393
  <xsl:when test="n1:effectiveTime/@value">
394
394
  <xsl:text>&#160;at&#160;</xsl:text>
395
395
  <xsl:call-template name="show-time">
396
396
  <xsl:with-param name="datetime" select="n1:effectiveTime"/>
397
397
  </xsl:call-template>
398
398
  </xsl:when>
399
399
  <xsl:when test="n1:effectiveTime/n1:low">
400
400
  <xsl:text>&#160;From&#160;</xsl:text>
401
401
  <xsl:call-template name="show-time">
402
402
  <xsl:with-param name="datetime" select="n1:effectiveTime/n1:low"/>
403
403
  </xsl:call-template>
404
404
  <xsl:if test="n1:effectiveTime/n1:high">
405
405
  <xsl:text> to </xsl:text>
406
406
  <xsl:call-template name="show-time">
407
407
  <xsl:with-param name="datetime" select="n1:effectiveTime/n1:high"/>
408
408
  </xsl:call-template>
409
409
  </xsl:if>
410
410
  </xsl:when>
411
411
  </xsl:choose>
412
412
  </xsl:if>
413
413
  </td>
414
414
  </tr>
415
415
  <xsl:if test="n1:location/n1:healthCareFacility">
416
416
  <tr>
417
417
  <td width="20%" bgcolor="#3399ff">
418
418
  <span class="td_label">
419
419
  <xsl:text>Encounter Location</xsl:text>
420
420
  </span>
421
421
  </td>
422
422
  <td colspan="3">
423
423
  <xsl:choose>
424
424
  <xsl:when test="n1:location/n1:healthCareFacility/n1:location/n1:name">
425
425
  <xsl:call-template name="show-name">
426
426
  <xsl:with-param name="name" select="n1:location/n1:healthCareFacility/n1:location/n1:name"/>
427
427
  </xsl:call-template>
428
428
  <xsl:for-each select="n1:location/n1:healthCareFacility/n1:serviceProviderOrganization/n1:name">
429
429
  <xsl:text> of </xsl:text>
430
430
  <xsl:call-template name="show-name">
431
431
  <xsl:with-param name="name" select="n1:location/n1:healthCareFacility/n1:serviceProviderOrganization/n1:name"/>
432
432
  </xsl:call-template>
433
433
  </xsl:for-each>
434
434
  </xsl:when>
435
435
  <xsl:when test="n1:location/n1:healthCareFacility/n1:code">
436
436
  <xsl:call-template name="show-code">
437
437
  <xsl:with-param name="code" select="n1:location/n1:healthCareFacility/n1:code"/>
438
438
  </xsl:call-template>
439
439
  </xsl:when>
440
440
  <xsl:otherwise>
441
441
  <xsl:if test="n1:location/n1:healthCareFacility/n1:id">
442
442
  <xsl:text>id: </xsl:text>
443
443
  <xsl:for-each select="n1:location/n1:healthCareFacility/n1:id">
444
444
  <xsl:call-template name="show-id">
445
445
  <xsl:with-param name="id" select="."/>
446
446
  </xsl:call-template>
447
447
  </xsl:for-each>
448
448
  </xsl:if>
449
449
  </xsl:otherwise>
450
450
  </xsl:choose>
451
451
  </td>
452
452
  </tr>
453
453
  </xsl:if>
454
454
  <xsl:if test="n1:responsibleParty">
455
455
  <tr>
456
456
  <td width="20%" bgcolor="#3399ff">
457
457
  <span class="td_label">
458
458
  <xsl:text>Responsible party</xsl:text>
459
459
  </span>
460
460
  </td>
461
461
  <td colspan="3">
462
462
  <xsl:call-template name="show-assignedEntity">
463
463
  <xsl:with-param name="asgnEntity" select="n1:responsibleParty/n1:assignedEntity"/>
464
464
  </xsl:call-template>
465
465
  </td>
466
466
  </tr>
467
467
  </xsl:if>
468
468
  <xsl:if test="n1:responsibleParty/n1:assignedEntity/n1:addr | n1:responsibleParty/n1:assignedEntity/n1:telecom">
469
469
  <tr>
470
470
  <td width="20%" bgcolor="#3399ff">
471
471
  <span class="td_label">
472
472
  <xsl:text>Contact info</xsl:text>
473
473
  </span>
474
474
  </td>
475
475
  <td colspan="3">
476
476
  <xsl:call-template name="show-contactInfo">
477
477
  <xsl:with-param name="contact" select="n1:responsibleParty/n1:assignedEntity"/>
478
478
  </xsl:call-template>
479
479
  </td>
480
480
  </tr>
481
481
  </xsl:if>
482
482
  </xsl:for-each>
483
483
  </tbody>
484
484
  </table>
485
485
  </xsl:if>
486
486
  </xsl:template>
487
487
  <!-- custodian -->
488
488
  <xsl:template name="custodian">
489
489
  <xsl:if test="n1:custodian">
490
490
  <table class="header_table">
491
491
  <tbody>
492
492
  <tr>
493
493
  <td width="20%" bgcolor="#3399ff">
494
494
  <span class="td_label">
495
495
  <xsl:text>Document maintained by</xsl:text>
496
496
  </span>
497
497
  </td>
498
498
  <td width="80%">
499
499
  <xsl:choose>
500
500
  <xsl:when test="n1:custodian/n1:assignedCustodian/n1:representedCustodianOrganization/n1:name">
501
501
  <xsl:call-template name="show-name">
502
502
  <xsl:with-param name="name" select="n1:custodian/n1:assignedCustodian/n1:representedCustodianOrganization/n1:name"/>
503
503
  </xsl:call-template>
504
504
  </xsl:when>
505
505
  <xsl:otherwise>
506
506
  <xsl:for-each select="n1:custodian/n1:assignedCustodian/n1:representedCustodianOrganization/n1:id">
507
507
  <xsl:call-template name="show-id"/>
508
508
  <xsl:if test="position()!=last()">
509
509
  <br/>
510
510
  </xsl:if>
511
511
  </xsl:for-each>
512
512
  </xsl:otherwise>
513
513
  </xsl:choose>
514
514
  </td>
515
515
  </tr>
516
516
  <xsl:if test="n1:custodian/n1:assignedCustodian/n1:representedCustodianOrganization/n1:addr | n1:custodian/n1:assignedCustodian/n1:representedCustodianOrganization/n1:telecom">
517
517
  <tr>
518
518
  <td bgcolor="#3399ff">
519
519
  <span class="td_label">
520
520
  <xsl:text>Contact info</xsl:text>
521
521
  </span>
522
522
  </td>
523
523
  <td width="80%">
524
524
  <xsl:call-template name="show-contactInfo">
525
525
  <xsl:with-param name="contact" select="n1:custodian/n1:assignedCustodian/n1:representedCustodianOrganization"/>
526
526
  </xsl:call-template>
527
527
  </td>
528
528
  </tr>
529
529
  </xsl:if>
530
530
  </tbody>
531
531
  </table>
532
532
  </xsl:if>
533
533
  </xsl:template>
534
534
  <!-- documentationOf -->
535
535
  <xsl:template name="documentationOf">
536
536
  <xsl:if test="n1:documentationOf">
537
537
  <table class="header_table">
538
538
  <tbody>
539
539
  <xsl:for-each select="n1:documentationOf">
540
540
  <xsl:if test="n1:serviceEvent/@classCode and n1:serviceEvent/n1:code">
541
541
  <xsl:variable name="displayName">
542
542
  <xsl:call-template name="show-actClassCode">
543
543
  <xsl:with-param name="clsCode" select="n1:serviceEvent/@classCode"/>
544
544
  </xsl:call-template>
545
545
  </xsl:variable>
546
546
  <xsl:if test="$displayName">
547
547
  <tr>
548
548
  <td width="20%" bgcolor="#3399ff">
549
549
  <span class="td_label">
550
550
  <xsl:call-template name="firstCharCaseUp">
551
551
  <xsl:with-param name="data" select="$displayName"/>
552
552
  </xsl:call-template>
553
553
  </span>
554
554
  </td>
555
555
  <td width="80%" colspan="3">
556
556
  <xsl:call-template name="show-code">
557
557
  <xsl:with-param name="code" select="n1:serviceEvent/n1:code"/>
558
558
  </xsl:call-template>
559
559
  <xsl:if test="n1:serviceEvent/n1:effectiveTime">
560
560
  <xsl:choose>
561
561
  <xsl:when test="n1:serviceEvent/n1:effectiveTime/@value">
562
562
  <xsl:text>&#160;at&#160;</xsl:text>
563
563
  <xsl:call-template name="show-time">
564
564
  <xsl:with-param name="datetime" select="n1:serviceEvent/n1:effectiveTime"/>
565
565
  </xsl:call-template>
566
566
  </xsl:when>
567
567
  <xsl:when test="n1:serviceEvent/n1:effectiveTime/n1:low">
568
568
  <xsl:text>&#160;from&#160;</xsl:text>
569
569
  <xsl:call-template name="show-time">
570
570
  <xsl:with-param name="datetime" select="n1:serviceEvent/n1:effectiveTime/n1:low"/>
571
571
  </xsl:call-template>
572
572
  <xsl:if test="n1:serviceEvent/n1:effectiveTime/n1:high">
573
573
  <xsl:text> to </xsl:text>
574
574
  <xsl:call-template name="show-time">
575
575
  <xsl:with-param name="datetime" select="n1:serviceEvent/n1:effectiveTime/n1:high"/>
576
576
  </xsl:call-template>
577
577
  </xsl:if>
578
578
  </xsl:when>
579
579
  </xsl:choose>
580
580
  </xsl:if>
581
581
  </td>
582
582
  </tr>
583
583
  </xsl:if>
584
584
  </xsl:if>
585
585
  <xsl:for-each select="n1:serviceEvent/n1:performer">
586
586
  <xsl:variable name="displayName">
587
587
  <xsl:call-template name="show-participationType">
588
588
  <xsl:with-param name="ptype" select="@typeCode"/>
589
589
  </xsl:call-template>
590
590
  <xsl:text> </xsl:text>
591
591
  <xsl:if test="n1:functionCode/@code">
592
592
  <xsl:call-template name="show-participationFunction">
593
593
  <xsl:with-param name="pFunction" select="n1:functionCode/@code"/>
594
594
  </xsl:call-template>
595
595
  </xsl:if>
596
596
  </xsl:variable>
597
597
  <tr>
598
598
  <td width="20%" bgcolor="#3399ff">
599
599
  <span class="td_label">
600
600
  <xsl:call-template name="firstCharCaseUp">
601
601
  <xsl:with-param name="data" select="$displayName"/>
602
602
  </xsl:call-template>
603
603
  </span>
604
604
  </td>
605
605
  <td width="80%" colspan="3">
606
606
  <xsl:call-template name="show-assignedEntity">
607
607
  <xsl:with-param name="asgnEntity" select="n1:assignedEntity"/>
608
608
  </xsl:call-template>
609
609
  </td>
610
610
  </tr>
611
611
  </xsl:for-each>
612
612
  </xsl:for-each>
613
613
  </tbody>
614
614
  </table>
615
615
  </xsl:if>
616
616
  </xsl:template>
617
617
  <!-- inFulfillmentOf -->
618
618
  <xsl:template name="inFulfillmentOf">
619
619
  <xsl:if test="n1:infulfillmentOf">
620
620
  <table class="header_table">
621
621
  <tbody>
622
622
  <xsl:for-each select="n1:inFulfillmentOf">
623
623
  <tr>
624
624
  <td width="20%" bgcolor="#3399ff">
625
625
  <span class="td_label">
626
626
  <xsl:text>In fulfillment of</xsl:text>
627
627
  </span>
628
628
  </td>
629
629
  <td width="80%">
630
630
  <xsl:for-each select="n1:order">
631
631
  <xsl:for-each select="n1:id">
632
632
  <xsl:call-template name="show-id"/>
633
633
  </xsl:for-each>
634
634
  <xsl:for-each select="n1:code">
635
635
  <xsl:text>&#160;</xsl:text>
636
636
  <xsl:call-template name="show-code">
637
637
  <xsl:with-param name="code" select="."/>
638
638
  </xsl:call-template>
639
639
  </xsl:for-each>
640
640
  <xsl:for-each select="n1:priorityCode">
641
641
  <xsl:text>&#160;</xsl:text>
642
642
  <xsl:call-template name="show-code">
643
643
  <xsl:with-param name="code" select="."/>
644
644
  </xsl:call-template>
645
645
  </xsl:for-each>
646
646
  </xsl:for-each>
647
647
  </td>
648
648
  </tr>
649
649
  </xsl:for-each>
650
650
  </tbody>
651
651
  </table>
652
652
  </xsl:if>
653
653
  </xsl:template>
654
654
  <!-- informant -->
655
655
  <xsl:template name="informant">
656
656
  <xsl:if test="n1:informant">
657
657
  <table class="header_table">
658
658
  <tbody>
659
659
  <xsl:for-each select="n1:informant">
660
660
  <tr>
661
661
  <td width="20%" bgcolor="#3399ff">
662
662
  <span class="td_label">
663
663
  <xsl:text>Informant</xsl:text>
664
664
  </span>
665
665
  </td>
666
666
  <td width="80%">
667
667
  <xsl:if test="n1:assignedEntity">
668
668
  <xsl:call-template name="show-assignedEntity">
669
669
  <xsl:with-param name="asgnEntity" select="n1:assignedEntity"/>
670
670
  </xsl:call-template>
671
671
  </xsl:if>
672
672
  <xsl:if test="n1:relatedEntity">
673
673
  <xsl:call-template name="show-relatedEntity">
674
674
  <xsl:with-param name="relatedEntity" select="n1:relatedEntity"/>
675
675
  </xsl:call-template>
676
676
  </xsl:if>
677
677
  </td>
678
678
  </tr>
679
679
  <xsl:choose>
680
680
  <xsl:when test="n1:assignedEntity/n1:addr | n1:assignedEntity/n1:telecom">
681
681
  <tr>
682
682
  <td bgcolor="#3399ff">
683
683
  <span class="td_label">
684
684
  <xsl:text>Contact info</xsl:text>
685
685
  </span>
686
686
  </td>
687
687
  <td>
688
688
  <xsl:if test="n1:assignedEntity">
689
689
  <xsl:call-template name="show-contactInfo">
690
690
  <xsl:with-param name="contact" select="n1:assignedEntity"/>
691
691
  </xsl:call-template>
692
692
  </xsl:if>
693
693
  </td>
694
694
  </tr>
695
695
  </xsl:when>
696
696
  <xsl:when test="n1:relatedEntity/n1:addr | n1:relatedEntity/n1:telecom">
697
697
  <tr>
698
698
  <td bgcolor="#3399ff">
699
699
  <span class="td_label">
700
700
  <xsl:text>Contact info</xsl:text>
701
701
  </span>
702
702
  </td>
703
703
  <td>
704
704
  <xsl:if test="n1:relatedEntity">
705
705
  <xsl:call-template name="show-contactInfo">
706
706
  <xsl:with-param name="contact" select="n1:relatedEntity"/>
707
707
  </xsl:call-template>
708
708
  </xsl:if>
709
709
  </td>
710
710
  </tr>
711
711
  </xsl:when>
712
712
  </xsl:choose>
713
713
  </xsl:for-each>
714
714
  </tbody>
715
715
  </table>
716
716
  </xsl:if>
717
717
  </xsl:template>
718
718
  <!-- informantionRecipient -->
719
719
  <xsl:template name="informationRecipient">
720
720
  <xsl:if test="n1:informationRecipient">
721
721
  <table class="header_table">
722
722
  <tbody>
723
723
  <xsl:for-each select="n1:informationRecipient">
724
724
  <tr>
725
725
  <td width="20%" bgcolor="#3399ff">
726
726
  <span class="td_label">
727
727
  <xsl:text>Information recipient:</xsl:text>
728
728
  </span>
729
729
  </td>
730
730
  <td width="80%">
731
731
  <xsl:choose>
732
732
  <xsl:when test="n1:intendedRecipient/n1:informationRecipient/n1:name">
733
733
  <xsl:for-each select="n1:intendedRecipient/n1:informationRecipient">
734
734
  <xsl:call-template name="show-name">
735
735
  <xsl:with-param name="name" select="n1:name"/>
736
736
  </xsl:call-template>
737
737
  <xsl:if test="position() != last()">
738
738
  <br/>
739
739
  </xsl:if>
740
740
  </xsl:for-each>
741
741
  </xsl:when>
742
742
  <xsl:otherwise>
743
743
  <xsl:for-each select="n1:intendedRecipient">
744
744
  <xsl:for-each select="n1:id">
745
745
  <xsl:call-template name="show-id"/>
746
746
  </xsl:for-each>
747
747
  <xsl:if test="position() != last()">
748
748
  <br/>
749
749
  </xsl:if>
750
750
  <br/>
751
751
  </xsl:for-each>
752
752
  </xsl:otherwise>
753
753
  </xsl:choose>
754
754
  </td>
755
755
  </tr>
756
756
  <xsl:if test="n1:intendedRecipient/n1:addr | n1:intendedRecipient/n1:telecom">
757
757
  <tr>
758
758
  <td bgcolor="#3399ff">
759
759
  <span class="td_label">
760
760
  <xsl:text>Contact info</xsl:text>
761
761
  </span>
762
762
  </td>
763
763
  <td>
764
764
  <xsl:call-template name="show-contactInfo">
765
765
  <xsl:with-param name="contact" select="n1:intendedRecipient"/>
766
766
  </xsl:call-template>
767
767
  </td>
768
768
  </tr>
769
769
  </xsl:if>
770
770
  </xsl:for-each>
771
771
  </tbody>
772
772
  </table>
773
773
  </xsl:if>
774
774
  </xsl:template>
775
775
  <!-- participant -->
776
776
  <xsl:template name="participant">
777
777
  <xsl:if test="n1:participant">
778
778
  <table class="header_table">
779
779
  <tbody>
780
780
  <xsl:for-each select="n1:participant">
781
781
  <tr>
782
782
  <td width="20%" bgcolor="#3399ff">
783
783
  <xsl:variable name="participtRole">
784
784
  <xsl:call-template name="translateRoleAssoCode">
785
785
  <xsl:with-param name="classCode" select="n1:associatedEntity/@classCode"/>
786
786
  <xsl:with-param name="code" select="n1:associatedEntity/n1:code"/>
787
787
  </xsl:call-template>
788
788
  </xsl:variable>
789
789
  <xsl:choose>
790
790
  <xsl:when test="$participtRole">
791
791
  <span class="td_label">
792
792
  <xsl:call-template name="firstCharCaseUp">
793
793
  <xsl:with-param name="data" select="$participtRole"/>
794
794
  </xsl:call-template>
795
795
  </span>
796
796
  </xsl:when>
797
797
  <xsl:otherwise>
798
798
  <span class="td_label">
799
799
  <xsl:text>Participant</xsl:text>
800
800
  </span>
801
801
  </xsl:otherwise>
802
802
  </xsl:choose>
803
803
  </td>
804
804
  <td width="80%">
805
805
  <xsl:if test="n1:functionCode">
806
806
  <xsl:call-template name="show-code">
807
807
  <xsl:with-param name="code" select="n1:functionCode"/>
808
808
  </xsl:call-template>
809
809
  </xsl:if>
810
810
  <xsl:call-template name="show-associatedEntity">
811
811
  <xsl:with-param name="assoEntity" select="n1:associatedEntity"/>
812
812
  </xsl:call-template>
813
813
  <xsl:if test="n1:time">
814
814
  <xsl:if test="n1:time/n1:low">
815
815
  <xsl:text> from </xsl:text>
816
816
  <xsl:call-template name="show-time">
817
817
  <xsl:with-param name="datetime" select="n1:time/n1:low"/>
818
818
  </xsl:call-template>
819
819
  </xsl:if>
820
820
  <xsl:if test="n1:time/n1:high">
821
821
  <xsl:text> to </xsl:text>
822
822
  <xsl:call-template name="show-time">
823
823
  <xsl:with-param name="datetime" select="n1:time/n1:high"/>
824
824
  </xsl:call-template>
825
825
  </xsl:if>
826
826
  </xsl:if>
827
827
  <xsl:if test="position() != last()">
828
828
  <br/>
829
829
  </xsl:if>
830
830
  </td>
831
831
  </tr>
832
832
  <xsl:if test="n1:associatedEntity/n1:addr | n1:associatedEntity/n1:telecom">
833
833
  <tr>
834
834
  <td bgcolor="#3399ff">
835
835
  <span class="td_label">
836
836
  <xsl:text>Contact info</xsl:text>
837
837
  </span>
838
838
  </td>
839
839
  <td>
840
840
  <xsl:call-template name="show-contactInfo">
841
841
  <xsl:with-param name="contact" select="n1:associatedEntity"/>
842
842
  </xsl:call-template>
843
843
  </td>
844
844
  </tr>
845
845
  </xsl:if>
846
846
  </xsl:for-each>
847
847
  </tbody>
848
848
  </table>
849
849
  </xsl:if>
850
850
  </xsl:template>
851
851
  <!-- recordTarget -->
852
852
  <xsl:template name="recordTarget">
853
853
  <table class="header_table">
854
854
  <tbody>
855
855
  <xsl:for-each select="/n1:ClinicalDocument/n1:recordTarget/n1:patientRole">
856
856
  <xsl:if test="not(n1:id/@nullFlavor)">
857
857
  <tr>
858
858
  <td width="20%" bgcolor="#3399ff">
859
859
  <span class="td_label">
860
860
  <xsl:text>Patient</xsl:text>
861
861
  </span>
862
862
  </td>
863
863
  <td colspan="3">
864
864
  <xsl:call-template name="show-name">
865
865
  <xsl:with-param name="name" select="n1:patient/n1:name"/>
866
866
  </xsl:call-template>
867
867
  </td>
868
868
  </tr>
869
869
  <tr>
870
870
  <td width="20%" bgcolor="#3399ff">
871
871
  <span class="td_label">
872
872
  <xsl:text>Date of birth</xsl:text>
873
873
  </span>
874
874
  </td>
875
875
  <td width="30%">
876
876
  <xsl:call-template name="show-time">
877
877
  <xsl:with-param name="datetime" select="n1:patient/n1:birthTime"/>
878
878
  </xsl:call-template>
879
879
  </td>
880
880
  <td width="15%" bgcolor="#3399ff">
881
881
  <span class="td_label">
882
882
  <xsl:text>Sex</xsl:text>
883
883
  </span>
884
884
  </td>
885
885
  <td>
886
886
  <xsl:for-each select="n1:patient/n1:administrativeGenderCode">
887
887
  <xsl:call-template name="show-gender"/>
888
888
  </xsl:for-each>
889
889
  </td>
890
890
  </tr>
891
891
  <xsl:if test="n1:patient/n1:raceCode | (n1:patient/n1:ethnicGroupCode)">
892
892
  <tr>
893
893
  <td width="20%" bgcolor="#3399ff">
894
894
  <span class="td_label">
895
895
  <xsl:text>Race</xsl:text>
896
896
  </span>
897
897
  </td>
898
898
  <td width="30%">
899
899
  <xsl:choose>
900
900
  <xsl:when test="n1:patient/n1:raceCode">
901
901
  <xsl:for-each select="n1:patient/n1:raceCode">
902
902
  <xsl:call-template name="show-race-ethnicity"/>
903
903
  </xsl:for-each>
904
904
  </xsl:when>
905
905
  <xsl:otherwise>
906
906
  <xsl:text>Information not available</xsl:text>
907
907
  </xsl:otherwise>
908
908
  </xsl:choose>
909
909
  </td>
910
910
  <td width="15%" bgcolor="#3399ff">
911
911
  <span class="td_label">
912
912
  <xsl:text>Ethnicity</xsl:text>
913
913
  </span>
914
914
  </td>
915
915
  <td>
916
916
  <xsl:choose>
917
917
  <xsl:when test="n1:patient/n1:ethnicGroupCode">
918
918
  <xsl:for-each select="n1:patient/n1:ethnicGroupCode">
919
919
  <xsl:call-template name="show-race-ethnicity"/>
920
920
  </xsl:for-each>
921
921
  </xsl:when>
922
922
  <xsl:otherwise>
923
923
  <xsl:text>Information not available</xsl:text>
924
924
  </xsl:otherwise>
925
925
  </xsl:choose>
926
926
  </td>
927
927
  </tr>
928
928
  </xsl:if>
929
929
  <tr>
930
930
  <td bgcolor="#3399ff">
931
931
  <span class="td_label">
932
932
  <xsl:text>Contact info</xsl:text>
933
933
  </span>
934
934
  </td>
935
935
  <td>
936
936
  <xsl:call-template name="show-contactInfo">
937
937
  <xsl:with-param name="contact" select="."/>
938
938
  </xsl:call-template>
939
939
  </td>
940
940
  <td bgcolor="#3399ff">
941
941
  <span class="td_label">
942
942
  <xsl:text>Patient IDs</xsl:text>
943
943
  </span>
944
944
  </td>
945
945
  <td>
946
946
  <xsl:for-each select="n1:id">
947
947
  <xsl:call-template name="show-id"/>
948
948
  <br/>
949
949
  </xsl:for-each>
950
950
  </td>
951
951
  </tr>
952
952
  </xsl:if>
953
953
  </xsl:for-each>
954
954
  </tbody>
955
955
  </table>
956
956
  </xsl:template>
957
957
  <!-- relatedDocument -->
958
958
  <xsl:template name="relatedDocument">
959
959
  <xsl:if test="n1:relatedDocument">
960
960
  <table class="header_table">
961
961
  <tbody>
962
962
  <xsl:for-each select="n1:relatedDocument">
963
963
  <tr>
964
964
  <td width="20%" bgcolor="#3399ff">
965
965
  <span class="td_label">
966
966
  <xsl:text>Related document</xsl:text>
967
967
  </span>
968
968
  </td>
969
969
  <td width="80%">
970
970
  <xsl:for-each select="n1:parentDocument">
971
971
  <xsl:for-each select="n1:id">
972
972
  <xsl:call-template name="show-id"/>
973
973
  <br/>
974
974
  </xsl:for-each>
975
975
  </xsl:for-each>
976
976
  </td>
977
977
  </tr>
978
978
  </xsl:for-each>
979
979
  </tbody>
980
980
  </table>
981
981
  </xsl:if>
982
982
  </xsl:template>
983
983
  <!-- authorization (consent) -->
984
984
  <xsl:template name="authorization">
985
985
  <xsl:if test="n1:authorization">
986
986
  <table class="header_table">
987
987
  <tbody>
988
988
  <xsl:for-each select="n1:authorization">
989
989
  <tr>
990
990
  <td width="20%" bgcolor="#3399ff">
991
991
  <span class="td_label">
992
992
  <xsl:text>Consent</xsl:text>
993
993
  </span>
994
994
  </td>
995
995
  <td width="80%">
996
996
  <xsl:choose>
997
997
  <xsl:when test="n1:consent/n1:code">
998
998
  <xsl:call-template name="show-code">
999
999
  <xsl:with-param name="code" select="n1:consent/n1:code"/>
1000
1000
  </xsl:call-template>
1001
1001
  </xsl:when>
1002
1002
  <xsl:otherwise>
1003
1003
  <xsl:call-template name="show-code">
1004
1004
  <xsl:with-param name="code" select="n1:consent/n1:statusCode"/>
1005
1005
  </xsl:call-template>
1006
1006
  </xsl:otherwise>
1007
1007
  </xsl:choose>
1008
1008
  <br/>
1009
1009
  </td>
1010
1010
  </tr>
1011
1011
  </xsl:for-each>
1012
1012
  </tbody>
1013
1013
  </table>
1014
1014
  </xsl:if>
1015
1015
  </xsl:template>
1016
1016
  <!-- setAndVersion -->
1017
1017
  <xsl:template name="setAndVersion">
1018
1018
  <xsl:if test="n1:setId and n1:versionNumber">
1019
1019
  <table class="header_table">
1020
1020
  <tbody>
1021
1021
  <tr>
1022
1022
  <td width="20%">
1023
1023
  <xsl:text>SetId and Version</xsl:text>
1024
1024
  </td>
1025
1025
  <td colspan="3">
1026
1026
  <xsl:text>SetId: </xsl:text>
1027
1027
  <xsl:call-template name="show-id">
1028
1028
  <xsl:with-param name="id" select="n1:setId"/>
1029
1029
  </xsl:call-template>
1030
1030
  <xsl:text> Version: </xsl:text>
1031
1031
  <xsl:value-of select="n1:versionNumber/@value"/>
1032
1032
  </td>
1033
1033
  </tr>
1034
1034
  </tbody>
1035
1035
  </table>
1036
1036
  </xsl:if>
1037
1037
  </xsl:template>
1038
1038
  <!-- show StructuredBody -->
1039
1039
  <xsl:template match="n1:component/n1:structuredBody">
1040
1040
  <xsl:for-each select="n1:component/n1:section">
1041
1041
  <xsl:call-template name="section"/>
1042
1042
  </xsl:for-each>
1043
1043
  </xsl:template>
1044
1044
  <!-- show nonXMLBody -->
1045
1045
  <xsl:template match='n1:component/n1:nonXMLBody'>
1046
1046
  <xsl:choose>
1047
1047
  <!-- if there is a reference, use that in an IFRAME -->
1048
1048
  <xsl:when test='n1:text/n1:reference'>
1049
1049
  <IFRAME name='nonXMLBody' id='nonXMLBody' WIDTH='80%' HEIGHT='600' src='{n1:text/n1:reference/@value}'/>
1050
1050
  </xsl:when>
1051
1051
  <xsl:when test='n1:text/@mediaType="text/plain"'>
1052
1052
  <pre>
1053
1053
  <xsl:value-of select='n1:text/text()'/>
1054
1054
  </pre>
1055
1055
  </xsl:when>
1056
1056
  <xsl:otherwise>
1057
1057
  <CENTER>Cannot display the text</CENTER>
1058
1058
  </xsl:otherwise>
1059
1059
  </xsl:choose>
1060
1060
  </xsl:template>
1061
1061
  <!-- top level component/section: display title and text,
1062
1062
  and process any nested component/sections
1063
1063
  -->
1064
1064
  <xsl:template name="section">
1065
1065
  <xsl:param name="filter"/>
1066
1066
  <xsl:call-template name="section-title">
1067
1067
  <xsl:with-param name="title" select="n1:title"/>
1068
1068
  </xsl:call-template>
1069
1069
  <xsl:call-template name="section-author"/>
1070
1070
  <xsl:call-template name="section-text"/>
1071
1071
  <xsl:for-each select="n1:component/n1:section">
1072
1072
  <xsl:call-template name="nestedSection">
1073
1073
  <xsl:with-param name="margin" select="2"/>
1074
1074
  </xsl:call-template>
1075
1075
  </xsl:for-each>
1076
1076
  </xsl:template>
1077
1077
  <!-- top level section title -->
1078
1078
  <xsl:template name="section-title">
1079
1079
  <xsl:param name="title"/>
1080
1080
  <xsl:choose>
1081
1081
  <xsl:when test="count(/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component[n1:section]) &gt; 1">
1082
1082
  <h3>
1083
1083
  <a name="{generate-id($title)}" href="#toc">
1084
1084
  <xsl:value-of select="$title"/>
1085
1085
  </a>
1086
1086
  </h3>
1087
1087
  </xsl:when>
1088
1088
  <xsl:otherwise>
1089
1089
  <h3>
1090
1090
  <xsl:value-of select="$title"/>
1091
1091
  </h3>
1092
1092
  </xsl:otherwise>
1093
1093
  </xsl:choose>
1094
1094
  </xsl:template>
1095
1095
 
1096
1096
 
1097
1097
  <!-- section author -->
1098
1098
  <xsl:template name="section-author">
1099
1099
  <xsl:if test="count(n1:author)&gt;0">
1100
1100
  <div style="margin-left : 2em;">
1101
1101
  <b>
1102
1102
  <xsl:text>Section Author: </xsl:text>
1103
1103
  </b>
1104
1104
  <xsl:for-each select="n1:author/n1:assignedAuthor">
1105
1105
  <xsl:choose>
1106
1106
  <xsl:when test="n1:assignedPerson/n1:name">
1107
1107
  <xsl:call-template name="show-name">
1108
1108
  <xsl:with-param name="name" select="n1:assignedPerson/n1:name"/>
1109
1109
  </xsl:call-template>
1110
1110
  <xsl:if test="n1:representedOrganization">
1111
1111
  <xsl:text>, </xsl:text>
1112
1112
  <xsl:call-template name="show-name">
1113
1113
  <xsl:with-param name="name" select="n1:representedOrganization/n1:name"/>
1114
1114
  </xsl:call-template>
1115
1115
  </xsl:if>
1116
1116
  </xsl:when>
1117
1117
  <xsl:when test="n1:assignedAuthoringDevice/n1:softwareName">
1118
1118
  <xsl:value-of select="n1:assignedAuthoringDevice/n1:softwareName"/>
1119
1119
  </xsl:when>
1120
1120
  <xsl:otherwise>
1121
1121
  <xsl:for-each select="n1:id">
1122
1122
  <xsl:call-template name="show-id"/>
1123
1123
  <br/>
1124
1124
  </xsl:for-each>
1125
1125
  </xsl:otherwise>
1126
1126
  </xsl:choose>
1127
1127
  </xsl:for-each>
1128
1128
  <br/>
1129
1129
  </div>
1130
1130
  </xsl:if>
1131
1131
  </xsl:template>
1132
1132
  <!-- top-level section Text -->
1133
1133
  <xsl:template name="section-text">
1134
1134
  <div>
1135
1135
  <xsl:apply-templates select="n1:text"/>
1136
1136
  </div>
1137
1137
  </xsl:template>
1138
1138
  <!-- nested component/section -->
1139
1139
  <xsl:template name="nestedSection">
1140
1140
  <xsl:param name="margin"/>
1141
1141
  <h4 style="margin-left : {$margin}em;">
1142
1142
  <xsl:value-of select="n1:title"/>
1143
1143
  </h4>
1144
1144
  <div style="margin-left : {$margin}em;">
1145
1145
  <xsl:apply-templates select="n1:text"/>
1146
1146
  </div>
1147
1147
  <xsl:for-each select="n1:component/n1:section">
1148
1148
  <xsl:call-template name="nestedSection">
1149
1149
  <xsl:with-param name="margin" select="2*$margin"/>
1150
1150
  </xsl:call-template>
1151
1151
  </xsl:for-each>
1152
1152
  </xsl:template>
1153
1153
  <!-- paragraph -->
1154
1154
  <xsl:template match="n1:paragraph">
1155
1155
  <p>
1156
1156
  <xsl:apply-templates/>
1157
1157
  </p>
1158
1158
  </xsl:template>
1159
1159
  <!-- pre format -->
1160
1160
  <xsl:template match="n1:pre">
1161
1161
  <pre>
1162
1162
  <xsl:apply-templates/>
1163
1163
  </pre>
1164
1164
  </xsl:template>
1165
1165
  <!-- Content w/ deleted text is hidden -->
1166
1166
  <xsl:template match="n1:content[@revised='delete']"/>
1167
1167
  <!-- content -->
1168
1168
  <xsl:template match="n1:content">
1169
1169
  <xsl:apply-templates/>
1170
1170
  </xsl:template>
1171
1171
  <!-- line break -->
1172
1172
  <xsl:template match="n1:br">
1173
1173
  <xsl:element name='br'>
1174
1174
  <xsl:apply-templates/>
1175
1175
  </xsl:element>
1176
1176
  </xsl:template>
1177
1177
  <!-- list -->
1178
1178
  <xsl:template match="n1:list">
1179
1179
  <xsl:if test="n1:caption">
1180
1180
  <p>
1181
1181
  <b>
1182
1182
  <xsl:apply-templates select="n1:caption"/>
1183
1183
  </b>
1184
1184
  </p>
1185
1185
  </xsl:if>
1186
1186
  <ul>
1187
1187
  <xsl:for-each select="n1:item">
1188
1188
  <li>
1189
1189
  <xsl:apply-templates/>
1190
1190
  </li>
1191
1191
  </xsl:for-each>
1192
1192
  </ul>
1193
1193
  </xsl:template>
1194
1194
  <xsl:template match="n1:list[@listType='ordered']">
1195
1195
  <xsl:if test="n1:caption">
1196
1196
  <span style="font-weight:bold; ">
1197
1197
  <xsl:apply-templates select="n1:caption"/>
1198
1198
  </span>
1199
1199
  </xsl:if>
1200
1200
  <ol>
1201
1201
  <xsl:for-each select="n1:item">
1202
1202
  <li>
1203
1203
  <xsl:apply-templates/>
1204
1204
  </li>
1205
1205
  </xsl:for-each>
1206
1206
  </ol>
1207
1207
  </xsl:template>
1208
1208
  <!-- caption -->
1209
1209
  <xsl:template match="n1:caption">
1210
1210
  <xsl:apply-templates/>
1211
1211
  <xsl:text>: </xsl:text>
1212
1212
  </xsl:template>
1213
1213
  <!-- Tables -->
1214
1214
  <xsl:template match="n1:table/@*|n1:thead/@*|n1:tfoot/@*|n1:tbody/@*|n1:colgroup/@*|n1:col/@*|n1:tr/@*|n1:th/@*|n1:td/@*">
1215
1215
  <xsl:copy>
1216
1216
  <xsl:copy-of select="@*"/>
1217
1217
  <xsl:apply-templates/>
1218
1218
  </xsl:copy>
1219
1219
  </xsl:template>
1220
1220
  <xsl:template match="n1:table">
1221
1221
  <table class="narr_table">
1222
1222
  <xsl:copy-of select="@*"/>
1223
1223
  <xsl:apply-templates/>
1224
1224
  </table>
1225
1225
  </xsl:template>
1226
1226
  <xsl:template match="n1:thead">
1227
1227
  <thead>
1228
1228
  <xsl:copy-of select="@*"/>
1229
1229
  <xsl:apply-templates/>
1230
1230
  </thead>
1231
1231
  </xsl:template>
1232
1232
  <xsl:template match="n1:tfoot">
1233
1233
  <tfoot>
1234
1234
  <xsl:copy-of select="@*"/>
1235
1235
  <xsl:apply-templates/>
1236
1236
  </tfoot>
1237
1237
  </xsl:template>
1238
1238
  <xsl:template match="n1:tbody">
1239
1239
  <tbody>
1240
1240
  <xsl:copy-of select="@*"/>
1241
1241
  <xsl:apply-templates/>
1242
1242
  </tbody>
1243
1243
  </xsl:template>
1244
1244
  <xsl:template match="n1:colgroup">
1245
1245
  <colgroup>
1246
1246
  <xsl:copy-of select="@*"/>
1247
1247
  <xsl:apply-templates/>
1248
1248
  </colgroup>
1249
1249
  </xsl:template>
1250
1250
  <xsl:template match="n1:col">
1251
1251
  <col>
1252
1252
  <xsl:copy-of select="@*"/>
1253
1253
  <xsl:apply-templates/>
1254
1254
  </col>
1255
1255
  </xsl:template>
1256
1256
  <xsl:template match="n1:tr">
1257
1257
  <tr class="narr_tr">
1258
1258
  <xsl:copy-of select="@*"/>
1259
1259
  <xsl:apply-templates/>
1260
1260
  </tr>
1261
1261
  </xsl:template>
1262
1262
  <xsl:template match="n1:th">
1263
1263
  <th class="narr_th">
1264
1264
  <xsl:copy-of select="@*"/>
1265
1265
  <xsl:apply-templates/>
1266
1266
  </th>
1267
1267
  </xsl:template>
1268
1268
  <xsl:template match="n1:td">
1269
1269
  <td>
1270
1270
  <xsl:copy-of select="@*"/>
1271
1271
  <xsl:apply-templates/>
1272
1272
  </td>
1273
1273
  </xsl:template>
1274
1274
  <xsl:template match="n1:table/n1:caption">
1275
1275
  <span style="font-weight:bold; ">
1276
1276
  <xsl:apply-templates/>
1277
1277
  </span>
1278
1278
  </xsl:template>
1279
1279
  <!-- RenderMultiMedia
1280
1280
  this currently only handles GIF's and JPEG's. It could, however,
1281
1281
  be extended by including other image MIME types in the predicate
1282
1282
  and/or by generating <object> or <applet> tag with the correct
1283
1283
  params depending on the media type @ID =$imageRef referencedObject
1284
1284
  -->
1285
1285
  <xsl:template match="n1:renderMultiMedia">
1286
1286
  <xsl:variable name="imageRef" select="@referencedObject"/>
1287
1287
  <xsl:choose>
1288
1288
  <xsl:when test="//n1:regionOfInterest[@ID=$imageRef]">
1289
1289
  <!-- Here is where the Region of Interest image referencing goes -->
1290
1290
  <xsl:if test="//n1:regionOfInterest[@ID=$imageRef]//n1:observationMedia/n1:value[@mediaType='image/gif' or
1291
1291
  @mediaType='image/jpeg']">
1292
1292
  <br clear="all"/>
1293
1293
  <xsl:element name="img">
1294
1294
  <xsl:attribute name="src"><xsl:value-of select="//n1:regionOfInterest[@ID=$imageRef]//n1:observationMedia/n1:value/n1:reference/@value"/></xsl:attribute>
1295
1295
  </xsl:element>
1296
1296
  </xsl:if>
1297
1297
  </xsl:when>
1298
1298
  <xsl:otherwise>
1299
1299
  <!-- Here is where the direct MultiMedia image referencing goes -->
1300
1300
  <xsl:if test="//n1:observationMedia[@ID=$imageRef]/n1:value[@mediaType='image/gif' or @mediaType='image/jpeg']">
1301
1301
  <br clear="all"/>
1302
1302
  <xsl:element name="img">
1303
1303
  <xsl:attribute name="src"><xsl:value-of select="//n1:observationMedia[@ID=$imageRef]/n1:value/n1:reference/@value"/></xsl:attribute>
1304
1304
  </xsl:element>
1305
1305
  </xsl:if>
1306
1306
  </xsl:otherwise>
1307
1307
  </xsl:choose>
1308
1308
  </xsl:template>
1309
1309
  <!-- Stylecode processing
1310
1310
  Supports Bold, Underline and Italics display
1311
1311
  -->
1312
1312
  <xsl:template match="//n1:*[@styleCode]">
1313
1313
  <xsl:if test="@styleCode='Bold'">
1314
1314
  <xsl:element name="b">
1315
1315
  <xsl:apply-templates/>
1316
1316
  </xsl:element>
1317
1317
  </xsl:if>
1318
1318
  <xsl:if test="@styleCode='Italics'">
1319
1319
  <xsl:element name="i">
1320
1320
  <xsl:apply-templates/>
1321
1321
  </xsl:element>
1322
1322
  </xsl:if>
1323
1323
  <xsl:if test="@styleCode='Underline'">
1324
1324
  <xsl:element name="u">
1325
1325
  <xsl:apply-templates/>
1326
1326
  </xsl:element>
1327
1327
  </xsl:if>
1328
1328
  <xsl:if test="contains(@styleCode,'Bold') and contains(@styleCode,'Italics') and not (contains(@styleCode, 'Underline'))">
1329
1329
  <xsl:element name="b">
1330
1330
  <xsl:element name="i">
1331
1331
  <xsl:apply-templates/>
1332
1332
  </xsl:element>
1333
1333
  </xsl:element>
1334
1334
  </xsl:if>
1335
1335
  <xsl:if test="contains(@styleCode,'Bold') and contains(@styleCode,'Underline') and not (contains(@styleCode, 'Italics'))">
1336
1336
  <xsl:element name="b">
1337
1337
  <xsl:element name="u">
1338
1338
  <xsl:apply-templates/>
1339
1339
  </xsl:element>
1340
1340
  </xsl:element>
1341
1341
  </xsl:if>
1342
1342
  <xsl:if test="contains(@styleCode,'Italics') and contains(@styleCode,'Underline') and not (contains(@styleCode, 'Bold'))">
1343
1343
  <xsl:element name="i">
1344
1344
  <xsl:element name="u">
1345
1345
  <xsl:apply-templates/>
1346
1346
  </xsl:element>
1347
1347
  </xsl:element>
1348
1348
  </xsl:if>
1349
1349
  <xsl:if test="contains(@styleCode,'Italics') and contains(@styleCode,'Underline') and contains(@styleCode, 'Bold')">
1350
1350
  <xsl:element name="b">
1351
1351
  <xsl:element name="i">
1352
1352
  <xsl:element name="u">
1353
1353
  <xsl:apply-templates/>
1354
1354
  </xsl:element>
1355
1355
  </xsl:element>
1356
1356
  </xsl:element>
1357
1357
  </xsl:if>
1358
1358
  <xsl:if test="not (contains(@styleCode,'Italics') or contains(@styleCode,'Underline') or contains(@styleCode, 'Bold'))">
1359
1359
  <xsl:apply-templates/>
1360
1360
  </xsl:if>
1361
1361
  </xsl:template>
1362
1362
  <!-- Superscript or Subscript -->
1363
1363
  <xsl:template match="n1:sup">
1364
1364
  <xsl:element name="sup">
1365
1365
  <xsl:apply-templates/>
1366
1366
  </xsl:element>
1367
1367
  </xsl:template>
1368
1368
  <xsl:template match="n1:sub">
1369
1369
  <xsl:element name="sub">
1370
1370
  <xsl:apply-templates/>
1371
1371
  </xsl:element>
1372
1372
  </xsl:template>
1373
1373
  <!-- show-signature -->
1374
1374
  <xsl:template name="show-sig">
1375
1375
  <xsl:param name="sig"/>
1376
1376
  <xsl:choose>
1377
1377
  <xsl:when test="$sig/@code =&apos;S&apos;">
1378
1378
  <xsl:text>signed</xsl:text>
1379
1379
  </xsl:when>
1380
1380
  <xsl:when test="$sig/@code=&apos;I&apos;">
1381
1381
  <xsl:text>intended</xsl:text>
1382
1382
  </xsl:when>
1383
1383
  <xsl:when test="$sig/@code=&apos;X&apos;">
1384
1384
  <xsl:text>signature required</xsl:text>
1385
1385
  </xsl:when>
1386
1386
  </xsl:choose>
1387
1387
  </xsl:template>
1388
1388
  <!-- show-id -->
1389
1389
  <xsl:template name="show-id">
1390
1390
  <xsl:param name="id"/>
1391
1391
  <xsl:choose>
1392
1392
  <xsl:when test="not($id)">
1393
1393
  <xsl:if test="not(@nullFlavor)">
1394
1394
  <xsl:if test="@extension">
1395
1395
  <xsl:value-of select="@extension"/>
1396
1396
  </xsl:if>
1397
1397
  <xsl:text> </xsl:text>
1398
1398
  <xsl:value-of select="@root"/>
1399
1399
  </xsl:if>
1400
1400
  </xsl:when>
1401
1401
  <xsl:otherwise>
1402
1402
  <xsl:if test="not($id/@nullFlavor)">
1403
1403
  <xsl:if test="$id/@extension">
1404
1404
  <xsl:value-of select="$id/@extension"/>
1405
1405
  </xsl:if>
1406
1406
  <xsl:text> </xsl:text>
1407
1407
  <xsl:value-of select="$id/@root"/>
1408
1408
  </xsl:if>
1409
1409
  </xsl:otherwise>
1410
1410
  </xsl:choose>
1411
1411
  </xsl:template>
1412
1412
  <!-- show-name -->
1413
1413
  <xsl:template name="show-name">
1414
1414
  <xsl:param name="name"/>
1415
1415
  <xsl:choose>
1416
1416
  <xsl:when test="$name/n1:family">
1417
1417
  <xsl:if test="$name/n1:prefix">
1418
1418
  <xsl:value-of select="$name/n1:prefix"/>
1419
1419
  <xsl:text> </xsl:text>
1420
1420
  </xsl:if>
1421
1421
  <xsl:value-of select="$name/n1:given"/>
1422
1422
  <xsl:text> </xsl:text>
1423
1423
  <xsl:value-of select="$name/n1:family"/>
1424
1424
  <xsl:if test="$name/n1:suffix">
1425
1425
  <xsl:text>, </xsl:text>
1426
1426
  <xsl:value-of select="$name/n1:suffix"/>
1427
1427
  </xsl:if>
1428
1428
  </xsl:when>
1429
1429
  <xsl:otherwise>
1430
1430
  <xsl:value-of select="$name"/>
1431
1431
  </xsl:otherwise>
1432
1432
  </xsl:choose>
1433
1433
  </xsl:template>
1434
1434
  <!-- show-gender -->
1435
1435
  <xsl:template name="show-gender">
1436
1436
  <xsl:choose>
1437
1437
  <xsl:when test="@code = &apos;M&apos;">
1438
1438
  <xsl:text>Male</xsl:text>
1439
1439
  </xsl:when>
1440
1440
  <xsl:when test="@code = &apos;F&apos;">
1441
1441
  <xsl:text>Female</xsl:text>
1442
1442
  </xsl:when>
1443
1443
  <xsl:when test="@code = &apos;U&apos;">
1444
1444
  <xsl:text>Undifferentiated</xsl:text>
1445
1445
  </xsl:when>
1446
1446
  </xsl:choose>
1447
1447
  </xsl:template>
1448
1448
  <!-- show-race-ethnicity -->
1449
1449
  <xsl:template name="show-race-ethnicity">
1450
1450
  <xsl:choose>
1451
1451
  <xsl:when test="@displayName">
1452
1452
  <xsl:value-of select="@displayName"/>
1453
1453
  </xsl:when>
1454
1454
  <xsl:otherwise>
1455
1455
  <xsl:value-of select="@code"/>
1456
1456
  </xsl:otherwise>
1457
1457
  </xsl:choose>
1458
1458
  </xsl:template>
1459
1459
  <!-- show-contactInfo -->
1460
1460
  <xsl:template name="show-contactInfo">
1461
1461
  <xsl:param name="contact"/>
1462
1462
  <xsl:call-template name="show-address">
1463
1463
  <xsl:with-param name="address" select="$contact/n1:addr"/>
1464
1464
  </xsl:call-template>
1465
1465
  <xsl:call-template name="show-telecom">
1466
1466
  <xsl:with-param name="telecom" select="$contact/n1:telecom"/>
1467
1467
  </xsl:call-template>
1468
1468
  </xsl:template>
1469
1469
  <!-- show-address -->
1470
1470
  <xsl:template name="show-address">
1471
1471
  <xsl:param name="address"/>
1472
1472
  <xsl:choose>
1473
1473
  <xsl:when test="$address">
1474
1474
  <xsl:if test="$address/@use">
1475
1475
  <xsl:text> </xsl:text>
1476
1476
  <xsl:call-template name="translateTelecomCode">
1477
1477
  <xsl:with-param name="code" select="$address/@use"/>
1478
1478
  </xsl:call-template>
1479
1479
  <xsl:text>:</xsl:text>
1480
1480
  <br/>
1481
1481
  </xsl:if>
1482
1482
  <xsl:for-each select="$address/n1:streetAddressLine">
1483
1483
  <xsl:value-of select="."/>
1484
1484
  <br/>
1485
1485
  </xsl:for-each>
1486
1486
  <xsl:if test="$address/n1:streetName">
1487
1487
  <xsl:value-of select="$address/n1:streetName"/>
1488
1488
  <xsl:text> </xsl:text>
1489
1489
  <xsl:value-of select="$address/n1:houseNumber"/>
1490
1490
  <br/>
1491
1491
  </xsl:if>
1492
1492
  <xsl:if test="string-length($address/n1:city)>0">
1493
1493
  <xsl:value-of select="$address/n1:city"/>
1494
1494
  </xsl:if>
1495
1495
  <xsl:if test="string-length($address/n1:state)>0">
1496
1496
  <xsl:text>,&#160;</xsl:text>
1497
1497
  <xsl:value-of select="$address/n1:state"/>
1498
1498
  </xsl:if>
1499
1499
  <xsl:if test="string-length($address/n1:postalCode)>0">
1500
1500
  <xsl:text>&#160;</xsl:text>
1501
1501
  <xsl:value-of select="$address/n1:postalCode"/>
1502
1502
  </xsl:if>
1503
1503
  <xsl:if test="string-length($address/n1:country)>0">
1504
1504
  <xsl:text>,&#160;</xsl:text>
1505
1505
  <xsl:value-of select="$address/n1:country"/>
1506
1506
  </xsl:if>
1507
1507
  </xsl:when>
1508
1508
  <xsl:otherwise>
1509
1509
  <xsl:text>address not available</xsl:text>
1510
1510
  </xsl:otherwise>
1511
1511
  </xsl:choose>
1512
1512
  <br/>
1513
1513
  </xsl:template>
1514
1514
  <!-- show-telecom -->
1515
1515
  <xsl:template name="show-telecom">
1516
1516
  <xsl:param name="telecom"/>
1517
1517
  <xsl:choose>
1518
1518
  <xsl:when test="$telecom">
1519
1519
  <xsl:variable name="type" select="substring-before($telecom/@value, ':')"/>
1520
1520
  <xsl:variable name="value" select="substring-after($telecom/@value, ':')"/>
1521
1521
  <xsl:if test="$type">
1522
1522
  <xsl:call-template name="translateTelecomCode">
1523
1523
  <xsl:with-param name="code" select="$type"/>
1524
1524
  </xsl:call-template>
1525
1525
  <xsl:if test="@use">
1526
1526
  <xsl:text> (</xsl:text>
1527
1527
  <xsl:call-template name="translateTelecomCode">
1528
1528
  <xsl:with-param name="code" select="@use"/>
1529
1529
  </xsl:call-template>
1530
1530
  <xsl:text>)</xsl:text>
1531
1531
  </xsl:if>
1532
1532
  <xsl:text>: </xsl:text>
1533
1533
  <xsl:text> </xsl:text>
1534
1534
  <xsl:value-of select="$value"/>
1535
1535
  </xsl:if>
1536
1536
  </xsl:when>
1537
1537
  <xsl:otherwise>
1538
1538
  <xsl:text>Telecom information not available</xsl:text>
1539
1539
  </xsl:otherwise>
1540
1540
  </xsl:choose>
1541
1541
  <br/>
1542
1542
  </xsl:template>
1543
1543
  <!-- show-recipientType -->
1544
1544
  <xsl:template name="show-recipientType">
1545
1545
  <xsl:param name="typeCode"/>
1546
1546
  <xsl:choose>
1547
1547
  <xsl:when test="$typeCode='PRCP'">Primary Recipient:</xsl:when>
1548
1548
  <xsl:when test="$typeCode='TRC'">Secondary Recipient:</xsl:when>
1549
1549
  <xsl:otherwise>Recipient:</xsl:otherwise>
1550
1550
  </xsl:choose>
1551
1551
  </xsl:template>
1552
1552
  <!-- Convert Telecom URL to display text -->
1553
1553
  <xsl:template name="translateTelecomCode">
1554
1554
  <xsl:param name="code"/>
1555
1555
  <!--xsl:value-of select="document('voc.xml')/systems/system[@root=$code/@codeSystem]/code[@value=$code/@code]/@displayName"/-->
1556
1556
  <!--xsl:value-of select="document('codes.xml')/*/code[@code=$code]/@display"/-->
1557
1557
  <xsl:choose>
1558
1558
  <!-- lookup table Telecom URI -->
1559
1559
  <xsl:when test="$code='tel'">
1560
1560
  <xsl:text>Tel</xsl:text>
1561
1561
  </xsl:when>
1562
1562
  <xsl:when test="$code='fax'">
1563
1563
  <xsl:text>Fax</xsl:text>
1564
1564
  </xsl:when>
1565
1565
  <xsl:when test="$code='http'">
1566
1566
  <xsl:text>Web</xsl:text>
1567
1567
  </xsl:when>
1568
1568
  <xsl:when test="$code='mailto'">
1569
1569
  <xsl:text>Mail</xsl:text>
1570
1570
  </xsl:when>
1571
1571
  <xsl:when test="$code='H'">
1572
1572
  <xsl:text>Home</xsl:text>
1573
1573
  </xsl:when>
1574
1574
  <xsl:when test="$code='HV'">
1575
1575
  <xsl:text>Vacation Home</xsl:text>
1576
1576
  </xsl:when>
1577
1577
  <xsl:when test="$code='HP'">
1578
1578
  <xsl:text>Pirmary Home</xsl:text>
1579
1579
  </xsl:when>
1580
1580
  <xsl:when test="$code='WP'">
1581
1581
  <xsl:text>Work Place</xsl:text>
1582
1582
  </xsl:when>
1583
1583
  <xsl:when test="$code='PUB'">
1584
1584
  <xsl:text>Pub</xsl:text>
1585
1585
  </xsl:when>
1586
1586
  <xsl:otherwise>
1587
1587
  <xsl:text>{$code='</xsl:text>
1588
1588
  <xsl:value-of select="$code"/>
1589
1589
  <xsl:text>'?}</xsl:text>
1590
1590
  </xsl:otherwise>
1591
1591
  </xsl:choose>
1592
1592
  </xsl:template>
1593
1593
  <!-- convert RoleClassAssociative code to display text -->
1594
1594
  <xsl:template name="translateRoleAssoCode">
1595
1595
  <xsl:param name="classCode"/>
1596
1596
  <xsl:param name="code"/>
1597
1597
  <xsl:choose>
1598
1598
  <xsl:when test="$classCode='AFFL'">
1599
1599
  <xsl:text>affiliate</xsl:text>
1600
1600
  </xsl:when>
1601
1601
  <xsl:when test="$classCode='AGNT'">
1602
1602
  <xsl:text>agent</xsl:text>
1603
1603
  </xsl:when>
1604
1604
  <xsl:when test="$classCode='ASSIGNED'">
1605
1605
  <xsl:text>assigned entity</xsl:text>
1606
1606
  </xsl:when>
1607
1607
  <xsl:when test="$classCode='COMPAR'">
1608
1608
  <xsl:text>commissioning party</xsl:text>
1609
1609
  </xsl:when>
1610
1610
  <xsl:when test="$classCode='CON'">
1611
1611
  <xsl:text>contact</xsl:text>
1612
1612
  </xsl:when>
1613
1613
  <xsl:when test="$classCode='ECON'">
1614
1614
  <xsl:text>emergency contact</xsl:text>
1615
1615
  </xsl:when>
1616
1616
  <xsl:when test="$classCode='NOK'">
1617
1617
  <xsl:text>next of kin</xsl:text>
1618
1618
  </xsl:when>
1619
1619
  <xsl:when test="$classCode='SGNOFF'">
1620
1620
  <xsl:text>signing authority</xsl:text>
1621
1621
  </xsl:when>
1622
1622
  <xsl:when test="$classCode='GUARD'">
1623
1623
  <xsl:text>guardian</xsl:text>
1624
1624
  </xsl:when>
1625
1625
  <xsl:when test="$classCode='GUAR'">
1626
1626
  <xsl:text>guardian</xsl:text>
1627
1627
  </xsl:when>
1628
1628
  <xsl:when test="$classCode='CIT'">
1629
1629
  <xsl:text>citizen</xsl:text>
1630
1630
  </xsl:when>
1631
1631
  <xsl:when test="$classCode='COVPTY'">
1632
1632
  <xsl:text>covered party</xsl:text>
1633
1633
  </xsl:when>
1634
1634
  <xsl:when test="$classCode='PRS'">
1635
1635
  <xsl:text>personal relationship</xsl:text>
1636
1636
  </xsl:when>
1637
1637
  <xsl:when test="$classCode='CAREGIVER'">
1638
1638
  <xsl:text>care giver</xsl:text>
1639
1639
  </xsl:when>
1640
1640
  <xsl:otherwise>
1641
1641
  <xsl:text>{$classCode='</xsl:text>
1642
1642
  <xsl:value-of select="$classCode"/>
1643
1643
  <xsl:text>'?}</xsl:text>
1644
1644
  </xsl:otherwise>
1645
1645
  </xsl:choose>
1646
1646
  <xsl:if test="($code/@code) and ($code/@codeSystem='2.16.840.1.113883.5.111')">
1647
1647
  <xsl:text> </xsl:text>
1648
1648
  <xsl:choose>
1649
1649
  <xsl:when test="$code/@code='FTH'">
1650
1650
  <xsl:text>(Father)</xsl:text>
1651
1651
  </xsl:when>
1652
1652
  <xsl:when test="$code/@code='MTH'">
1653
1653
  <xsl:text>(Mother)</xsl:text>
1654
1654
  </xsl:when>
1655
1655
  <xsl:when test="$code/@code='NPRN'">
1656
1656
  <xsl:text>(Natural parent)</xsl:text>
1657
1657
  </xsl:when>
1658
1658
  <xsl:when test="$code/@code='STPPRN'">
1659
1659
  <xsl:text>(Step parent)</xsl:text>
1660
1660
  </xsl:when>
1661
1661
  <xsl:when test="$code/@code='SONC'">
1662
1662
  <xsl:text>(Son)</xsl:text>
1663
1663
  </xsl:when>
1664
1664
  <xsl:when test="$code/@code='DAUC'">
1665
1665
  <xsl:text>(Daughter)</xsl:text>
1666
1666
  </xsl:when>
1667
1667
  <xsl:when test="$code/@code='CHILD'">
1668
1668
  <xsl:text>(Child)</xsl:text>
1669
1669
  </xsl:when>
1670
1670
  <xsl:when test="$code/@code='EXT'">
1671
1671
  <xsl:text>(Extended family member)</xsl:text>
1672
1672
  </xsl:when>
1673
1673
  <xsl:when test="$code/@code='NBOR'">
1674
1674
  <xsl:text>(Neighbor)</xsl:text>
1675
1675
  </xsl:when>
1676
1676
  <xsl:when test="$code/@code='SIGOTHR'">
1677
1677
  <xsl:text>(Significant other)</xsl:text>
1678
1678
  </xsl:when>
1679
1679
  <xsl:otherwise>
1680
1680
  <xsl:text>{$code/@code='</xsl:text>
1681
1681
  <xsl:value-of select="$code/@code"/>
1682
1682
  <xsl:text>'?}</xsl:text>
1683
1683
  </xsl:otherwise>
1684
1684
  </xsl:choose>
1685
1685
  </xsl:if>
1686
1686
  </xsl:template>
1687
1687
  <!-- show time -->
1688
1688
  <xsl:template name="show-time">
1689
1689
  <xsl:param name="datetime"/>
1690
1690
  <xsl:choose>
1691
1691
  <xsl:when test="not($datetime)">
1692
1692
  <xsl:call-template name="formatDateTime">
1693
1693
  <xsl:with-param name="date" select="@value"/>
1694
1694
  </xsl:call-template>
1695
1695
  <xsl:text> </xsl:text>
1696
1696
  </xsl:when>
1697
1697
  <xsl:otherwise>
1698
1698
  <xsl:call-template name="formatDateTime">
1699
1699
  <xsl:with-param name="date" select="$datetime/@value"/>
1700
1700
  </xsl:call-template>
1701
1701
  <xsl:text> </xsl:text>
1702
1702
  </xsl:otherwise>
1703
1703
  </xsl:choose>
1704
1704
  </xsl:template>
1705
1705
  <!-- paticipant facility and date -->
1706
1706
  <xsl:template name="facilityAndDates">
1707
1707
  <table class="header_table">
1708
1708
  <tbody>
1709
1709
  <!-- facility id -->
1710
1710
  <tr>
1711
1711
  <td width="20%" bgcolor="#3399ff">
1712
1712
  <span class="td_label">
1713
1713
  <xsl:text>Facility ID</xsl:text>
1714
1714
  </span>
1715
1715
  </td>
1716
1716
  <td colspan="3">
1717
1717
  <xsl:choose>
1718
1718
  <xsl:when test="count(/n1:ClinicalDocument/n1:participant
1719
1719
  [@typeCode='LOC'][@contextControlCode='OP']
1720
1720
  /n1:associatedEntity[@classCode='SDLOC']/n1:id)&gt;0">
1721
1721
  <!-- change context node -->
1722
1722
  <xsl:for-each select="/n1:ClinicalDocument/n1:participant
1723
1723
  [@typeCode='LOC'][@contextControlCode='OP']
1724
1724
  /n1:associatedEntity[@classCode='SDLOC']/n1:id">
1725
1725
  <xsl:call-template name="show-id"/>
1726
1726
  <!-- change context node again, for the code -->
1727
1727
  <xsl:for-each select="../n1:code">
1728
1728
  <xsl:text> (</xsl:text>
1729
1729
  <xsl:call-template name="show-code">
1730
1730
  <xsl:with-param name="code" select="."/>
1731
1731
  </xsl:call-template>
1732
1732
  <xsl:text>)</xsl:text>
1733
1733
  </xsl:for-each>
1734
1734
  </xsl:for-each>
1735
1735
  </xsl:when>
1736
1736
  <xsl:otherwise>
1737
1737
  Not available
1738
1738
  </xsl:otherwise>
1739
1739
  </xsl:choose>
1740
1740
  </td>
1741
1741
  </tr>
1742
1742
  <!-- Period reported -->
1743
1743
  <tr>
1744
1744
  <td width="20%" bgcolor="#3399ff">
1745
1745
  <span class="td_label">
1746
1746
  <xsl:text>First day of period reported</xsl:text>
1747
1747
  </span>
1748
1748
  </td>
1749
1749
  <td colspan="3">
1750
1750
  <xsl:call-template name="show-time">
1751
1751
  <xsl:with-param name="datetime" select="/n1:ClinicalDocument/n1:documentationOf
1752
1752
  /n1:serviceEvent/n1:effectiveTime/n1:low"/>
1753
1753
  </xsl:call-template>
1754
1754
  </td>
1755
1755
  </tr>
1756
1756
  <tr>
1757
1757
  <td width="20%" bgcolor="#3399ff">
1758
1758
  <span class="td_label">
1759
1759
  <xsl:text>Last day of period reported</xsl:text>
1760
1760
  </span>
1761
1761
  </td>
1762
1762
  <td colspan="3">
1763
1763
  <xsl:call-template name="show-time">
1764
1764
  <xsl:with-param name="datetime" select="/n1:ClinicalDocument/n1:documentationOf
1765
1765
  /n1:serviceEvent/n1:effectiveTime/n1:high"/>
1766
1766
  </xsl:call-template>
1767
1767
  </td>
1768
1768
  </tr>
1769
1769
  </tbody>
1770
1770
  </table>
1771
1771
  </xsl:template>
1772
1772
  <!-- show assignedEntity -->
1773
1773
  <xsl:template name="show-assignedEntity">
1774
1774
  <xsl:param name="asgnEntity"/>
1775
1775
  <xsl:choose>
1776
1776
  <xsl:when test="$asgnEntity/n1:assignedPerson/n1:name">
1777
1777
  <xsl:call-template name="show-name">
1778
1778
  <xsl:with-param name="name" select="$asgnEntity/n1:assignedPerson/n1:name"/>
1779
1779
  </xsl:call-template>
1780
1780
  <xsl:if test="$asgnEntity/n1:representedOrganization/n1:name">
1781
1781
  <xsl:text> of </xsl:text>
1782
1782
  <xsl:value-of select="$asgnEntity/n1:representedOrganization/n1:name"/>
1783
1783
  </xsl:if>
1784
1784
  </xsl:when>
1785
1785
  <xsl:when test="$asgnEntity/n1:representedOrganization">
1786
1786
  <xsl:value-of select="$asgnEntity/n1:representedOrganization/n1:name"/>
1787
1787
  </xsl:when>
1788
1788
  <xsl:otherwise>
1789
1789
  <xsl:for-each select="$asgnEntity/n1:id">
1790
1790
  <xsl:call-template name="show-id"/>
1791
1791
  <xsl:choose>
1792
1792
  <xsl:when test="position()!=last()">
1793
1793
  <xsl:text>, </xsl:text>
1794
1794
  </xsl:when>
1795
1795
  <xsl:otherwise>
1796
1796
  <br/>
1797
1797
  </xsl:otherwise>
1798
1798
  </xsl:choose>
1799
1799
  </xsl:for-each>
1800
1800
  </xsl:otherwise>
1801
1801
  </xsl:choose>
1802
1802
  </xsl:template>
1803
1803
  <!-- show relatedEntity -->
1804
1804
  <xsl:template name="show-relatedEntity">
1805
1805
  <xsl:param name="relatedEntity"/>
1806
1806
  <xsl:choose>
1807
1807
  <xsl:when test="$relatedEntity/n1:relatedPerson/n1:name">
1808
1808
  <xsl:call-template name="show-name">
1809
1809
  <xsl:with-param name="name" select="$relatedEntity/n1:relatedPerson/n1:name"/>
1810
1810
  </xsl:call-template>
1811
1811
  </xsl:when>
1812
1812
  </xsl:choose>
1813
1813
  </xsl:template>
1814
1814
  <!-- show associatedEntity -->
1815
1815
  <xsl:template name="show-associatedEntity">
1816
1816
  <xsl:param name="assoEntity"/>
1817
1817
  <xsl:choose>
1818
1818
  <xsl:when test="$assoEntity/n1:associatedPerson">
1819
1819
  <xsl:for-each select="$assoEntity/n1:associatedPerson/n1:name">
1820
1820
  <xsl:call-template name="show-name">
1821
1821
  <xsl:with-param name="name" select="."/>
1822
1822
  </xsl:call-template>
1823
1823
  <br/>
1824
1824
  </xsl:for-each>
1825
1825
  </xsl:when>
1826
1826
  <xsl:when test="$assoEntity/n1:scopingOrganization">
1827
1827
  <xsl:for-each select="$assoEntity/n1:scopingOrganization">
1828
1828
  <xsl:if test="n1:name">
1829
1829
  <xsl:call-template name="show-name">
1830
1830
  <xsl:with-param name="name" select="n1:name"/>
1831
1831
  </xsl:call-template>
1832
1832
  <br/>
1833
1833
  </xsl:if>
1834
1834
  <xsl:if test="n1:standardIndustryClassCode">
1835
1835
  <xsl:value-of select="n1:standardIndustryClassCode/@displayName"/>
1836
1836
  <xsl:text> code:</xsl:text>
1837
1837
  <xsl:value-of select="n1:standardIndustryClassCode/@code"/>
1838
1838
  </xsl:if>
1839
1839
  </xsl:for-each>
1840
1840
  </xsl:when>
1841
1841
  <xsl:when test="$assoEntity/n1:code">
1842
1842
  <xsl:call-template name="show-code">
1843
1843
  <xsl:with-param name="code" select="$assoEntity/n1:code"/>
1844
1844
  </xsl:call-template>
1845
1845
  </xsl:when>
1846
1846
  <xsl:when test="$assoEntity/n1:id">
1847
1847
  <xsl:value-of select="$assoEntity/n1:id/@extension"/>
1848
1848
  <xsl:text> </xsl:text>
1849
1849
  <xsl:value-of select="$assoEntity/n1:id/@root"/>
1850
1850
  </xsl:when>
1851
1851
  </xsl:choose>
1852
1852
  </xsl:template>
1853
1853
  <!-- show code
1854
1854
  if originalText present, return it, otherwise, check and return attribute: display name
1855
1855
  -->
1856
1856
  <xsl:template name="show-code">
1857
1857
  <xsl:param name="code"/>
1858
1858
  <xsl:variable name="this-codeSystem">
1859
1859
  <xsl:value-of select="$code/@codeSystem"/>
1860
1860
  </xsl:variable>
1861
1861
  <xsl:variable name="this-code">
1862
1862
  <xsl:value-of select="$code/@code"/>
1863
1863
  </xsl:variable>
1864
1864
  <xsl:choose>
1865
1865
  <xsl:when test="$code/n1:originalText">
1866
1866
  <xsl:value-of select="$code/n1:originalText"/>
1867
1867
  </xsl:when>
1868
1868
  <xsl:when test="$code/@displayName">
1869
1869
  <xsl:value-of select="$code/@displayName"/>
1870
1870
  </xsl:when>
1871
1871
  <!--
1872
1872
  <xsl:when test="$the-valuesets/*/voc:system[@root=$this-codeSystem]/voc:code[@value=$this-code]/@displayName">
1873
1873
  <xsl:value-of select="$the-valuesets/*/voc:system[@root=$this-codeSystem]/voc:code[@value=$this-code]/@displayName"/>
1874
1874
  </xsl:when>
1875
1875
  -->
1876
1876
  <xsl:otherwise>
1877
1877
  <xsl:value-of select="$this-code"/>
1878
1878
  </xsl:otherwise>
1879
1879
  </xsl:choose>
1880
1880
  </xsl:template>
1881
1881
  <!-- show classCode -->
1882
1882
  <xsl:template name="show-actClassCode">
1883
1883
  <xsl:param name="clsCode"/>
1884
1884
  <xsl:choose>
1885
1885
  <xsl:when test=" $clsCode = 'ACT' ">
1886
1886
  <xsl:text>healthcare service</xsl:text>
1887
1887
  </xsl:when>
1888
1888
  <xsl:when test=" $clsCode = 'ACCM' ">
1889
1889
  <xsl:text>accommodation</xsl:text>
1890
1890
  </xsl:when>
1891
1891
  <xsl:when test=" $clsCode = 'ACCT' ">
1892
1892
  <xsl:text>account</xsl:text>
1893
1893
  </xsl:when>
1894
1894
  <xsl:when test=" $clsCode = 'ACSN' ">
1895
1895
  <xsl:text>accession</xsl:text>
1896
1896
  </xsl:when>
1897
1897
  <xsl:when test=" $clsCode = 'ADJUD' ">
1898
1898
  <xsl:text>financial adjudication</xsl:text>
1899
1899
  </xsl:when>
1900
1900
  <xsl:when test=" $clsCode = 'CONS' ">
1901
1901
  <xsl:text>consent</xsl:text>
1902
1902
  </xsl:when>
1903
1903
  <xsl:when test=" $clsCode = 'CONTREG' ">
1904
1904
  <xsl:text>container registration</xsl:text>
1905
1905
  </xsl:when>
1906
1906
  <xsl:when test=" $clsCode = 'CTTEVENT' ">
1907
1907
  <xsl:text>clinical trial timepoint event</xsl:text>
1908
1908
  </xsl:when>
1909
1909
  <xsl:when test=" $clsCode = 'DISPACT' ">
1910
1910
  <xsl:text>disciplinary action</xsl:text>
1911
1911
  </xsl:when>
1912
1912
  <xsl:when test=" $clsCode = 'ENC' ">
1913
1913
  <xsl:text>encounter</xsl:text>
1914
1914
  </xsl:when>
1915
1915
  <xsl:when test=" $clsCode = 'INC' ">
1916
1916
  <xsl:text>incident</xsl:text>
1917
1917
  </xsl:when>
1918
1918
  <xsl:when test=" $clsCode = 'INFRM' ">
1919
1919
  <xsl:text>inform</xsl:text>
1920
1920
  </xsl:when>
1921
1921
  <xsl:when test=" $clsCode = 'INVE' ">
1922
1922
  <xsl:text>invoice element</xsl:text>
1923
1923
  </xsl:when>
1924
1924
  <xsl:when test=" $clsCode = 'LIST' ">
1925
1925
  <xsl:text>working list</xsl:text>
1926
1926
  </xsl:when>
1927
1927
  <xsl:when test=" $clsCode = 'MPROT' ">
1928
1928
  <xsl:text>monitoring program</xsl:text>
1929
1929
  </xsl:when>
1930
1930
  <xsl:when test=" $clsCode = 'PCPR' ">
1931
1931
  <xsl:text>care provision</xsl:text>
1932
1932
  </xsl:when>
1933
1933
  <xsl:when test=" $clsCode = 'PROC' ">
1934
1934
  <xsl:text>procedure</xsl:text>
1935
1935
  </xsl:when>
1936
1936
  <xsl:when test=" $clsCode = 'REG' ">
1937
1937
  <xsl:text>registration</xsl:text>
1938
1938
  </xsl:when>
1939
1939
  <xsl:when test=" $clsCode = 'REV' ">
1940
1940
  <xsl:text>review</xsl:text>
1941
1941
  </xsl:when>
1942
1942
  <xsl:when test=" $clsCode = 'SBADM' ">
1943
1943
  <xsl:text>substance administration</xsl:text>
1944
1944
  </xsl:when>
1945
1945
  <xsl:when test=" $clsCode = 'SPCTRT' ">
1946
1946
  <xsl:text>speciment treatment</xsl:text>
1947
1947
  </xsl:when>
1948
1948
  <xsl:when test=" $clsCode = 'SUBST' ">
1949
1949
  <xsl:text>substitution</xsl:text>
1950
1950
  </xsl:when>
1951
1951
  <xsl:when test=" $clsCode = 'TRNS' ">
1952
1952
  <xsl:text>transportation</xsl:text>
1953
1953
  </xsl:when>
1954
1954
  <xsl:when test=" $clsCode = 'VERIF' ">
1955
1955
  <xsl:text>verification</xsl:text>
1956
1956
  </xsl:when>
1957
1957
  <xsl:when test=" $clsCode = 'XACT' ">
1958
1958
  <xsl:text>financial transaction</xsl:text>
1959
1959
  </xsl:when>
1960
1960
  </xsl:choose>
1961
1961
  </xsl:template>
1962
1962
  <!-- show participationType -->
1963
1963
  <xsl:template name="show-participationType">
1964
1964
  <xsl:param name="ptype"/>
1965
1965
  <xsl:choose>
1966
1966
  <xsl:when test=" $ptype='PPRF' ">
1967
1967
  <xsl:text>primary performer</xsl:text>
1968
1968
  </xsl:when>
1969
1969
  <xsl:when test=" $ptype='PRF' ">
1970
1970
  <xsl:text>performer</xsl:text>
1971
1971
  </xsl:when>
1972
1972
  <xsl:when test=" $ptype='VRF' ">
1973
1973
  <xsl:text>verifier</xsl:text>
1974
1974
  </xsl:when>
1975
1975
  <xsl:when test=" $ptype='SPRF' ">
1976
1976
  <xsl:text>secondary performer</xsl:text>
1977
1977
  </xsl:when>
1978
1978
  </xsl:choose>
1979
1979
  </xsl:template>
1980
1980
  <!-- show participationFunction -->
1981
1981
  <xsl:template name="show-participationFunction">
1982
1982
  <xsl:param name="pFunction"/>
1983
1983
  <xsl:choose>
1984
1984
  <!-- From the HL7 v3 ParticipationFunction code system -->
1985
1985
  <xsl:when test=" $pFunction = 'ADMPHYS' ">
1986
1986
  <xsl:text>(admitting physician)</xsl:text>
1987
1987
  </xsl:when>
1988
1988
  <xsl:when test=" $pFunction = 'ANEST' ">
1989
1989
  <xsl:text>(anesthesist)</xsl:text>
1990
1990
  </xsl:when>
1991
1991
  <xsl:when test=" $pFunction = 'ANRS' ">
1992
1992
  <xsl:text>(anesthesia nurse)</xsl:text>
1993
1993
  </xsl:when>
1994
1994
  <xsl:when test=" $pFunction = 'ATTPHYS' ">
1995
1995
  <xsl:text>(attending physician)</xsl:text>
1996
1996
  </xsl:when>
1997
1997
  <xsl:when test=" $pFunction = 'DISPHYS' ">
1998
1998
  <xsl:text>(discharging physician)</xsl:text>
1999
1999
  </xsl:when>
2000
2000
  <xsl:when test=" $pFunction = 'FASST' ">
2001
2001
  <xsl:text>(first assistant surgeon)</xsl:text>
2002
2002
  </xsl:when>
2003
2003
  <xsl:when test=" $pFunction = 'MDWF' ">
2004
2004
  <xsl:text>(midwife)</xsl:text>
2005
2005
  </xsl:when>
2006
2006
  <xsl:when test=" $pFunction = 'NASST' ">
2007
2007
  <xsl:text>(nurse assistant)</xsl:text>
2008
2008
  </xsl:when>
2009
2009
  <xsl:when test=" $pFunction = 'PCP' ">
2010
2010
  <xsl:text>(primary care physician)</xsl:text>
2011
2011
  </xsl:when>
2012
2012
  <xsl:when test=" $pFunction = 'PRISURG' ">
2013
2013
  <xsl:text>(primary surgeon)</xsl:text>
2014
2014
  </xsl:when>
2015
2015
  <xsl:when test=" $pFunction = 'RNDPHYS' ">
2016
2016
  <xsl:text>(rounding physician)</xsl:text>
2017
2017
  </xsl:when>
2018
2018
  <xsl:when test=" $pFunction = 'SASST' ">
2019
2019
  <xsl:text>(second assistant surgeon)</xsl:text>
2020
2020
  </xsl:when>
2021
2021
  <xsl:when test=" $pFunction = 'SNRS' ">
2022
2022
  <xsl:text>(scrub nurse)</xsl:text>
2023
2023
  </xsl:when>
2024
2024
  <xsl:when test=" $pFunction = 'TASST' ">
2025
2025
  <xsl:text>(third assistant)</xsl:text>
2026
2026
  </xsl:when>
2027
2027
  <!-- From the HL7 v2 Provider Role code system (2.16.840.1.113883.12.443) which is used by HITSP -->
2028
2028
  <xsl:when test=" $pFunction = 'CP' ">
2029
2029
  <xsl:text>(consulting provider)</xsl:text>
2030
2030
  </xsl:when>
2031
2031
  <xsl:when test=" $pFunction = 'PP' ">
2032
2032
  <xsl:text>(primary care provider)</xsl:text>
2033
2033
  </xsl:when>
2034
2034
  <xsl:when test=" $pFunction = 'RP' ">
2035
2035
  <xsl:text>(referring provider)</xsl:text>
2036
2036
  </xsl:when>
2037
2037
  <xsl:when test=" $pFunction = 'MP' ">
2038
2038
  <xsl:text>(medical home provider)</xsl:text>
2039
2039
  </xsl:when>
2040
2040
  </xsl:choose>
2041
2041
  </xsl:template>
2042
2042
  <xsl:template name="formatDateTime">
2043
2043
  <xsl:param name="date"/>
2044
2044
  <!-- month -->
2045
2045
  <xsl:variable name="month" select="substring ($date, 5, 2)"/>
2046
2046
  <xsl:choose>
2047
2047
  <xsl:when test="$month='01'">
2048
2048
  <xsl:text>January </xsl:text>
2049
2049
  </xsl:when>
2050
2050
  <xsl:when test="$month='02'">
2051
2051
  <xsl:text>February </xsl:text>
2052
2052
  </xsl:when>
2053
2053
  <xsl:when test="$month='03'">
2054
2054
  <xsl:text>March </xsl:text>
2055
2055
  </xsl:when>
2056
2056
  <xsl:when test="$month='04'">
2057
2057
  <xsl:text>April </xsl:text>
2058
2058
  </xsl:when>
2059
2059
  <xsl:when test="$month='05'">
2060
2060
  <xsl:text>May </xsl:text>
2061
2061
  </xsl:when>
2062
2062
  <xsl:when test="$month='06'">
2063
2063
  <xsl:text>June </xsl:text>
2064
2064
  </xsl:when>
2065
2065
  <xsl:when test="$month='07'">
2066
2066
  <xsl:text>July </xsl:text>
2067
2067
  </xsl:when>
2068
2068
  <xsl:when test="$month='08'">
2069
2069
  <xsl:text>August </xsl:text>
2070
2070
  </xsl:when>
2071
2071
  <xsl:when test="$month='09'">
2072
2072
  <xsl:text>September </xsl:text>
2073
2073
  </xsl:when>
2074
2074
  <xsl:when test="$month='10'">
2075
2075
  <xsl:text>October </xsl:text>
2076
2076
  </xsl:when>
2077
2077
  <xsl:when test="$month='11'">
2078
2078
  <xsl:text>November </xsl:text>
2079
2079
  </xsl:when>
2080
2080
  <xsl:when test="$month='12'">
2081
2081
  <xsl:text>December </xsl:text>
2082
2082
  </xsl:when>
2083
2083
  </xsl:choose>
2084
2084
  <!-- day -->
2085
2085
  <xsl:choose>
2086
2086
  <xsl:when test='substring ($date, 7, 1)="0"'>
2087
2087
  <xsl:value-of select="substring ($date, 8, 1)"/>
2088
2088
  <xsl:text>, </xsl:text>
2089
2089
  </xsl:when>
2090
2090
  <xsl:otherwise>
2091
2091
  <xsl:value-of select="substring ($date, 7, 2)"/>
2092
2092
  <xsl:text>, </xsl:text>
2093
2093
  </xsl:otherwise>
2094
2094
  </xsl:choose>
2095
2095
  <!-- year -->
2096
2096
  <xsl:value-of select="substring ($date, 1, 4)"/>
2097
2097
  <!-- time and US timezone -->
2098
2098
  <xsl:if test="string-length($date) > 8">
2099
2099
  <xsl:text>, </xsl:text>
2100
2100
  <!-- time -->
2101
2101
  <xsl:variable name="time">
2102
2102
  <xsl:value-of select="substring($date,9,6)"/>
2103
2103
  </xsl:variable>
2104
2104
  <xsl:variable name="hh">
2105
2105
  <xsl:value-of select="substring($time,1,2)"/>
2106
2106
  </xsl:variable>
2107
2107
  <xsl:variable name="mm">
2108
2108
  <xsl:value-of select="substring($time,3,2)"/>
2109
2109
  </xsl:variable>
2110
2110
  <xsl:variable name="ss">
2111
2111
  <xsl:value-of select="substring($time,5,2)"/>
2112
2112
  </xsl:variable>
2113
2113
  <xsl:if test="string-length($hh)&gt;1">
2114
2114
  <xsl:value-of select="$hh"/>
2115
2115
  <xsl:if test="string-length($mm)&gt;1 and not(contains($mm,'-')) and not (contains($mm,'+'))">
2116
2116
  <xsl:text>:</xsl:text>
2117
2117
  <xsl:value-of select="$mm"/>
2118
2118
  <xsl:if test="string-length($ss)&gt;1 and not(contains($ss,'-')) and not (contains($ss,'+'))">
2119
2119
  <xsl:text>:</xsl:text>
2120
2120
  <xsl:value-of select="$ss"/>
2121
2121
  </xsl:if>
2122
2122
  </xsl:if>
2123
2123
  </xsl:if>
2124
2124
  <!-- time zone -->
2125
2125
  <xsl:variable name="tzon">
2126
2126
  <xsl:choose>
2127
2127
  <xsl:when test="contains($date,'+')">
2128
2128
  <xsl:text>+</xsl:text>
2129
2129
  <xsl:value-of select="substring-after($date, '+')"/>
2130
2130
  </xsl:when>
2131
2131
  <xsl:when test="contains($date,'-')">
2132
2132
  <xsl:text>-</xsl:text>
2133
2133
  <xsl:value-of select="substring-after($date, '-')"/>
2134
2134
  </xsl:when>
2135
2135
  </xsl:choose>
2136
2136
  </xsl:variable>
2137
2137
  <xsl:choose>
2138
2138
  <!-- reference: http://www.timeanddate.com/library/abbreviations/timezones/na/ -->
2139
2139
  <xsl:when test="$tzon = '-0500' ">
2140
2140
  <xsl:text>, EST</xsl:text>
2141
2141
  </xsl:when>
2142
2142
  <xsl:when test="$tzon = '-0600' ">
2143
2143
  <xsl:text>, CST</xsl:text>
2144
2144
  </xsl:when>
2145
2145
  <xsl:when test="$tzon = '-0700' ">
2146
2146
  <xsl:text>, MST</xsl:text>
2147
2147
  </xsl:when>
2148
2148
  <xsl:when test="$tzon = '-0800' ">
2149
2149
  <xsl:text>, PST</xsl:text>
2150
2150
  </xsl:when>
2151
2151
  <xsl:otherwise>
2152
2152
  <xsl:text> </xsl:text>
2153
2153
  <xsl:value-of select="$tzon"/>
2154
2154
  </xsl:otherwise>
2155
2155
  </xsl:choose>
2156
2156
  </xsl:if>
2157
2157
  </xsl:template>
2158
2158
  <!-- convert to lower case -->
2159
2159
  <xsl:template name="caseDown">
2160
2160
  <xsl:param name="data"/>
2161
2161
  <xsl:if test="$data">
2162
2162
  <xsl:value-of select="translate($data, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ','abcdefghijklmnopqrstuvwxyz')"/>
2163
2163
  </xsl:if>
2164
2164
  </xsl:template>
2165
2165
  <!-- convert to upper case -->
2166
2166
  <xsl:template name="caseUp">
2167
2167
  <xsl:param name="data"/>
2168
2168
  <xsl:if test="$data">
2169
2169
  <xsl:value-of select="translate($data,'abcdefghijklmnopqrstuvwxyz', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ')"/>
2170
2170
  </xsl:if>
2171
2171
  </xsl:template>
2172
2172
  <!-- convert first character to upper case -->
2173
2173
  <xsl:template name="firstCharCaseUp">
2174
2174
  <xsl:param name="data"/>
2175
2175
  <xsl:if test="$data">
2176
2176
  <xsl:call-template name="caseUp">
2177
2177
  <xsl:with-param name="data" select="substring($data,1,1)"/>
2178
2178
  </xsl:call-template>
2179
2179
  <xsl:value-of select="substring($data,2)"/>
2180
2180
  </xsl:if>
2181
2181
  </xsl:template>
2182
2182
  <!-- show-noneFlavor -->
2183
2183
  <xsl:template name="show-noneFlavor">
2184
2184
  <xsl:param name="nf"/>
2185
2185
  <xsl:choose>
2186
2186
  <xsl:when test=" $nf = 'NI' ">
2187
2187
  <xsl:text>no information</xsl:text>
2188
2188
  </xsl:when>
2189
2189
  <xsl:when test=" $nf = 'INV' ">
2190
2190
  <xsl:text>invalid</xsl:text>
2191
2191
  </xsl:when>
2192
2192
  <xsl:when test=" $nf = 'MSK' ">
2193
2193
  <xsl:text>masked</xsl:text>
2194
2194
  </xsl:when>
2195
2195
  <xsl:when test=" $nf = 'NA' ">
2196
2196
  <xsl:text>not applicable</xsl:text>
2197
2197
  </xsl:when>
2198
2198
  <xsl:when test=" $nf = 'UNK' ">
2199
2199
  <xsl:text>unknown</xsl:text>
2200
2200
  </xsl:when>
2201
2201
  <xsl:when test=" $nf = 'OTH' ">
2202
2202
  <xsl:text>other</xsl:text>
2203
2203
  </xsl:when>
2204
2204
  </xsl:choose>
2205
2205
  </xsl:template>
2206
2206
  <xsl:template name="addCSS">
2207
2207
  <style type="text/css">
2208
2208
  <xsl:text>
2209
2209
  color: #003366;
2210
2210
  background-color: #FFFFFF;
2211
2211
  font-family: Verdana, Tahoma, sans-serif;
2212
2212
  font-size: 11px;
2213
2213
  color: #003366;
2214
2214
  background-color: #FFFFFF;
2215
2215
  font-size: 12pt;
2216
2216
  font-weight: bold;
2217
2217
  font-size: 11pt;
2218
2218
  font-weight: bold;
2219
2219
  font-size: 10pt;
2220
2220
  font-weight: bold;
2221
2221
  font-size: 8pt;
2222
2222
  font-weight: bold;
2223
2223
  width: 80%;
2224
2224
  line-height: 10pt;
2225
2225
  width: 80%;
2226
2226
  background-color: #ccccff;
2227
2227
  padding: 0.1cm 0.2cm;
2228
2228
  vertical-align: top;
2229
2229
  font-size: 12pt;
2230
2230
  font-weight: bold;
2231
2231
  text-align: center;
2232
2232
  width: 80%;
2233
2233
  border: 1pt inset #00008b;
2234
2234
  width: 100%;
2235
2235
  background-color: #ffffcc;
2236
2236
  background-color: #ffd700;
2237
2237
  font-weight: bold;
2238
2238
  color: white;
2239
2239
  </xsl:text>
2240
2240
  </style>
2241
2241
  </xsl:template>