3172. EPMO Open Source Coordination Office Redaction File Detail Report

Produced by Araxis Merge on 6/9/2017 3:49:54 PM Eastern Daylight Time. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.

3172.1 Files compared

# Location File Last Modified
1 Fri Jun 9 19:49:54 2017 UTC
2 eHealth_Exch (eHealth Exchange Enhancements) Build 3 docs & code_May_2017.zip\VAP_CIF_CODE0502.zip\VAP_CIF_CODE0502\VAP_CIF_CODE0502\nvap-client\src\main\resources\gov\va\nvap\document\xsl\vistaweb\nhin nhinCommon.xsl Fri Apr 21 20:03:26 2017 UTC

3172.2 Comparison summary

Description Between
Files 1 and 2
Text Blocks Lines
Unchanged 0 0
Changed 0 0
Inserted 1 4195
Removed 0 0

3172.3 Comparison options

Whitespace
Character case Differences in character case are significant
Line endings Differences in line endings (CR and LF characters) are ignored
CR/LF characters Not shown in the comparison detail

3172.4 Active regular expressions

No regular expressions were active.

3172.5 Comparison detail

        1   <?xml 
        2     version="1 .0" 
        3     encoding=" UTF-8" 
        4   ?>
        5   <xsl:style sheet 
        6     version="1 .0"
        7           
        8     xmlns:xsl= "http://ww w.w3.org/1 999/XSL/Tr ansform"
        9           
        10     xmlns:xsi= "http://ww w.w3.org/2 001/XMLSch ema-instan ce"
        11           
        12     xmlns:n1=" urn:hl7-or g:v3"
        13     
        14     xmlns:ns=" urn:schema s-microsof t-com:xslt "
        15   >
        16    
        17             
        18     <!-- <xsl: import hre f="/gov/va /nvap/docu ment/xsl/v istaweb/nh in/formatt ing.xsl"/>  -->
        19             
        20     <!-- <xsl: import hre f="/gov/va /nvap/docu ment/xsl/v istaweb/co mmon.xsl"/ > -->
        21    
        22       
        23     <xsl:varia ble 
        24      name="isIH IE" 
        25      select="bo olean(/n1: ClinicalDo cument/n1: author/n1: assignedAu thor/n1:re presentedO rganizatio n/n1:id[@r oot='2.16. 840.1.1138 83.3.1181' ])"
        26     />
        27       
        28     <xsl:varia ble 
        29      name="isKa iser" 
        30      select="bo olean(/n1: ClinicalDo cument/n1: author/n1: assignedAu thor/n1:re presentedO rganizatio n/n1:id[@r oot='1.3.6 .1.4.1.265 80'])"
        31     />
        32             
        33     <xsl:varia ble 
        34      name="isDo D" 
        35      select="bo olean(/n1: ClinicalDo cument/n1: author/n1: assignedAu thor/n1:re presentedO rganizatio n/n1:id[@r oot='2.16. 840.1.1138 83.3.42.10 001.100001 .12'])"
        36     />
        37             
        38     <xsl:varia ble 
        39      name="isMV A" 
        40      select="bo olean(/n1: ClinicalDo cument/n1: author/n1: assignedAu thor/n1:re presentedO rganizatio n/n1:id[@r oot='2.16. 840.1.1138 83.3.190'] )"
        41     />
        42             
        43     <xsl:varia ble 
        44      name="isIN HS" 
        45      select="bo olean(/n1: ClinicalDo cument/n1: author/n1: assignedAu thor/n1:id [@root='2. 16.840.1.1 13883.3.71 5'])"
        46     />
        47             
        48     <xsl:varia ble 
        49      name="isMu ltiCare" 
        50      select="bo olean((/n1 :ClinicalD ocument/n1 :author/n1 :assignedA uthor/n1:r epresented Organizati on/n1:id[@ root='1.2. 840.114350 .1.13.60.2 .7.2.69657 0']) or (/ n1:Clinica lDocument/ n1:author/ n1:assigne dAuthor/n1 :represent edOrganiza tion/n1:id [@root='1. 2.840.1143 50.1.13.77 002.1.7.2. 696570'])) "
        51     />
        52             
        53     <xsl:varia ble 
        54      name="noMd oProb" 
        55      select="bo olean(/n1: ClinicalDo cument/n1: component/ n1:structu redBody/n1 :component /n1:sectio n/n1:entry /n1:act/n1 :entryRela tionship/n 1:observat ion/n1:val ue[@code=' 396782006' ])"
        56     />
        57             
        58     <xsl:varia ble 
        59      name="noMe d" 
        60      select="bo olean(/n1: ClinicalDo cument/n1: component/ n1:structu redBody/n1 :component /n1:sectio n/n1:entry /n1:substa nceAdminis tration/n1 :code[@cod e='1828490 00'])"
        61     />
        62             
        63     <xsl:varia ble 
        64      name="noMd oResult" 
        65      select="bo olean(/n1: ClinicalDo cument/n1: component/ n1:structu redBody/n1 :component /n1:sectio n/n1:entry /n1:organi zer/n1:cod e[@code='2 61665006'] )"
        66     />
        67             
        68     <xsl:varia ble 
        69      name="alle rgyNkaCode "
        70     >
        71      160244002
        72     </xsl:vari able>
        73    
        74             
        75     <xsl:templ ate 
        76      name="faci lityProper ty"
        77     >
        78                       
        79      <xsl:varia ble 
        80       name="root
        81       select="/n 1:Clinical Document"
        82      />
        83                       
        84      <Facility>
        85                                 
        86       <xsl:choos e>
        87                                           
        88        <xsl:when 
        89         test="$roo t/n1:custo dian/n1:as signedCust odian/n1:r epresented CustodianO rganizatio n/n1:name  and string -length($r oot/n1:cus todian/n1: assignedCu stodian/n1 :represent edCustodia nOrganizat ion/n1:nam e)>0"
        90        >
        91                                                    
        92         <xsl:value -of 
        93          select="$r oot/n1:cus todian/n1: assignedCu stodian/n1 :represent edCustodia nOrganizat ion/n1:nam e"
        94         />
        95                                            
        96        </xsl:when >
        97       
        98                                           
        99        <xsl:when 
        100         test="$roo t/n1:docum entationOf /n1:servic eEvent/n1: performer/ n1:assigne dEntity/n1 :represent edOrganiza tion/n1:na me and str ing-length ($root/n1: documentat ionOf/n1:s erviceEven t/n1:perfo rmer/n1:as signedEnti ty/n1:repr esentedOrg anization/ n1:name)>0 "
        101        >
        102                                                    
        103         <xsl:value -of 
        104          select="$r oot/n1:doc umentation Of/n1:serv iceEvent/n 1:performe r/n1:assig nedEntity/ n1:represe ntedOrgani zation/n1: name"
        105         />
        106                                            
        107        </xsl:when >
        108                                           
        109        <xsl:other wise/>
        110                                  
        111       </xsl:choo se>
        112                        
        113      </Facility >
        114     
        115              
        116     </xsl:temp late>
        117    
        118             
        119     <xsl:templ ate 
        120      name="gend erString"
        121     >
        122                       
        123      <xsl:param  
        124       name="sex"  
        125       select="'u nknown'"
        126      />
        127                       
        128      <xsl:choos e>
        129                                 
        130       <xsl:when 
        131        test="$sex ='M' or $s ex='m' or  $sex='Male ' or $sex= 'male'"
        132       >
        133                                           
        134        <xsl:text>
        135         Male
        136        </xsl:text >
        137                                  
        138       </xsl:when >
        139                                 
        140       <xsl:when 
        141        test="$sex ='F' or $s ex='f' or  $sex='Fema le' or $se x='female' "
        142       >
        143                                           
        144        <xsl:text>
        145         Female
        146        </xsl:text >
        147                                  
        148       </xsl:when >
        149                        
        150      </xsl:choo se>
        151              
        152     </xsl:temp late>
        153    
        154       
        155     <xsl:templ ate 
        156      name="disp layLanguag es"
        157     >
        158          
        159      <xsl:param  
        160       name="pati entRole"
        161      />
        162          
        163      <xsl:choos e>
        164             
        165       <xsl:when 
        166        test="stri ng-length( normalize- space($pat ientRole/n 1:patient/ n1:languag eCommunica tion/n1:la nguageCode /@code))>0 "
        167       >
        168                
        169        <xsl:apply -templates  
        170         select="$p atientRole /n1:patien t/n1:langu ageCommuni cation/n1: languageCo de"
        171        />
        172              
        173       </xsl:when >
        174           
        175      </xsl:choo se>
        176        
        177     </xsl:temp late>
        178    
        179             
        180     <xsl:templ ate 
        181      match="n1: languageCo de" 
        182      mode="data "
        183     >
        184                       
        185      <xsl:choos e>
        186                                 
        187       <xsl:when 
        188        test="stri ng-length( @code)=0"
        189       />
        190                                 
        191       <xsl:when 
        192        test="@cod e='en' or  @code='en- US'"
        193       >
        194                                           
        195        <xsl:text>
        196         English
        197        </xsl:text >
        198                                  
        199       </xsl:when >
        200                                 
        201       <xsl:when 
        202        test="@cod e='es' or  @code='es- US'"
        203       >
        204                                           
        205        <xsl:text>
        206         Spanish
        207        </xsl:text >
        208                                  
        209       </xsl:when >
        210                                 
        211       <xsl:other wise>
        212                                           
        213        <xsl:value -of 
        214         select="@c ode"
        215        />
        216                                  
        217       </xsl:othe rwise>
        218                        
        219      </xsl:choo se>
        220              
        221     </xsl:temp late>
        222    
        223       
        224     <xsl:templ ate 
        225      name="isLa nguageFoun d"
        226     >
        227          
        228      <xsl:param  
        229       name="pati entRole"
        230      />
        231          
        232      <xsl:varia ble 
        233       name="lang s"
        234      >
        235             
        236       <xsl:value -of 
        237        select="$p atientRole /n1:patien t/n1:langu ageCommuni cation/n1: languageCo de/@code"
        238       />
        239           
        240      </xsl:vari able>
        241          
        242      <xsl:value -of 
        243       select="st ring-lengt h(normaliz e-space($l angs))>0"
        244      />
        245        
        246     </xsl:temp late>
        247             
        248             
        249     <!-- Aller gies -->
        250    
        251             
        252     <xsl:templ ate 
        253      name="getA llergen"
        254     >
        255                       
        256      <xsl:param  
        257       name="obse rvation"
        258      />
        259                       
        260      <xsl:if 
        261       test="$obs ervation"
        262      >
        263                                 
        264       <xsl:choos e>
        265                                           
        266        <xsl:when 
        267         test="$obs ervation/n 1:value[@c ode=$aller gyNkaCode] "
        268        >
        269                                                    
        270         <xsl:text>
        271          NKA
        272         </xsl:text >
        273                                            
        274        </xsl:when >
        275                                           
        276        <xsl:when 
        277         test="stri ng-length( $observati on/n1:part icipant/n1 :participa ntRole/n1: playingEnt ity/n1:nam e)>1"
        278        >
        279                                                    
        280         <xsl:value -of 
        281          select="$o bservation /n1:partic ipant/n1:p articipant Role/n1:pl ayingEntit y/n1:name"
        282         />
        283                                            
        284        </xsl:when >
        285                                           
        286        <xsl:when 
        287         test="$obs ervation/n 1:text/n1: reference/ @value"
        288        >
        289                                                    
        290         <xsl:varia ble 
        291          name = "re actionName Ref1" 
        292          select="$o bservation /n1:text/n 1:referenc e/@value"
        293         />
        294                                                    
        295         <xsl:varia ble 
        296          name = "re actionName Ref2" 
        297          select="su bstring($o bservation /n1:text/n 1:referenc e/@value,2 )"
        298         />
        299                                                    
        300         <xsl:if 
        301          test="../n 1:text//n1 :td[@ID=$r eactionNam eRef1]"
        302         >
        303                                                              
        304          <xsl:value -of 
        305           select=".. /n1:text// n1:td[@ID= $reactionN ameRef1]"
        306          />
        307                                                     
        308         </xsl:if>
        309                                                    
        310         <xsl:if 
        311          test="../n 1:text//n1 :td[@ID=$r eactionNam eRef2]"
        312         >
        313                                                              
        314          <xsl:value -of 
        315           select=".. /n1:text// n1:td[@ID= $reactionN ameRef2]"
        316          />
        317                                                     
        318         </xsl:if>
        319                                                    
        320         <xsl:if 
        321          test="../n 1:text//n1 :content[@ ID=$reacti onNameRef1 ]"
        322         >
        323                                                              
        324          <xsl:value -of 
        325           select=".. /n1:text// n1:content [@ID=$reac tionNameRe f1]"
        326          />
        327                                                     
        328         </xsl:if>
        329                                                    
        330         <xsl:if 
        331          test="../n 1:text//n1 :content[@ ID=$reacti onNameRef2 ]"
        332         >
        333                                                              
        334          <xsl:value -of 
        335           select=".. /n1:text// n1:content [@ID=$reac tionNameRe f2]"
        336          />
        337                                                     
        338         </xsl:if>
        339                                            
        340        </xsl:when >
        341                                           
        342        <xsl:when 
        343         test="$obs ervation/n 1:particip ant[@typeC ode='CSM'] /n1:partic ipantRole[ @classCode ='MANU']/n 1:playingE ntity[@cla ssCode='MM AT']/n1:co de/n1:orig inalText/n 1:referenc e/@value"
        344        >
        345                                                    
        346         <xsl:varia ble 
        347          name = "re actionName Ref1" 
        348          select="$o bservation /n1:partic ipant/n1:p articipant Role/n1:pl ayingEntit y/n1:code/ n1:origina lText/n1:r eference/@ value"
        349         />
        350                                                    
        351         <xsl:varia ble 
        352          name = "re actionName Ref2" 
        353          select="su bstring-af ter($obser vation/n1: participan t/n1:parti cipantRole /n1:playin gEntity/n1 :code/n1:o riginalTex t/n1:refer ence/@valu e,'#')"
        354         />
        355                                                    
        356         <xsl:if 
        357          test="../n 1:text//n1 :td[@ID=$r eactionNam eRef1]"
        358         >
        359                                                              
        360          <xsl:value -of 
        361           select=".. /n1:text// n1:td[@ID= $reactionN ameRef1]"
        362          />
        363                                                     
        364         </xsl:if>
        365                                                    
        366         <xsl:if 
        367          test="../n 1:text//n1 :td[@ID=$r eactionNam eRef2]"
        368         >
        369                                                              
        370          <xsl:value -of 
        371           select=".. /n1:text// n1:td[@ID= $reactionN ameRef2]"
        372          />
        373                                                     
        374         </xsl:if>
        375                                                    
        376         <xsl:if 
        377          test="../n 1:text//n1 :content[@ ID=$reacti onNameRef1 ]"
        378         >
        379                                                              
        380          <xsl:value -of 
        381           select=".. /n1:text// n1:content [@ID=$reac tionNameRe f1]"
        382          />
        383                                                     
        384         </xsl:if>
        385                                                    
        386         <xsl:if 
        387          test="../n 1:text//n1 :content[@ ID=$reacti onNameRef2 ]"
        388         >
        389                                                              
        390          <xsl:value -of 
        391           select=".. /n1:text// n1:content [@ID=$reac tionNameRe f2]"
        392          />
        393                                                     
        394         </xsl:if>
        395                                            
        396        </xsl:when >
        397                                           
        398        <xsl:other wise>
        399                                                    
        400         <xsl:value -of 
        401          select="$o bservation /n1:partic ipant[@typ eCode='CSM ']/n1:part icipantRol e[@classCo de='MANU'] /n1:playin gEntity[@c lassCode=' MMAT']"
        402         />
        403                                            
        404        </xsl:othe rwise>
        405                                  
        406       </xsl:choo se>
        407                        
        408      </xsl:if>
        409              
        410     </xsl:temp late>
        411    
        412             
        413     <xsl:templ ate 
        414      name="getA llergenTex t"
        415     >
        416                       
        417      <xsl:param  
        418       name="obse rvation"
        419      />
        420                       
        421      <xsl:if 
        422       test="$obs ervation"
        423      >
        424                                 
        425       <xsl:choos e>
        426                                           
        427        <xsl:when 
        428         test="$obs ervation/n 1:particip ant/n1:par ticipantRo le/n1:play ingEntity/ n1:name or  $observat ion/n1:par ticipant[@ typeCode=' CSM']/n1:p articipant Role[@clas sCode='MAN U']/n1:pla yingEntity [@classCod e='MMAT']/ @name"
        429        >
        430                                                    
        431         <xsl:value -of 
        432          select="$o bservation /n1:partic ipant/n1:p articipant Role/n1:pl ayingEntit y/n1:name"
        433         />
        434                                            
        435        </xsl:when >
        436                                           
        437        <xsl:other wise>
        438                                                    
        439         <xsl:value -of 
        440          select="$o bservation /participa nt[@typeCo de='CSM']/ n1:partici pantRole[@ classCode= 'MANU']/n1 :playingEn tity[@clas sCode='MMA T']/@name"
        441         />
        442                                            
        443        </xsl:othe rwise>
        444                                  
        445       </xsl:choo se>
        446                        
        447      </xsl:if>
        448              
        449     </xsl:temp late>
        450    
        451             
        452     <xsl:templ ate 
        453      name="getA llergyVeri ficationDa te"
        454     >
        455                       
        456      <xsl:param  
        457       name="obse rvation"
        458      />
        459                       
        460      <xsl:if 
        461       test="stri ng-length( $observati on/n1:effe ctiveTime/ n1:low/@va lue)>0"
        462      >
        463                                 
        464       <xsl:value -of 
        465        select="$o bservation /n1:effect iveTime/n1 :low/@valu e"
        466       />
        467                        
        468      </xsl:if>
        469              
        470     </xsl:temp late>
        471    
        472             
        473     <xsl:templ ate 
        474      name="getE ventType"
        475     >
        476                       
        477      <xsl:param  
        478       name="obs"
        479      />
        480                       
        481      <xsl:choos e>
        482                                 
        483       <xsl:when 
        484        test="$obs /n1:code/@ displayNam e and not( $isKaiser) "
        485       >
        486                                           
        487        <xsl:value -of 
        488         select="$o bs/n1:code /@displayN ame"
        489        />
        490                                  
        491       </xsl:when >
        492                                 
        493       <xsl:other wise>
        494                                           
        495        <xsl:call- template 
        496         name="na"
        497        />
        498                                  
        499       </xsl:othe rwise>
        500                        
        501      </xsl:choo se>
        502              
        503     </xsl:temp late>
        504    
        505             
        506     <xsl:templ ate 
        507      name="getR eactionVal ueFromRefe rence"
        508     >
        509                       
        510      <xsl:param  
        511       name="reac tionRefere nce"
        512      />
        513                       
        514      <xsl:param  
        515       name="sect ion"
        516      />
        517                       
        518      <xsl:varia ble 
        519       name="reac tionValue"  
        520       select="$s ection//n1 :content[@ ID=$reacti onReferenc e]"
        521      />
        522                       
        523      <xsl:varia ble 
        524       name="reac tionValue2
        525       select="$s ection//n1 :content[@ ID=substri ng-after($ reactionRe ference,'# ')]"
        526      />
        527                       
        528      <xsl:varia ble 
        529       name="reac tionValue3
        530       select="$s ection//n1 :td[@ID=$r eactionRef erence]"
        531      />
        532                       
        533      <xsl:varia ble 
        534       name="reac tionValue4
        535       select="$s ection//n1 :td[@ID=su bstring-af ter($react ionReferen ce,'#')]"
        536      />
        537                       
        538      <xsl:if 
        539       test="stri ng-length( $reactionV alue)>0"
        540      >
        541                                 
        542       <xsl:if 
        543        test="posi tion()>1"
        544       >
        545                                           
        546        <xsl:text>
        547        
        548        </xsl:text >
        549                                  
        550       </xsl:if>
        551                                 
        552       <xsl:value -of 
        553        select="$r eactionVal ue"
        554       />
        555                        
        556      </xsl:if>
        557                       
        558      <xsl:if 
        559       test="stri ng-length( $reactionV alue2)>0"
        560      >
        561                                 
        562       <xsl:if 
        563        test="posi tion()>1"
        564       >
        565                                           
        566        <xsl:text>
        567        
        568        </xsl:text >
        569                                  
        570       </xsl:if>
        571                                 
        572       <xsl:value -of 
        573        select="$r eactionVal ue2"
        574       />
        575                        
        576      </xsl:if>
        577                       
        578      <xsl:if 
        579       test="stri ng-length( $reactionV alue3)>0"
        580      >
        581                                 
        582       <xsl:if 
        583        test="posi tion()>1"
        584       >
        585                                           
        586        <xsl:text>
        587        
        588        </xsl:text >
        589                                  
        590       </xsl:if>
        591                                 
        592       <xsl:value -of 
        593        select="$r eactionVal ue3"
        594       />
        595                        
        596      </xsl:if>
        597                       
        598      <xsl:if 
        599       test="stri ng-length( $reactionV alue4)>0"
        600      >
        601                                 
        602       <xsl:if 
        603        test="posi tion()>1"
        604       >
        605                                           
        606        <xsl:text>
        607        
        608        </xsl:text >
        609                                  
        610       </xsl:if>
        611                                 
        612       <xsl:value -of 
        613        select="$r eactionVal ue4"
        614       />
        615                        
        616      </xsl:if>
        617              
        618     </xsl:temp late>
        619       
        620       
        621     <xsl:templ ate 
        622      name="getR eactionVal ue"
        623     >
        624          
        625      <xsl:param  
        626       name="entr yRelations hip"
        627      />
        628          
        629      <xsl:varia ble 
        630       name="sect ion" 
        631       select="$e ntryRelati onship/../ ../../n1:t ext"
        632      />
        633          
        634      <xsl:choos e>
        635             
        636       <xsl:when 
        637        test="$ent ryRelation ship/n1:ob servation/ n1:entryRe lationship [@typeCode ='MFST']/n 1:observat ion/n1:tex t/n1:refer ence[@valu e]"
        638       >
        639                
        640        <xsl:for-e ach 
        641         select="$e ntryRelati onship/n1: observatio n/n1:entry Relationsh ip[@typeCo de='MFST'] /n1:observ ation/n1:t ext/n1:ref erence"
        642        >
        643                   
        644         <xsl:call- template 
        645          name="getR eactionVal ueFromRefe rence"
        646         >
        647                       
        648          <xsl:with- param 
        649           name="reac tionRefere nce" 
        650           select="@v alue"
        651          />
        652                       
        653          <xsl:with- param 
        654           name="sect ion" 
        655           select="$s ection"
        656          />
        657                    
        658         </xsl:call -template>
        659                 
        660        </xsl:for- each>
        661              
        662       </xsl:when >      
        663           
        664      </xsl:choo se>
        665        
        666     </xsl:temp late>  
        667      
        668             
        669     <xsl:templ ate 
        670      name="getA llergySour ce"
        671     >
        672                       
        673      <xsl:param  
        674       name="row"
        675      />
        676                       
        677      <xsl:choos e>
        678                                 
        679       <xsl:when 
        680        test="$row /n1:act/n1 :author/n1 :assignedA uthor/n1:r epresented Organizati on/n1:name "
        681       >
        682                                           
        683        <xsl:value -of 
        684         select="$r ow/n1:act/ n1:author/ n1:assigne dAuthor/n1 :represent edOrganiza tion/n1:na me"
        685        />
        686                                  
        687       </xsl:when >
        688                                 
        689       <xsl:when 
        690        test="$row /n1:act/n1 :performer /n1:assign edEntity/n 1:represen tedOrganiz ation/n1:n ame"
        691       >
        692                                           
        693        <xsl:value -of 
        694         select="$r ow/n1:act/ n1:perform er/n1:assi gnedEntity /n1:repres entedOrgan ization/n1 :name"
        695        />
        696                                  
        697       </xsl:when >
        698             
        699       <xsl:when 
        700        test="$row /n1:act/n1 :entryRela tionship/n 1:observat ion/n1:aut hor/n1:ass ignedAutho r/n1:repre sentedOrga nization/n 1:name"
        701       >
        702                
        703        <xsl:value -of 
        704         select="$r ow/n1:act/ n1:entryRe lationship /n1:observ ation/n1:a uthor/n1:a ssignedAut hor/n1:rep resentedOr ganization /n1:name"
        705        />
        706              
        707       </xsl:when >
        708                                 
        709       <xsl:other wise>
        710                                           
        711        <xsl:value -of 
        712         select="$r ow/n1:act/ n1:entryRe lationship [@typeCode ='SUBJ']/n 1:observat ion[@class Code='OBS' ]/n1:entry Relationsh ip[@typeCo de='REFR'] /n1:observ ation[@cla ssCode='OB S']/n1:inf ormant/n1: assignedEn tity/n1:re presentedO rganizatio n/n1:name"
        713        />
        714                                  
        715       </xsl:othe rwise>
        716           
        717      </xsl:choo se>
        718              
        719     </xsl:temp late>
        720    
        721             
        722     <xsl:templ ate 
        723      name="getS everity"
        724     >
        725                       
        726      <xsl:param  
        727       name="obse rvation"
        728      />
        729                       
        730      <xsl:varia ble 
        731       name="seve rityRefere nce" 
        732       select="$o bservation //n1:entry Relationsh ip[@typeCo de='SUBJ'] /n1:observ ation/n1:t ext/n1:ref erence/@va lue"
        733      />
        734                       
        735      <xsl:varia ble 
        736       name="sevD ata1" 
        737       select="$o bservation /../../../ ../n1:text //n1:conte nt[@ID=$se verityRefe rence]"
        738      />
        739                       
        740      <xsl:varia ble 
        741       name="sevD ata2" 
        742       select="$o bservation /../../../ ../n1:text //n1:conte nt[@ID=sub string-aft er($severi tyReferenc e,'#')]"
        743      />
        744                       
        745      <xsl:varia ble 
        746       name="sevD ata3" 
        747       select="$o bservation /../../../ ../n1:text //n1:td[@I D=$severit yReference ]"
        748      />
        749                       
        750      <xsl:varia ble 
        751       name="sevD ata4" 
        752       select="$o bservation /../../../ ../n1:text //n1:td[@I D=substrin g-after($s everityRef erence,'#' )]"
        753      />
        754                       
        755      <xsl:choos e>
        756                                 
        757       <xsl:when 
        758        test="stri ng-length( $sevData1) >=1" 
        759       >
        760                                           
        761        <xsl:value -of 
        762         select="$s evData1"
        763        />
        764                                  
        765       </xsl:when >
        766                                 
        767       <xsl:when 
        768        test="stri ng-length( $sevData2) >=1" 
        769       >
        770                                           
        771        <xsl:value -of 
        772         select="$s evData2"
        773        />
        774                                  
        775       </xsl:when >
        776                                 
        777       <xsl:when 
        778        test="stri ng-length( $sevData3) >=1" 
        779       >
        780                                           
        781        <xsl:value -of 
        782         select="$s evData3"
        783        />
        784                                  
        785       </xsl:when >
        786                                 
        787       <xsl:when 
        788        test="stri ng-length( $sevData4) >=1" 
        789       >
        790                                           
        791        <xsl:value -of 
        792         select="$s evData4"
        793        />
        794                                  
        795       </xsl:when >
        796                                 
        797       <xsl:other wise >
        798                                           
        799        <xsl:call- template 
        800         name="na"
        801        />
        802                                  
        803       </xsl:othe rwise>
        804                        
        805      </xsl:choo se>
        806              
        807     </xsl:temp late>
        808    
        809             
        810     <xsl:templ ate 
        811      name="getR eactionCod ed"
        812     >
        813                       
        814      <xsl:param  
        815       name="eR"
        816      />
        817                       
        818      <xsl:varia ble 
        819       name="code d" 
        820       select="$e R[@inversi onInd='tru e' and @ty peCode='MF ST']"
        821      />
        822                       
        823      <xsl:for-e ach 
        824       select="$c oded"
        825      >
        826                                 
        827       <xsl:if 
        828        test="n1:o bservation /n1:value/ n1:transla tion/@disp layName"
        829       >
        830                                           
        831        <xsl:value -of 
        832         select="n1 :observati on/n1:valu e/n1:trans lation/@di splayName"
        833        />
        834                                  
        835       </xsl:if>
        836                        
        837      </xsl:for- each>
        838              
        839     </xsl:temp late>
        840    
        841             
        842     <!-- Encou nters -->
        843    
        844             
        845     <xsl:templ ate 
        846      name="getE ncounterID "
        847     >
        848                       
        849      <xsl:param  
        850       name="enco unter"
        851      />
        852                       
        853      <xsl:choos e>
        854                                 
        855       <xsl:when 
        856        test="$enc ounter/n1: id/@root"
        857       >
        858                                           
        859        <xsl:value -of 
        860         select="$e ncounter/n 1:id/@root "
        861        />
        862                                  
        863       </xsl:when >
        864                                 
        865       <xsl:other wise>
        866                                           
        867        <xsl:call- template 
        868         name="na"
        869        />
        870                                  
        871       </xsl:othe rwise>
        872                        
        873      </xsl:choo se>
        874              
        875     </xsl:temp late>
        876    
        877       
        878     <xsl:templ ate 
        879      name="getE ncounterTy pe"
        880     >
        881          
        882      <xsl:param  
        883       name="enco unter"
        884      />
        885          
        886      <xsl:varia ble 
        887       name="enco unterRefer ence" 
        888       select="$e ncounter/n 1:text/n1: reference/ @value" 
        889      />
        890          
        891      <xsl:varia ble 
        892       name="enco unterRefer ence2" 
        893       select="$e ncounter/n 1:code/n1: originalTe xt/n1:refe rence/@val ue" 
        894      />
        895          
        896      <xsl:if 
        897       test="$enc ounter"
        898      >
        899             
        900       <xsl:choos e>
        901                
        902        <xsl:when 
        903         test="$enc ounter/n1: code/@disp layName"
        904        >
        905                   
        906         <xsl:value -of 
        907          select="$e ncounter/n 1:code/@di splayName"
        908         />
        909                 
        910        </xsl:when >
        911                
        912        <xsl:when 
        913         test="$enc ounter/n1: text/n1:re ference/@v alue and s tring-leng th($encoun ter/../../ n1:text//n 1:td[@ID=s ubstring-a fter($enco unterRefer ence,'#')] )>0"
        914        >
        915                   
        916         <xsl:value -of 
        917          select="$e ncounter/. ./../n1:te xt//n1:td[ @ID=substr ing-after( $encounter Reference, '#')]"
        918         />
        919                 
        920        </xsl:when >
        921                
        922        <xsl:when 
        923         test="$enc ounter/n1: code/n1:or iginalText /n1:refere nce/@value "
        924        >
        925                   
        926         <xsl:value -of 
        927          select="$e ncounter/. ./../n1:te xt//n1:td[ @ID=substr ing-after( $encounter Reference2 ,'#')]"
        928         />
        929                 
        930        </xsl:when >
        931                
        932        <xsl:other wise>
        933                   
        934         <xsl:call- template 
        935          name="na"
        936         />
        937                 
        938        </xsl:othe rwise>
        939              
        940       </xsl:choo se>
        941           
        942      </xsl:if>
        943        
        944     </xsl:temp late>
        945    
        946       
        947     <xsl:templ ate 
        948      name="getE ncounterFr eeText"
        949     >
        950          
        951      <xsl:param  
        952       name="enco unter"
        953      />
        954          
        955      <xsl:varia ble 
        956       name="encR ef1" 
        957       select="$e ncounter/n 1:text/n1: reference/ @value"
        958      />
        959          
        960      <xsl:varia ble 
        961       name="encR ef2" 
        962       select="su bstring-af ter($encRe f1,'#')"
        963      />
        964          
        965      <xsl:varia ble 
        966       name="encR ef3" 
        967       select="$e ncounter/n 1:entryRel ationship/ n1:act/n1: text/n1:re ference/@v alue"
        968      />
        969          
        970      <xsl:varia ble 
        971       name="encR ef4" 
        972       select="su bstring-af ter($encRe f3,'#')"
        973      />
        974          
        975      <xsl:choos e>
        976             
        977       <xsl:when 
        978        test="stri ng-length( normalize- space($enc ounter/../ ../n1:text //n1:conte nt[@ID=$en cRef1]))>0 "
        979       >
        980                
        981        <xsl:value -of 
        982         select="no rmalize-sp ace($encou nter/../.. /n1:text// n1:content [@ID=$encR ef1])"
        983        />
        984              
        985       </xsl:when >
        986             
        987       <xsl:when 
        988        test="stri ng-length( normalize- space($enc ounter/../ ../n1:text //n1:td[@I D=$encRef1 ]))>0"
        989       >
        990                
        991        <xsl:value -of 
        992         select="no rmalize-sp ace($encou nter/../.. /n1:text// n1:td[@ID= $encRef1]) "
        993        />
        994              
        995       </xsl:when >
        996             
        997       <xsl:when 
        998        test="stri ng-length( normalize- space($enc ounter/../ ../n1:text //n1:conte nt[@ID=$en cRef2]))>0 "
        999       >
        1000                
        1001        <xsl:value -of 
        1002         select="no rmalize-sp ace($encou nter/../.. /n1:text// n1:content [@ID=$encR ef2])"
        1003        />
        1004              
        1005       </xsl:when >
        1006             
        1007       <xsl:when 
        1008        test="stri ng-length( normalize- space($enc ounter/../ ../n1:text //n1:td[@I D=$encRef2 ]))>0"
        1009       >
        1010                
        1011        <xsl:value -of 
        1012         select="no rmalize-sp ace($encou nter/../.. /n1:text// n1:td[@ID= $encRef2]) "
        1013        />
        1014              
        1015       </xsl:when >
        1016             
        1017       <xsl:when 
        1018        test="stri ng-length( normalize- space($enc ounter/../ ../n1:text //n1:conte nt[@ID=$en cRef4]))>0 "
        1019       >
        1020                
        1021        <xsl:value -of 
        1022         select="no rmalize-sp ace($encou nter/../.. /n1:text// n1:content [@ID=$encR ef4])"
        1023        />
        1024              
        1025       </xsl:when >
        1026             
        1027       <xsl:when 
        1028        test="stri ng-length( normalize- space($enc ounter/../ ../n1:text //n1:td[@I D=$encRef4 ]))>0"
        1029       >
        1030                
        1031        <xsl:value -of 
        1032         select="no rmalize-sp ace($encou nter/../.. /n1:text// n1:td[@ID= $encRef4]) "
        1033        />
        1034              
        1035       </xsl:when >
        1036           
        1037      </xsl:choo se>
        1038        
        1039     </xsl:temp late>
        1040    
        1041             
        1042     <xsl:templ ate 
        1043      name="getE ncounterDa teTime"
        1044     >
        1045                       
        1046      <xsl:param  
        1047       name="enco unter"
        1048      />
        1049                       
        1050      <xsl:if 
        1051       test="$enc ounter"
        1052      >
        1053                                 
        1054       <xsl:choos e>
        1055                                           
        1056        <xsl:when 
        1057         test="$enc ounter/n1: effectiveT ime/n1:low /@value"
        1058        >
        1059                                                    
        1060         <xsl:value -of 
        1061          select="$e ncounter/n 1:effectiv eTime/n1:l ow/@value"
        1062         />
        1063                                            
        1064        </xsl:when >
        1065                                  
        1066       </xsl:choo se>
        1067                        
        1068      </xsl:if>
        1069              
        1070     </xsl:temp late>
        1071    
        1072             
        1073     <xsl:templ ate 
        1074      name="getE ncounterPr ovider"
        1075     >
        1076                       
        1077      <xsl:param  
        1078       name="enco unter"
        1079      />
        1080                       
        1081      <xsl:if 
        1082       test="$enc ounter"
        1083      >
        1084                                 
        1085       <xsl:choos e>
        1086                                           
        1087        <xsl:when 
        1088         test="$enc ounter/n1: performer/ n1:assigne dEntity/n1 :assignedP erson/n1:n ame/n1:fam ily and $e ncounter/n 1:performe r/n1:assig nedEntity/ n1:assigne dPerson/n1 :name/n1:g iven"
        1089        >
        1090                                                    
        1091         <xsl:varia ble 
        1092          name="firs t" 
        1093          select="$e ncounter/n 1:performe r/n1:assig nedEntity/ n1:assigne dPerson/n1 :name/n1:g iven"
        1094         />
        1095                                                    
        1096         <xsl:varia ble 
        1097          name="last
        1098          select="$e ncounter/n 1:performe r/n1:assig nedEntity/ n1:assigne dPerson/n1 :name/n1:f amily"
        1099         />
        1100                                                    
        1101         <xsl:call- template 
        1102          name="form atProvider Name"
        1103         >
        1104                                                              
        1105          <xsl:with- param 
        1106           name="firs t" 
        1107           select="$f irst"
        1108          />
        1109                                                              
        1110          <xsl:with- param 
        1111           name="last
        1112           select="$l ast"
        1113          />
        1114                                                     
        1115         </xsl:call -template>
        1116                                            
        1117        </xsl:when >
        1118                                           
        1119        <xsl:other wise>
        1120                                                    
        1121         <xsl:value -of 
        1122          select="$e ncounter/n 1:performe r/n1:assig nedEntity/ n1:assigne dPerson"
        1123         />
        1124                                            
        1125        </xsl:othe rwise>
        1126                                  
        1127       </xsl:choo se>
        1128                        
        1129      </xsl:if>
        1130              
        1131     </xsl:temp late>
        1132    
        1133             
        1134     <!--Proced ures -->
        1135    
        1136             
        1137     <xsl:templ ate 
        1138      name="getP rocedureID "
        1139     >
        1140                       
        1141      <xsl:param  
        1142       name="proc edure"
        1143      />
        1144                       
        1145      <xsl:if 
        1146       test="$pro cedure"
        1147      >
        1148                                 
        1149       <xsl:choos e>
        1150                                           
        1151        <xsl:when 
        1152         test="$pro cedure/n1: id/@root"
        1153        >
        1154                                                    
        1155         <xsl:value -of 
        1156          select="$p rocedure/n 1:id/@root "
        1157         />
        1158                                            
        1159        </xsl:when >
        1160                                           
        1161        <xsl:other wise/>
        1162                                  
        1163       </xsl:choo se>
        1164                        
        1165      </xsl:if>
        1166              
        1167     </xsl:temp late>
        1168    
        1169             
        1170     <xsl:templ ate 
        1171      name="getP rocedureTy pe"
        1172     >
        1173                       
        1174      <xsl:param  
        1175       name="proc edure"
        1176      />
        1177                       
        1178      <xsl:varia ble 
        1179       name="disp layName" 
        1180       select="$p rocedure/n 1:code/@di splayName"
        1181      />
        1182                       
        1183      <xsl:varia ble 
        1184       name="code
        1185       select="$p rocedure/n 1:code/@co de"
        1186      />
        1187                       
        1188      <xsl:choos e>
        1189                                 
        1190       <xsl:when 
        1191        test="cont ains($disp layName,$c ode)"
        1192       >
        1193                                           
        1194        <xsl:value -of 
        1195         select="su bstring-af ter($displ ayName,$co de)"
        1196        />
        1197                                  
        1198       </xsl:when >
        1199                                 
        1200       <xsl:other wise>
        1201                                           
        1202        <xsl:value -of 
        1203         select="$p rocedure/n 1:code/@di splayName"
        1204        />
        1205                                  
        1206       </xsl:othe rwise>
        1207                        
        1208      </xsl:choo se>
        1209              
        1210     </xsl:temp late>
        1211    
        1212             
        1213     <xsl:templ ate 
        1214      name="getP rocedureFr eeText"
        1215     >
        1216                       
        1217      <xsl:param  
        1218       name="proc edure"
        1219      />
        1220                       
        1221      <xsl:varia ble 
        1222       name="proc Ref" 
        1223       select="su bstring-af ter($proce dure/n1:te xt/n1:refe rence/@val ue,'#')"
        1224      />
        1225                       
        1226      <xsl:varia ble 
        1227       name="proc 1" 
        1228       select="$p rocedure/. ./../n1:te xt//n1:con tent[@ID=$ procRef]"
        1229      />
        1230                       
        1231      <xsl:varia ble 
        1232       name="proc 2" 
        1233       select="$p rocedure/. ./../n1:te xt//n1:tr[ @ID=$procR ef]"
        1234      />
        1235                       
        1236      <xsl:choos e>
        1237                                 
        1238       <xsl:when 
        1239        test="stri ng-length( $proc1)>1"
        1240       >
        1241                                           
        1242        <xsl:value -of 
        1243         select="$p roc1"
        1244        />
        1245                                  
        1246       </xsl:when >
        1247                                 
        1248       <xsl:when 
        1249        test="stri ng-length( $proc2)>1"
        1250       >
        1251                                           
        1252        <xsl:value -of 
        1253         select="$p roc2"
        1254        />
        1255                                  
        1256       </xsl:when >
        1257                        
        1258      </xsl:choo se>
        1259              
        1260     </xsl:temp late>
        1261    
        1262             
        1263     <xsl:templ ate 
        1264      name="getP rocedureDa teTime"
        1265     >
        1266                       
        1267      <xsl:param  
        1268       name="proc edure"
        1269      />
        1270                       
        1271      <xsl:if 
        1272       test="$pro cedure"
        1273      >
        1274                                 
        1275       <xsl:choos e>
        1276                                           
        1277        <xsl:when 
        1278         test="$pro cedure/n1: effectiveT ime/n1:low /@value"
        1279        >
        1280                                                    
        1281         <xsl:call- template 
        1282          name="form atDateShor t"
        1283         >
        1284                                                              
        1285          <xsl:with- param 
        1286           name="date String" 
        1287           select="$p rocedure/n 1:effectiv eTime/n1:l ow/@value"
        1288          />
        1289                                                     
        1290         </xsl:call -template>
        1291                                            
        1292        </xsl:when >
        1293                
        1294        <xsl:when 
        1295         test="$pro cedure/n1: effectiveT ime/@value "
        1296        >
        1297                   
        1298         <xsl:call- template 
        1299          name="form atDateShor t"
        1300         >
        1301                       
        1302          <xsl:with- param 
        1303           name="date String" 
        1304           select="$p rocedure/n 1:effectiv eTime/@val ue"
        1305          />
        1306                    
        1307         </xsl:call -template>
        1308                 
        1309        </xsl:when >
        1310                
        1311        <xsl:other wise>
        1312                   
        1313         <xsl:call- template 
        1314          name="na"
        1315         />
        1316                 
        1317        </xsl:othe rwise>    
        1318                                  
        1319       </xsl:choo se>
        1320                        
        1321      </xsl:if>
        1322              
        1323     </xsl:temp late>
        1324    
        1325             
        1326     <xsl:templ ate 
        1327      name="getP rocedurePr ovider"
        1328     >
        1329                       
        1330      <xsl:param  
        1331       name="proc edure"
        1332      />
        1333                       
        1334      <xsl:if 
        1335       test="$pro cedure"
        1336      >
        1337                                 
        1338       <xsl:choos e>
        1339                                           
        1340        <xsl:when 
        1341         test="$pro cedure/n1: performer/ n1:assigne dEntity/n1 :assignedP erson/n1:n ame/n1:fam ily and $p rocedure/n 1:performe r/n1:assig nedEntity/ n1:assigne dPerson/n1 :name/n1:g iven"
        1342        >
        1343                                                    
        1344         <xsl:varia ble 
        1345          name="firs t" 
        1346          select="$p rocedure/n 1:performe r/n1:assig nedEntity/ n1:assigne dPerson/n1 :name/n1:g iven"
        1347         />
        1348                                                    
        1349         <xsl:varia ble 
        1350          name="last
        1351          select="$p rocedure/n 1:performe r/n1:assig nedEntity/ n1:assigne dPerson/n1 :name/n1:f amily"
        1352         />
        1353                                                    
        1354         <xsl:call- template 
        1355          name="form atProvider Name"
        1356         >
        1357                                                              
        1358          <xsl:with- param 
        1359           name="firs t" 
        1360           select="$f irst"
        1361          />
        1362                                                              
        1363          <xsl:with- param 
        1364           name="last
        1365           select="$l ast"
        1366          />
        1367                                                     
        1368         </xsl:call -template>
        1369                                            
        1370        </xsl:when >
        1371                                           
        1372        <xsl:other wise>
        1373                                                    
        1374         <xsl:value -of 
        1375          select="$p rocedure/n 1:performe r/n1:assig nedEntity/ n1:assigne dPerson"
        1376         />
        1377                                            
        1378        </xsl:othe rwise>
        1379                                  
        1380       </xsl:choo se>
        1381                        
        1382      </xsl:if>
        1383              
        1384     </xsl:temp late>
        1385    
        1386             
        1387     <!--Medica tions -->
        1388    
        1389             
        1390     <xsl:templ ate 
        1391      name="medD ateBeginSt ring"
        1392     >
        1393                       
        1394      <xsl:param  
        1395       name="subs tanceAdmin "
        1396      />
        1397                       
        1398      <xsl:call- template 
        1399       name="shor tenDate"
        1400      >
        1401                                 
        1402       <xsl:with- param 
        1403        name="inSt ring"
        1404       >
        1405                                           
        1406        <xsl:choos e>
        1407                                                    
        1408         <xsl:when 
        1409          test="$sub stanceAdmi n/n1:effec tiveTime/n 1:low/@val ue and not ($isINHS)"
        1410         >
        1411                                                              
        1412          <xsl:value -of 
        1413           select="$s ubstanceAd min/n1:eff ectiveTime /n1:low/@v alue"
        1414          />
        1415                                                     
        1416         </xsl:when >
        1417                                                    
        1418         <xsl:when 
        1419          test="$sub stanceAdmi n/n1:entry Relationsh ip[@typeCo de='REFR'] /n1:supply [@classCod e='SPLY' a nd @moodCo de='EVN']/ n1:effecti veTime/@va lue"
        1420         >
        1421                                                              
        1422          <xsl:value -of 
        1423           select="$s ubstanceAd min/n1:ent ryRelation ship[@type Code='REFR ']/n1:supp ly[@classC ode='SPLY'  and @mood Code='EVN' ]/n1:effec tiveTime/@ value"
        1424          />
        1425                                                     
        1426         </xsl:when >
        1427                                                    
        1428         <xsl:when 
        1429          test="$sub stanceAdmi n/n1:entry Relationsh ip[@typeCo de='REFR'] /n1:supply [@classCod e='SPLY' a nd @moodCo de='INT']/ n1:effecti veTime/@va lue"
        1430         >
        1431                                                              
        1432          <xsl:value -of 
        1433           select="$s ubstanceAd min/n1:ent ryRelation ship[@type Code='REFR ']/n1:supp ly[@classC ode='SPLY'  and @mood Code='INT' ]/n1:effec tiveTime/@ value"
        1434          />
        1435                                                     
        1436         </xsl:when >
        1437                                            
        1438        </xsl:choo se>
        1439                                  
        1440       </xsl:with -param>
        1441                        
        1442      </xsl:call -template>
        1443              
        1444     </xsl:temp late>
        1445    
        1446             
        1447     <xsl:templ ate 
        1448      name="getM edicationN ame"
        1449     >
        1450                       
        1451      <xsl:param  
        1452       name="row"
        1453      />
        1454                       
        1455      <xsl:varia ble 
        1456       name="subs tanceAdmin
        1457       select="$r ow/n1:subs tanceAdmin istration"
        1458      />
        1459                       
        1460      <xsl:varia ble 
        1461       name="ref1
        1462       select="$s ubstanceAd min/n1:con sumable/n1 :manufactu redProduct /n1:manufa cturedMate rial/n1:co de/n1:orig inalText/n 1:referenc e/@value"
        1463      />
        1464                       
        1465      <xsl:varia ble 
        1466       name="refS hort" 
        1467       select="su bstring-af ter($ref1, '#')"
        1468      />
        1469                       
        1470      <xsl:if 
        1471       test="$sub stanceAdmi n"
        1472      >
        1473                                 
        1474       <xsl:choos e>
        1475                                           
        1476        <xsl:when 
        1477         test="stri ng-length( normalize- space($row /../n1:tex t//n1:cont ent[@ID=$r efShort])) >0"
        1478        >
        1479                                                    
        1480         <xsl:value -of 
        1481          select="no rmalize-sp ace($row/. ./n1:text/ /n1:conten t[@ID=$ref Short])"
        1482         />
        1483                                            
        1484        </xsl:when >
        1485       
        1486                                           
        1487        <xsl:when 
        1488         test="stri ng-length( normalize- space($sub stanceAdmi n/n1:consu mable/n1:m anufacture dProduct/n 1:manufact uredMateri al/n1:code /@displayN ame))>0"
        1489        >
        1490                                                    
        1491         <xsl:value -of 
        1492          select="no rmalize-sp ace($subst anceAdmin/ n1:consuma ble/n1:man ufacturedP roduct/n1: manufactur edMaterial /n1:code/@ displayNam e)"
        1493         />
        1494                                            
        1495        </xsl:when >
        1496       
        1497                                           
        1498        <xsl:when 
        1499         test="stri ng-length( normalize- space($sub stanceAdmi n/n1:consu mable/n1:m anufacture dProduct/n 1:manufact uredMateri al/n1:name ))>0"
        1500        >
        1501                                                    
        1502         <xsl:value -of 
        1503          select="no rmalize-sp ace($subst anceAdmin/ n1:consuma ble/n1:man ufacturedP roduct/n1: manufactur edMaterial /n1:name)"
        1504         />
        1505                                            
        1506        </xsl:when >
        1507       
        1508                                           
        1509        <xsl:when 
        1510         test="stri ng-length( normalize- space($sub stanceAdmi n/n1:consu mable/n1:m anufacture dProduct/n 1:manufact uredMateri al/n1:code /n1:transl ation/@dis playName)) >0"
        1511        >
        1512                                                    
        1513         <xsl:value -of 
        1514          select="no rmalize-sp ace($subst anceAdmin/ n1:consuma ble/n1:man ufacturedP roduct/n1: manufactur edMaterial /n1:code/n 1:translat ion/@displ ayName)"
        1515         />
        1516                                            
        1517        </xsl:when >
        1518       
        1519                                           
        1520        <xsl:when 
        1521         test="stri ng-length( normalize- space($row /../n1:tex t//n1:td[@ ID=$refSho rt]))>0"
        1522        >
        1523                                                    
        1524         <xsl:value -of 
        1525          select="no rmalize-sp ace($row/. ./n1:text/ /n1:td[@ID =$refShort ])"
        1526         />
        1527                                            
        1528        </xsl:when >
        1529                                           
        1530                                           
        1531        <xsl:other wise>
        1532                                                    
        1533         <xsl:value -of 
        1534          select="no rmalize-sp ace($subst anceAdmin/ n1:consuma ble/n1:man ufacturedP roduct/n1: manufactur edMaterial /n1:code/n 1:original Text)"
        1535         />
        1536                                            
        1537        </xsl:othe rwise>
        1538                                  
        1539       </xsl:choo se>
        1540                        
        1541      </xsl:if>
        1542              
        1543     </xsl:temp late>
        1544    
        1545       
        1546     <xsl:templ ate 
        1547      name="medE xpireDateS tring"
        1548     >
        1549          
        1550      <xsl:param  
        1551       name="subs tanceAdmin "
        1552      />
        1553          
        1554      <xsl:call- template 
        1555       name="shor tenDate"
        1556      >
        1557             
        1558       <xsl:with- param 
        1559        name="inSt ring"
        1560       >
        1561                
        1562        <xsl:choos e>
        1563                   
        1564         <xsl:when 
        1565          test="stri ng-length( $substance Admin/n1:e ntryRelati onship[@ty peCode='RE FR']/n1:su pply[@clas sCode='SPL Y' and @mo odCode='IN T']/n1:eff ectiveTime /@value)>1 "
        1566         >
        1567                       
        1568          <xsl:value -of 
        1569           select="$s ubstanceAd min/n1:ent ryRelation ship[@type Code='REFR ']/n1:supp ly[@classC ode='SPLY'  and @mood Code='INT' ]/n1:effec tiveTime/@ value"
        1570          />
        1571                    
        1572         </xsl:when >
        1573                   
        1574         <xsl:when 
        1575          test="stri ng-length( $substance Admin/n1:e ffectiveTi me/n1:high /@value)>1 "
        1576         >
        1577                       
        1578          <xsl:value -of 
        1579           select="$s ubstanceAd min/n1:eff ectiveTime /n1:high/@ value"
        1580          />
        1581                    
        1582         </xsl:when >
        1583                   
        1584         <xsl:when 
        1585          test="stri ng-length( $substance Admin/n1:c onsumable/ n1:manufac turedProdu ct/n1:manu facturedMa terial/n1: entryRelat ionship[@t ypeCode='R EFR']/n1:s upply[@cla ssCode='SP LY' and @m oodCode='I NT']/n1:ef fectiveTim e/n1:high/ @value)>1"
        1586         >
        1587                       
        1588          <xsl:value -of 
        1589           select="$s ubstanceAd min/n1:con sumable/n1 :manufactu redProduct /n1:manufa cturedMate rial/n1:en tryRelatio nship[@typ eCode='REF R']/n1:sup ply[@class Code='SPLY ' and @moo dCode='INT ']/n1:effe ctiveTime/ n1:high/@v alue"
        1590          />
        1591                    
        1592         </xsl:when >
        1593                 
        1594        </xsl:choo se>
        1595              
        1596       </xsl:with -param>
        1597           
        1598      </xsl:call -template>
        1599        
        1600     </xsl:temp late>
        1601    
        1602             
        1603     <xsl:templ ate 
        1604      name="getM edStatusSt ring"
        1605     >
        1606                       
        1607      <xsl:param  
        1608       name="subs tanceAdmin "
        1609      />
        1610                       
        1611      <xsl:if 
        1612       test="$sub stanceAdmi n"
        1613      >
        1614                                 
        1615       <xsl:choos e>
        1616                                           
        1617        <xsl:when 
        1618         test="stri ng-length( $substance Admin/n1:e ntryRelati onship[@ty peCode='RE FR']/n1:ob servation[ @classCode ='OBS' and  @moodCode ='EVN' and  n1:status Code/@code ='complete d']/n1:val ue/@displa yName)>1"
        1619        >
        1620                                                    
        1621         <xsl:value -of 
        1622          select="$s ubstanceAd min/n1:ent ryRelation ship[@type Code='REFR ']/n1:obse rvation[@c lassCode=' OBS' and @ moodCode=' EVN' and n 1:statusCo de/@code=' completed' ]/n1:value /@displayN ame"
        1623         />
        1624                                            
        1625        </xsl:when >
        1626                                           
        1627        <xsl:when 
        1628         test="stri ng-length( $substance Admin/n1:c onsumable/ n1:manufac turedProdu ct/n1:manu facturedMa terial/n1: entryRelat ionship[@t ypeCode='R EFR']/n1:o bservation [@classCod e='OBS' an d @moodCod e='EVN' an d n1:statu sCode/@cod e='complet ed']/n1:va lue/@displ ayName)>1"
        1629        >
        1630                                                    
        1631         <xsl:value -of 
        1632          select="$s ubstanceAd min/n1:con sumable/n1 :manufactu redProduct /n1:manufa cturedMate rial/n1:en tryRelatio nship[@typ eCode='REF R']/n1:obs ervation[@ classCode= 'OBS' and  @moodCode= 'EVN' and  n1:statusC ode/@code= 'completed ']/n1:valu e/@display Name"
        1633         />
        1634                                            
        1635        </xsl:when >
        1636                                           
        1637        <xsl:when 
        1638         test="stri ng-length( $substance Admin/n1:c onsumable/ n1:manufac turedProdu ct/n1:manu facturedMa terial/n1: entryRelat ionship[@t ypeCode='R EFR']/n1:o bservation [@classCod e='OBS' an d @moodCod e='EVN' an d n1:statu sCode/@cod e='complet ed']/n1:va lue/@displ ayName)>1"
        1639        >
        1640                                                    
        1641         <xsl:value -of 
        1642          select="$s ubstanceAd min/n1:con sumable/n1 :manufactu redProduct /n1:manufa cturedMate rial/n1:en tryRelatio nship[@typ eCode='REF R']/n1:obs ervation[@ classCode= 'OBS' and  @moodCode= 'EVN' and  n1:statusC ode/@code= 'completed ']/n1:valu e/@display Name"
        1643         />
        1644                                            
        1645        </xsl:when >
        1646                                           
        1647        <xsl:when 
        1648         test="stri ng-length( $substance Admin/n1:e ntryRelati onship[@ty peCode='RE FR']/n1:ob servation[ @classCode ='OBS' and  @moodCode ='EVN']/n1 :value/n1: originalTe xt)>1"
        1649        >
        1650                                                    
        1651         <xsl:value -of 
        1652          select="$s ubstanceAd min/n1:ent ryRelation ship[@type Code='REFR ']/n1:obse rvation[@c lassCode=' OBS' and @ moodCode=' EVN']/n1:v alue/n1:or iginalText "
        1653         />
        1654                                            
        1655        </xsl:when >
        1656                                           
        1657        <xsl:when 
        1658         test="stri ng-length( $substance Admin/n1:e ntryRelati onship/n1: observatio n/n1:value [@xsi:type ='CE']/n1: originalTe xt)>1"
        1659        >
        1660                                                    
        1661         <xsl:value -of 
        1662          select="$s ubstanceAd min/n1:ent ryRelation ship/n1:ob servation/ n1:value[@ xsi:type=' CE']/n1:or iginalText "
        1663         />
        1664                                            
        1665        </xsl:when >
        1666                                           
        1667        <xsl:when 
        1668         test="stri ng-length( $substance Admin/n1:e ntryRelati onship/n1: observatio n/n1:value [@xsi:type ='CE']/@di splayName) >1"
        1669        >
        1670                                                    
        1671         <xsl:value -of 
        1672          select="$s ubstanceAd min/n1:ent ryRelation ship/n1:ob servation/ n1:value[@ xsi:type=' CE']/@disp layName"
        1673         />
        1674                                            
        1675        </xsl:when >
        1676                                           
        1677        <xsl:when 
        1678         test="stri ng-length( $substance Admin/n1:s tatusCode/ @code)>1"
        1679        >
        1680                                                    
        1681         <xsl:value -of 
        1682          select="$s ubstanceAd min/n1:sta tusCode/@c ode"
        1683         />
        1684                                            
        1685        </xsl:when >
        1686                                  
        1687       </xsl:choo se>
        1688                        
        1689      </xsl:if>
        1690              
        1691     </xsl:temp late>
        1692    
        1693             
        1694     <xsl:templ ate 
        1695      name="getR xNumString "
        1696     >
        1697                       
        1698      <xsl:param  
        1699       name="subs tanceAdmin "
        1700      />
        1701                       
        1702      <xsl:if 
        1703       test="$sub stanceAdmi n"
        1704      >
        1705                                 
        1706       <xsl:choos e>
        1707                                           
        1708        <xsl:when 
        1709         test="stri ng-length( $substance Admin/n1:e ntryRelati onship[@ty peCode='RE FR']/n1:su pply[@clas sCode='SPL Y' and @mo odCode='EV N']/n1:id/ @extension )>1"
        1710        >
        1711                                                    
        1712         <xsl:value -of 
        1713          select="$s ubstanceAd min/n1:ent ryRelation ship[@type Code='REFR ']/n1:supp ly[@classC ode='SPLY'  and @mood Code='EVN' ]/n1:id/@e xtension"
        1714         />
        1715                                            
        1716        </xsl:when >
        1717                                           
        1718        <xsl:when 
        1719         test="stri ng-length( $substance Admin/n1:e ntryRelati onship[@ty peCode='RE FR']/n1:su pply[@clas sCode='SPL Y' and @mo odCode='IN T']/n1:id/ @extension )>1"
        1720        >
        1721                                                    
        1722         <xsl:value -of 
        1723          select="$s ubstanceAd min/n1:ent ryRelation ship[@type Code='REFR ']/n1:supp ly[@classC ode='SPLY'  and @mood Code='INT' ]/n1:id/@e xtension"
        1724         />
        1725                                            
        1726        </xsl:when >
        1727                                           
        1728        <xsl:when 
        1729         test="stri ng-length( $substance Admin/n1:c onsumable/ n1:manufac turedProdu ct/n1:manu facturedMa terial/n1: entryRelat ionship[@t ypeCode='R EFR']/n1:s upply[@moo dCode='EVN ' and @cla ssCode='SP LY']/n1:id /@extensio n)>1"
        1730        >
        1731                                                    
        1732         <xsl:value -of 
        1733          select="$s ubstanceAd min/n1:con sumable/n1 :manufactu redProduct /n1:manufa cturedMate rial/n1:en tryRelatio nship[@typ eCode='REF R']/n1:sup ply[@moodC ode='EVN'  and @class Code='SPLY ']/n1:id/@ extension"
        1734         />
        1735                                            
        1736        </xsl:when >
        1737                                  
        1738       </xsl:choo se>
        1739                        
        1740      </xsl:if>
        1741              
        1742     </xsl:temp late>
        1743    
        1744             
        1745     <xsl:templ ate 
        1746      name="getM edProvider "
        1747     >
        1748                       
        1749      <xsl:param  
        1750       name="subs tanceAdmin "
        1751      />
        1752                       
        1753      <xsl:varia ble 
        1754       name="assi gnedPerson 1" 
        1755       select="$s ubstanceAd min/n1:ent ryRelation ship[@type Code='REFR ']/n1:supp ly/n1:auth or/n1:assi gnedAuthor /n1:assign edPerson"
        1756      />
        1757                       
        1758      <xsl:varia ble 
        1759       name="assi gnedPerson 2" 
        1760       select="$s ubstanceAd min/n1:ent ryRelation ship/n1:su pply/n1:au thor/n1:as signedAuth or/n1:assi gnedPerson "
        1761      />
        1762                       
        1763      <xsl:varia ble 
        1764       name="assi gnedPerson 3" 
        1765       select="$s ubstanceAd min/n1:con sumable/n1 :manufactu redProduct /n1:manufa cturedMate rial/n1:en tryRelatio nship/n1:s upply/n1:a uthor/n1:a ssignedAut hor/n1:ass ignedPerso n"
        1766      />
        1767                       
        1768      <xsl:varia ble 
        1769       name="assi gnedPerson 4" 
        1770       select="$s ubstanceAd min/n1:aut hor/n1:ass ignedAutho r/n1:assig nedPerson"
        1771      />
        1772                       
        1773      <xsl:if 
        1774       test="$sub stanceAdmi n"
        1775      >
        1776                                 
        1777       <xsl:choos e>
        1778                                           
        1779        <xsl:when 
        1780         test="stri ng-length( $assignedP erson1/n1: name)>1"
        1781        >
        1782                                                    
        1783         <xsl:choos e>
        1784                                                              
        1785          <xsl:when 
        1786           test="$ass ignedPerso n1/n1:name /n1:given  and $assig nedPerson1 /n1:name/n 1:family"
        1787          >
        1788                                                                        
        1789           <xsl:call- template 
        1790            name="form atProvider Name"
        1791           >
        1792                                                                                  
        1793            <xsl:with- param 
        1794             name="firs t" 
        1795             select="$a ssignedPer son1/n1:na me/n1:give n"
        1796            />
        1797                                                                                  
        1798            <xsl:with- param 
        1799             name="last
        1800             select="$a ssignedPer son1/n1:na me/n1:fami ly"
        1801            />
        1802                                                                         
        1803           </xsl:call -template>
        1804                                                               
        1805          </xsl:when >
        1806                                                              
        1807          <xsl:other wise>
        1808                                                                        
        1809           <xsl:value -of 
        1810            select="$a ssignedPer son1/n1:na me"
        1811           />
        1812                                                               
        1813          </xsl:othe rwise>
        1814                                                     
        1815         </xsl:choo se>
        1816                                            
        1817        </xsl:when >
        1818                                           
        1819        <xsl:when 
        1820         test="stri ng-length( $assignedP erson4/n1: name)>1"
        1821        >
        1822                                                    
        1823         <xsl:choos e>
        1824                                                              
        1825          <xsl:when 
        1826           test="$ass ignedPerso n4/n1:name /n1:given  and $assig nedPerson4 /n1:name/n 1:family"
        1827          >
        1828                                                                        
        1829           <xsl:call- template 
        1830            name="form atProvider Name"
        1831           >
        1832                                                                                  
        1833            <xsl:with- param 
        1834             name="firs t" 
        1835             select="$a ssignedPer son4/n1:na me/n1:give n"
        1836            />
        1837                                                                                  
        1838            <xsl:with- param 
        1839             name="last
        1840             select="$a ssignedPer son4/n1:na me/n1:fami ly"
        1841            />
        1842                                                                         
        1843           </xsl:call -template>
        1844                                                               
        1845          </xsl:when >
        1846                                                              
        1847          <xsl:other wise>
        1848                                                                        
        1849           <xsl:value -of 
        1850            select="$a ssignedPer son4/n1:na me"
        1851           />
        1852                                                               
        1853          </xsl:othe rwise>
        1854                                                     
        1855         </xsl:choo se>
        1856                                            
        1857        </xsl:when >
        1858                                           
        1859        <xsl:when 
        1860         test="stri ng-length( $substance Admin/n1:e ntryRelati onship/n1: supply/n1: author/n1: assignedAu thor/n1:as signedPers on/n1:name )>1"
        1861        >
        1862                                                    
        1863         <xsl:choos e>
        1864                                                              
        1865          <xsl:when 
        1866           test="$ass ignedPerso n2/n1:name /n1:given  and $assig nedPerson2 /n1:name/n 1:family"
        1867          >
        1868                                                                        
        1869           <xsl:call- template 
        1870            name="form atProvider Name"
        1871           >
        1872                                                                                  
        1873            <xsl:with- param 
        1874             name="firs t" 
        1875             select="$s ubstanceAd min/n1:ent ryRelation ship/n1:su pply/n1:au thor/n1:as signedAuth or/n1:assi gnedPerson /n1:name/n 1:given"
        1876            />
        1877                                                                                  
        1878            <xsl:with- param 
        1879             name="last
        1880             select="$s ubstanceAd min/n1:ent ryRelation ship/n1:su pply/n1:au thor/n1:as signedAuth or/n1:assi gnedPerson /n1:name/n 1:family"
        1881            />
        1882                                                                         
        1883           </xsl:call -template>
        1884                                                               
        1885          </xsl:when >
        1886                                                              
        1887          <xsl:other wise>
        1888                                                                        
        1889           <xsl:value -of 
        1890            select="$s ubstanceAd min/n1:ent ryRelation ship/n1:su pply/n1:au thor/n1:as signedAuth or/n1:assi gnedPerson /n1:name"
        1891           />
        1892                                                               
        1893          </xsl:othe rwise>
        1894                                                     
        1895         </xsl:choo se>
        1896                                            
        1897        </xsl:when >
        1898                                           
        1899        <xsl:when 
        1900         test="stri ng-length( $substance Admin/n1:c onsumable/ n1:manufac turedProdu ct/n1:manu facturedMa terial/n1: entryRelat ionship/n1 :supply/n1 :author/n1 :assignedA uthor/n1:a ssignedPer son/n1:nam e)>1"
        1901        >
        1902                                                    
        1903         <xsl:choos e>
        1904                                                              
        1905          <xsl:when 
        1906           test="$ass ignedPerso n3/n1:name /n1:given  and $assig nedPerson3 /n1:name/n 1:family"
        1907          >
        1908                                                                        
        1909           <xsl:call- template 
        1910            name="form atProvider Name"
        1911           >
        1912                                                                                  
        1913            <xsl:with- param 
        1914             name="firs t" 
        1915             select="$s ubstanceAd min/n1:con sumable/n1 :manufactu redProduct /n1:manufa cturedMate rial/n1:en tryRelatio nship/n1:s upply/n1:a uthor/n1:a ssignedAut hor/n1:ass ignedPerso n/n1:name/ n1:given"
        1916            />
        1917                                                                                  
        1918            <xsl:with- param 
        1919             name="last
        1920             select="$s ubstanceAd min/n1:con sumable/n1 :manufactu redProduct /n1:manufa cturedMate rial/n1:en tryRelatio nship/n1:s upply/n1:a uthor/n1:a ssignedAut hor/n1:ass ignedPerso n/n1:name/ n1:family"
        1921            />
        1922                                                                         
        1923           </xsl:call -template>
        1924                                                               
        1925          </xsl:when >
        1926                                                              
        1927          <xsl:other wise>
        1928                                                                        
        1929           <xsl:value -of 
        1930            select="$s ubstanceAd min/n1:con sumable/n1 :manufactu redProduct /n1:manufa cturedMate rial/n1:en tryRelatio nship/n1:s upply/n1:a uthor/n1:a ssignedAut hor/n1:ass ignedPerso n/n1:name"
        1931           />
        1932                                                               
        1933          </xsl:othe rwise>
        1934                                                     
        1935         </xsl:choo se>
        1936                                            
        1937        </xsl:when >
        1938                                  
        1939       </xsl:choo se>
        1940                        
        1941      </xsl:if>
        1942              
        1943     </xsl:temp late>
        1944    
        1945       
        1946     <xsl:templ ate 
        1947      name="getM edQuantity String"
        1948     >
        1949          
        1950      <xsl:param  
        1951       name="subs tanceAdmin "
        1952      />
        1953          
        1954      <xsl:if 
        1955       test="$sub stanceAdmi n"
        1956      >
        1957             
        1958       <xsl:choos e>
        1959                
        1960        <xsl:when 
        1961         test="stri ng-length( normalize- space($sub stanceAdmi n/n1:consu mable/n1:m anufacture dProduct/n 1:manufact uredMateri al/n1:entr yRelations hip[@typeC ode='REFR' ]/n1:suppl y[@classCo de='SPLY'  and @moodC ode='INT'] /n1:quanti ty/@value) )>0"
        1962        >
        1963                   
        1964         <xsl:value -of 
        1965          select="no rmalize-sp ace($subst anceAdmin/ n1:consuma ble/n1:man ufacturedP roduct/n1: manufactur edMaterial /n1:entryR elationshi p[@typeCod e='REFR']/ n1:supply[ @classCode ='SPLY' an d @moodCod e='INT']/n 1:quantity /@value)"
        1966         />
        1967                   
        1968         <xsl:if 
        1969          test="stri ng-length( $substance Admin/n1:c onsumable/ n1:manufac turedProdu ct/n1:manu facturedMa terial/n1: entryRelat ionship[@t ypeCode='R EFR']/n1:s upply[@cla ssCode='SP LY' and @m oodCode='I NT']/n1:qu antity/@un it)>0"
        1970         >
        1971                       
        1972          <xsl:text>
        1973            
        1974          </xsl:text >
        1975                       
        1976          <xsl:call- template 
        1977           name="getM edQuantity Unit"
        1978          >
        1979                          
        1980           <xsl:with- param 
        1981            name="unit Path" 
        1982            select="$s ubstanceAd min/n1:con sumable/n1 :manufactu redProduct /n1:manufa cturedMate rial/n1:en tryRelatio nship[@typ eCode='REF R']/n1:sup ply[@class Code='SPLY ' and @moo dCode='INT ']/n1:quan tity/@unit "
        1983           />
        1984                        
        1985          </xsl:call -template>
        1986                    
        1987         </xsl:if>
        1988                 
        1989        </xsl:when >
        1990                
        1991        <xsl:when 
        1992         test="stri ng-length( normalize- space($sub stanceAdmi n/n1:entry Relationsh ip[@typeCo de='COMP'] /n1:supply [@classCod e='SPLY' a nd @moodCo de='EVN']/ n1:quantit y/@value)) >0"
        1993        >
        1994                   
        1995         <xsl:value -of 
        1996          select="no rmalize-sp ace($subst anceAdmin/ n1:entryRe lationship [@typeCode ='COMP']/n 1:supply[@ classCode= 'SPLY' and  @moodCode ='EVN']/n1 :quantity/ @value)"
        1997         />
        1998                   
        1999         <xsl:if 
        2000          test="stri ng-length( $substance Admin/n1:e ntryRelati onship[@ty peCode='CO MP']/n1:su pply[@clas sCode='SPL Y' and @mo odCode='EV N']/n1:qua ntity/@uni t)>0"
        2001         >
        2002                       
        2003          <xsl:text>
        2004            
        2005          </xsl:text >
        2006                       
        2007          <xsl:call- template 
        2008           name="getM edQuantity Unit"
        2009          >
        2010                          
        2011           <xsl:with- param 
        2012            name="unit Path" 
        2013            select="$s ubstanceAd min/n1:ent ryRelation ship[@type Code='COMP ']/n1:supp ly[@classC ode='SPLY'  and @mood Code='EVN' ]/n1:quant ity/@unit"
        2014           />
        2015                        
        2016          </xsl:call -template>
        2017                    
        2018         </xsl:if>
        2019                 
        2020        </xsl:when >
        2021                
        2022        <xsl:when 
        2023         test="stri ng-length( normalize- space($sub stanceAdmi n/n1:entry Relationsh ip[@typeCo de='REFR'] /n1:supply /n1:quanti ty/@value) )>0"
        2024        >
        2025                   
        2026         <xsl:value -of 
        2027          select="no rmalize-sp ace($subst anceAdmin/ n1:entryRe lationship [@typeCode ='REFR']/n 1:supply/n 1:quantity /@value)"
        2028         />
        2029                   
        2030         <xsl:if 
        2031          test="stri ng-length( $substance Admin/n1:e ntryRelati onship[@ty peCode='RE FR']/n1:su pply/n1:qu antity/@un it)>0"
        2032         >
        2033                       
        2034          <xsl:text>
        2035            
        2036          </xsl:text >
        2037                       
        2038          <xsl:call- template 
        2039           name="getM edQuantity Unit"
        2040          >
        2041                          
        2042           <xsl:with- param 
        2043            name="unit Path" 
        2044            select="$s ubstanceAd min/n1:ent ryRelation ship[@type Code='REFR ']/n1:supp ly/n1:quan tity/@unit "
        2045           />
        2046                        
        2047          </xsl:call -template>
        2048                    
        2049         </xsl:if>
        2050                 
        2051        </xsl:when >
        2052              
        2053       </xsl:choo se>
        2054           
        2055      </xsl:if>
        2056        
        2057     </xsl:temp late>
        2058    
        2059       
        2060     <xsl:templ ate 
        2061      name="getM edQuantity Unit"
        2062     >
        2063          
        2064      <xsl:param  
        2065       name="unit Path"
        2066      />
        2067          
        2068      <xsl:choos e>
        2069             
        2070       <xsl:when 
        2071        test="cont ains($unit Path,'{')"
        2072       >
        2073                
        2074        <xsl:call- template 
        2075         name="remo veBraces"
        2076        >
        2077                   
        2078         <xsl:with- param 
        2079          name="brac edText" 
        2080          select="$u nitPath"
        2081         />
        2082                 
        2083        </xsl:call -template>
        2084              
        2085       </xsl:when >
        2086             
        2087       <xsl:other wise>
        2088                
        2089        <xsl:value -of 
        2090         select="no rmalize-sp ace($unitP ath)"
        2091        />
        2092              
        2093       </xsl:othe rwise>
        2094           
        2095      </xsl:choo se>
        2096        
        2097     </xsl:temp late>
        2098       
        2099       
        2100     <xsl:templ ate 
        2101      name="remo veBraces"
        2102     >
        2103          
        2104      <xsl:param  
        2105       name="brac edText"
        2106      />
        2107          
        2108      <xsl:varia ble 
        2109       name="brac elessText1
        2110       select="su bstring-af ter($brace dText, '{' )"
        2111      />
        2112          
        2113      <xsl:value -of 
        2114       select="su bstring-be fore($brac elessText1 ,'}')"
        2115      />
        2116        
        2117     </xsl:temp late>
        2118    
        2119             
        2120     <xsl:templ ate 
        2121      name="getS ig"
        2122     >
        2123                       
        2124      <xsl:param  
        2125       name="subs tanceAdmin "
        2126      />
        2127                       
        2128      <xsl:varia ble 
        2129       name="sigI d1" 
        2130       select="$s ubstanceAd min/n1:tex t/n1:refer ence/@valu e"
        2131      />      
        2132                       
        2133      <xsl:varia ble 
        2134       name="sigI d2" 
        2135       select="su bstring-af ter($sigId 1,'#')"
        2136      />
        2137          
        2138      <xsl:varia ble 
        2139       name="sigI d3"
        2140      >
        2141             
        2142       <xsl:if 
        2143        test="$sub stanceAdmi n/n1:entry Relationsh ip/n1:act/ n1:text/n1 :reference /@value an d $isIHIE"
        2144       >
        2145                
        2146        <xsl:value -of 
        2147         select="$s ubstanceAd min/n1:ent ryRelation ship/n1:ac t/n1:text/ n1:referen ce/@value"
        2148        />
        2149              
        2150       </xsl:if>
        2151           
        2152      </xsl:vari able>
        2153          
        2154      <xsl:if 
        2155       test="stri ng-length( $sigId3)"
        2156      >
        2157             
        2158       <xsl:call- template 
        2159        name="getS igWithKey"
        2160       >
        2161                
        2162        <xsl:with- param 
        2163         name="key"  
        2164         select="su bstring-af ter($sigId 3,'#')"
        2165        />
        2166                
        2167        <xsl:with- param 
        2168         name="subs tanceAdmin
        2169         select="$s ubstanceAd min"
        2170        />
        2171              
        2172       </xsl:call -template>
        2173           
        2174      </xsl:if>
        2175          
        2176      <xsl:varia ble 
        2177       name="resu lt1"
        2178      >
        2179                                 
        2180       <xsl:call- template 
        2181        name="getS igWithKey"
        2182       >
        2183                                           
        2184        <xsl:with- param 
        2185         name="key"  
        2186         select="$s igId1"
        2187        />
        2188                                           
        2189        <xsl:with- param 
        2190         name="subs tanceAdmin
        2191         select="$s ubstanceAd min"
        2192        />
        2193                                  
        2194       </xsl:call -template>
        2195                        
        2196      </xsl:vari able>
        2197                       
        2198      <xsl:if 
        2199       test="stri ng-length( $result1)"
        2200      >
        2201                                 
        2202       <xsl:value -of 
        2203        select="$r esult1"
        2204       />
        2205                        
        2206      </xsl:if>
        2207          
        2208      <xsl:call- template 
        2209       name="getS igWithKey"
        2210      >
        2211             
        2212       <xsl:with- param 
        2213        name="key"  
        2214        select="$s igId2"
        2215       />
        2216             
        2217       <xsl:with- param 
        2218        name="subs tanceAdmin
        2219        select="$s ubstanceAd min"
        2220       />
        2221           
        2222      </xsl:call -template>
        2223          
        2224      <xsl:if 
        2225       test="not( $sigId1) a nd not($si gId2)"
        2226      >
        2227               
        2228       <xsl:call- template 
        2229        name="getS igWithNoKe y"
        2230       >
        2231                  
        2232        <xsl:with- param 
        2233         name="subs tanceAdmin
        2234         select="$s ubstanceAd min"
        2235        />
        2236                
        2237       </xsl:call -template>
        2238           
        2239      </xsl:if>
        2240              
        2241     </xsl:temp late>
        2242    
        2243             
        2244     <xsl:templ ate 
        2245      name="getS igWithKey"
        2246     >
        2247                       
        2248      <xsl:param  
        2249       name="subs tanceAdmin "
        2250      />
        2251                       
        2252      <xsl:param  
        2253       name="key"
        2254      />
        2255                       
        2256      <xsl:choos e>
        2257                                 
        2258       <xsl:when 
        2259        test="stri ng-length( $substance Admin/../. ./n1:text/ /n1:conten t[@ID=$key ])>0"
        2260       >
        2261                                           
        2262        <xsl:value -of 
        2263         select="no rmalize-sp ace($subst anceAdmin/ ../../n1:t ext//n1:co ntent[@ID= $key])"
        2264        />
        2265                                  
        2266       </xsl:when >
        2267                                 
        2268       <xsl:when 
        2269        test="stri ng-length( $substance Admin/../. ./n1:text/ /n1:td[@ID =$key])>0"
        2270       >
        2271                                           
        2272        <xsl:value -of 
        2273         select="no rmalize-sp ace($subst anceAdmin/ ../../n1:t ext//n1:td [@ID=$key] )"
        2274        />
        2275                                  
        2276       </xsl:when >
        2277           
        2278      </xsl:choo se>
        2279              
        2280     </xsl:temp late>
        2281       
        2282       
        2283     <xsl:templ ate 
        2284      name="getS igWithNoKe y"
        2285     >
        2286          
        2287      <xsl:param  
        2288       name="subs tanceAdmin "
        2289      />
        2290          
        2291      <xsl:choos e>
        2292             
        2293       <xsl:when 
        2294        test="$sub stanceAdmi n/n1:text"
        2295       >
        2296                 
        2297        <xsl:value -of 
        2298         select="no rmalize-sp ace($subst anceAdmin/ n1:text)"
        2299        />
        2300              
        2301       </xsl:when >
        2302           
        2303      </xsl:choo se>
        2304        
        2305     </xsl:temp late>
        2306    
        2307             
        2308     <xsl:templ ate 
        2309      name="getM edSource"
        2310     >
        2311                       
        2312      <xsl:param  
        2313       name="subs tanceAdmin "
        2314      />
        2315                       
        2316      <xsl:choos e>
        2317                                 
        2318       <xsl:when 
        2319        test="$sub stanceAdmi n/n1:autho r/n1:assig nedAuthor/ n1:represe ntedOrgani zation/n1: name"
        2320       >
        2321                                           
        2322        <xsl:value -of 
        2323         select="$s ubstanceAd min/n1:aut hor/n1:ass ignedAutho r/n1:repre sentedOrga nization/n 1:name"
        2324        />
        2325                                  
        2326       </xsl:when >
        2327                                 
        2328       <xsl:when 
        2329        test="$sub stanceAdmi n/n1:entry Relationsh ip[@typeCo de='REFR'] /n1:supply [@classCod e='SPLY' a nd @moodCo de='INT']/ n1:author/ n1:assigne dAuthor/n1 :represent edOrganiza tion/n1:na me"
        2330       >
        2331                                           
        2332        <xsl:value -of 
        2333         select="$s ubstanceAd min/n1:ent ryRelation ship[@type Code='REFR ']/n1:supp ly[@classC ode='SPLY'  and @mood Code='INT' ]/n1:autho r/n1:assig nedAuthor/ n1:represe ntedOrgani zation/n1: name"
        2334        />
        2335                                  
        2336       </xsl:when >
        2337                                 
        2338       <xsl:when 
        2339        test="$sub stanceAdmi n/n1:entry Relationsh ip/n1:supp ly/n1:auth or/n1:assi gnedAuthor /n1:code/@ displayNam e"
        2340       >
        2341                                           
        2342        <xsl:value -of 
        2343         select="$s ubstanceAd min/n1:ent ryRelation ship/n1:su pply/n1:au thor/n1:as signedAuth or/n1:code /@displayN ame"
        2344        />
        2345                                  
        2346       </xsl:when >
        2347             
        2348       <xsl:other wise>
        2349                                           
        2350        <xsl:call- template 
        2351         name="na"
        2352        />
        2353                                  
        2354       </xsl:othe rwise>
        2355                        
        2356      </xsl:choo se>
        2357              
        2358     </xsl:temp late>
        2359    
        2360             
        2361     <!-- Probl ems -->
        2362    
        2363             
        2364     <xsl:templ ate 
        2365      name="prob Name"
        2366     >
        2367                       
        2368      <xsl:param  
        2369       name="prob Entry"
        2370      />
        2371                       
        2372      <xsl:varia ble 
        2373       name="path
        2374       select="$p robEntry/. ."
        2375      />
        2376                       
        2377      <xsl:varia ble 
        2378       name="prob Reference1
        2379       select="$p robEntry/n 1:act/n1:e ntryRelati onship/n1: observatio n/n1:text/ n1:referen ce/@value"
        2380      />
        2381                       
        2382      <xsl:varia ble 
        2383       name="prob Reference2
        2384       select="su bstring-af ter($probR eference1, '#')"
        2385      />
        2386                       
        2387      <xsl:choos e>
        2388             
        2389       <xsl:when 
        2390        test="($pr obEntry/n1 :act/n1:en tryRelatio nship/n1:o bservation /n1:value/ @displayNa me)"
        2391       >
        2392          
        2393        <!--remove d 'and ($i sMultiCare )' code fr om this li ne via VM  patch WEBV *1.0*32 (b uild v16.1 .6)-->
        2394                
        2395        <xsl:value -of 
        2396         select="$p robEntry/n 1:act/n1:e ntryRelati onship/n1: observatio n/n1:value /@displayN ame"
        2397        />
        2398              
        2399       </xsl:when >
        2400                                 
        2401       <xsl:when 
        2402        test="$pat h/n1:text/ /n1:conten t[@ID=$pro bReference 1]"
        2403       >
        2404                                           
        2405        <xsl:value -of 
        2406         select="$p ath/n1:tex t//n1:cont ent[@ID=$p robReferen ce1]"
        2407        />
        2408                                  
        2409       </xsl:when >
        2410                                 
        2411       <xsl:when 
        2412        test="$pat h/n1:text/ /n1:conten t[@ID=$pro bReference 2]"
        2413       >
        2414                                           
        2415        <xsl:value -of 
        2416         select="$p ath/n1:tex t//n1:cont ent[@ID=$p robReferen ce2]"
        2417        />
        2418                                  
        2419       </xsl:when >
        2420                                 
        2421       <xsl:when 
        2422        test="$pat h/n1:text/ /n1:paragr aph[@ID=$p robReferen ce1]"
        2423       >
        2424                                           
        2425        <xsl:value -of 
        2426         select="$p ath/n1:tex t//n1:para graph[@ID= $probRefer ence1]"
        2427        />
        2428                                  
        2429       </xsl:when >
        2430                                 
        2431       <xsl:when 
        2432        test="$pat h/n1:text/ /n1:paragr aph[@ID=$p robReferen ce2]"
        2433       >
        2434                                           
        2435        <xsl:value -of 
        2436         select="$p ath/n1:tex t//n1:para graph[@ID= $probRefer ence2]"
        2437        />
        2438                                  
        2439       </xsl:when >
        2440                                 
        2441       <xsl:when 
        2442        test="$pat h/n1:text/ /n1:td[@ID =$probRefe rence1]"
        2443       >
        2444                                           
        2445        <xsl:value -of 
        2446         select="$p ath/n1:tex t//n1:td[@ ID=$probRe ference1]"
        2447        />
        2448                                  
        2449       </xsl:when >
        2450                                 
        2451       <xsl:when 
        2452        test="$pat h/n1:text/ /n1:td[@ID =$probRefe rence2]"
        2453       >
        2454                                           
        2455        <xsl:value -of 
        2456         select="$p ath/n1:tex t//n1:td[@ ID=$probRe ference2]"
        2457        />
        2458                                  
        2459       </xsl:when >
        2460                                 
        2461       <xsl:other wise>
        2462                                           
        2463        <xsl:call- template 
        2464         name="na"
        2465        />
        2466                                  
        2467       </xsl:othe rwise>
        2468                        
        2469      </xsl:choo se>
        2470              
        2471     </xsl:temp late>
        2472    
        2473             
        2474     <xsl:templ ate 
        2475      name="getP roblemOnse tDateStrin g"
        2476     >
        2477                       
        2478      <xsl:param  
        2479       name="act"
        2480      />
        2481                       
        2482      <xsl:if 
        2483       test="$act "
        2484      >
        2485                                 
        2486       <xsl:choos e>
        2487                                           
        2488        <xsl:when 
        2489         test="stri ng-length( $act/n1:en tryRelatio nship/n1:o bservation /n1:effect iveTime/n1 :low/@valu e)>1"
        2490        >
        2491                                                    
        2492         <xsl:value -of 
        2493          select="$a ct/n1:entr yRelations hip/n1:obs ervation/n 1:effectiv eTime/n1:l ow/@value"
        2494         />
        2495                                            
        2496        </xsl:when >
        2497                                           
        2498        <xsl:when 
        2499         test="stri ng-length( $act/n1:ef fectiveTim e/n1:low/@ value)>1"
        2500        >
        2501                                                    
        2502         <xsl:value -of 
        2503          select="n1 :act/n1:ef fectiveTim e/n1:low/@ value"
        2504         />
        2505                                            
        2506        </xsl:when >
        2507                                  
        2508       </xsl:choo se>
        2509                        
        2510      </xsl:if>
        2511              
        2512     </xsl:temp late>
        2513    
        2514             
        2515     <xsl:templ ate 
        2516      name="getP roblemCode "
        2517     >
        2518                       
        2519      <xsl:param  
        2520       name="rowD ata"
        2521      />
        2522                       
        2523      <xsl:choos e>
        2524                                 
        2525       <xsl:when 
        2526        test="$row Data/n1:va lue/@code  and not ($ isDoD)"
        2527       >
        2528                                           
        2529        <xsl:value -of 
        2530         select="$r owData/n1: value/@cod e"
        2531        />
        2532                                  
        2533       </xsl:when >
        2534                                 
        2535       <xsl:when 
        2536        test="($ro wData/n1:v alue/n1:tr anslation/ @code) and  not($rowD ata/n1:val ue/n1:tran slation/@c ode='null' )"
        2537       >
        2538                                           
        2539        <xsl:value -of 
        2540         select="$r owData/n1: value/n1:t ranslation /@code"
        2541        />
        2542                                  
        2543       </xsl:when >
        2544                                 
        2545       <xsl:other wise>
        2546                                           
        2547        <xsl:call- template 
        2548         name="na"
        2549        />
        2550                                  
        2551       </xsl:othe rwise>
        2552                        
        2553      </xsl:choo se>
        2554              
        2555     </xsl:temp late>
        2556    
        2557             
        2558     <xsl:templ ate 
        2559      name="getP roblemSour ce"
        2560     >
        2561                       
        2562      <xsl:param  
        2563       name="row"
        2564      />
        2565                       
        2566      <xsl:choos e>
        2567             
        2568       <xsl:when 
        2569        test="$row /n1:act/n1 :author/n1 :assignedA uthor/n1:r epresented Organizati on/n1:name "
        2570       >
        2571                                           
        2572        <xsl:value -of 
        2573         select="$r ow/n1:act/ n1:author/ n1:assigne dAuthor/n1 :represent edOrganiza tion/n1:na me"
        2574        />
        2575                                  
        2576       </xsl:when >
        2577                                 
        2578       <xsl:when 
        2579        test="$row /n1:act/n1 :performer /n1:assign edEntity/n 1:represen tedOrganiz ation/n1:n ame"
        2580       >
        2581                                           
        2582        <xsl:value -of 
        2583         select="$r ow/n1:act/ n1:perform er/n1:assi gnedEntity /n1:repres entedOrgan ization/n1 :name"
        2584        />
        2585                                  
        2586       </xsl:when >
        2587             
        2588       <xsl:when 
        2589        test="$row /n1:act/n1 :entryRela tionship/n 1:observat ion/n1:par ticipant/n 1:particip antRole/n1 :scopingEn tity/n1:de sc and $is IHIE"
        2590       >
        2591                
        2592        <xsl:value -of 
        2593         select="$r ow/n1:act/ n1:entryRe lationship /n1:observ ation/n1:p articipant /n1:partic ipantRole/ n1:scoping Entity/n1: desc"
        2594        />
        2595              
        2596       </xsl:when >
        2597             
        2598       <xsl:when 
        2599        test="$row /n1:act/n1 :entryRela tionship/n 1:observat ion/n1:par ticipant/@ typeCode =  'AUT'"
        2600       >
        2601                
        2602        <xsl:value -of 
        2603         select="$r ow/n1:act/ n1:entryRe lationship /n1:observ ation/n1:p articipant /n1:partic ipantRole/ n1:playing Entity/n1: desc"
        2604        />
        2605              
        2606       </xsl:when >
        2607             
        2608       <xsl:when 
        2609        test="$row /n1:act/n1 :entryRela tionship/n 1:observat ion/n1:aut hor/n1:ass ignedAutho r/n1:repre sentedOrga nization/n 1:name"
        2610       >
        2611                
        2612        <xsl:value -of 
        2613         select="$r ow/n1:act/ n1:entryRe lationship /n1:observ ation/n1:a uthor/n1:a ssignedAut hor/n1:rep resentedOr ganization /n1:name"
        2614        />
        2615              
        2616       </xsl:when >
        2617           
        2618      </xsl:choo se>
        2619              
        2620     </xsl:temp late>
        2621    
        2622             
        2623     <xsl:templ ate 
        2624      name="getP roblemProv ider"
        2625     >
        2626                       
        2627      <xsl:param  
        2628       name="act"
        2629      />
        2630          
        2631      <xsl:varia ble 
        2632       name="prov iderNumber
        2633       select="$a ct/n1:perf ormer/n1:a ssignedEnt ity/n1:id/ @extension
        2634      />
        2635                       
        2636      <xsl:choos e>
        2637                                 
        2638       <xsl:when 
        2639        test="$act /n1:perfor mer/n1:ass ignedEntit y/n1:assig nedPerson/ n1:name"
        2640       >
        2641                                           
        2642        <xsl:varia ble 
        2643         name="name 1"
        2644        >
        2645                                                    
        2646         <xsl:call- template 
        2647          name="getP ersonNameF romRoot"
        2648         >
        2649                                                              
        2650          <xsl:with- param 
        2651           name="name Root" 
        2652           select="$a ct/n1:perf ormer/n1:a ssignedEnt ity/n1:ass ignedPerso n/n1:name"
        2653          />
        2654                                                     
        2655         </xsl:call -template>
        2656                                            
        2657        </xsl:vari able>
        2658                                           
        2659        <xsl:choos e>
        2660                                                    
        2661         <xsl:when 
        2662          test="stri ng-length( $name1)>0"
        2663         >
        2664                                                              
        2665          <xsl:value -of 
        2666           select="$n ame1"
        2667          />
        2668                                                     
        2669         </xsl:when >
        2670                                                    
        2671         <xsl:other wise>
        2672                                                              
        2673          <xsl:varia ble 
        2674           name="name 2"
        2675          >
        2676                                                                        
        2677           <xsl:call- template 
        2678            name="getP ersonNameF romRoot"
        2679           >
        2680                                                                                  
        2681            <xsl:with- param 
        2682             name="name Root" 
        2683             select="$a ct/n1:perf ormer/n1:a ssignedEnt ity/n1:ass ignedPerso n/n1:name/ n1:perform er[@typeCo de='PRF']/ n1:assigne dEntity/n1 :assignedP erson/n1:n ame"
        2684            />
        2685                                                                         
        2686           </xsl:call -template>
        2687                                                               
        2688          </xsl:vari able>
        2689                                                              
        2690          <xsl:choos e>
        2691                                                                        
        2692           <xsl:when 
        2693            test="stri ng-length( $name2)>0"
        2694           >
        2695                                                                                  
        2696            <xsl:value -of 
        2697             select="$n ame2"
        2698            />
        2699                                                                         
        2700           </xsl:when >
        2701                                                                        
        2702           <xsl:other wise>
        2703                                                                                  
        2704            <xsl:varia ble 
        2705             name="name 3"
        2706            >
        2707                                                                                            
        2708             <xsl:call- template 
        2709              name="getP ersonNameF romRoot"
        2710             >
        2711                                                                                                     
        2712              <xsl:with- param 
        2713               name="name Root" 
        2714               select="$a ct/n1:entr yRelations hip/n1:obs ervation/n 1:entryRel ationship/ n1:observa tion[@clas sCode='OBS ' and @moo dCode='EVN ']/n1:perf ormer/n1:a ssignedEnt ity/n1:ass ignedPerso n/n1:name"
        2715              />
        2716                                                                                             
        2717             </xsl:call -template>
        2718                                                                                   
        2719            </xsl:vari able>
        2720                                                                                  
        2721            <xsl:choos e>
        2722                                                                                            
        2723             <xsl:when 
        2724              test="stri ng-length( $name3)>0"
        2725             >
        2726                                                                                                     
        2727              <xsl:value -of 
        2728               select="$n ame3"
        2729              />
        2730                                                                                             
        2731             </xsl:when >
        2732                                                                                            
        2733             <xsl:other wise>
        2734                                                                                                     
        2735              <xsl:varia ble 
        2736               name="prov iderId" 
        2737               select="$a ct/n1:perf ormer/n1:a ssignedEnt ity/n1:id/ @extension "
        2738              />
        2739                                                                                                     
        2740              <xsl:varia ble 
        2741               name="name 4"
        2742              >
        2743                                                                                                               
        2744               <xsl:call- template 
        2745                name="getP ersonNameF romRoot"
        2746               >
        2747                                                                                                                         
        2748                <xsl:with- param 
        2749                 name="name Root" 
        2750                 select="/n 1:Clinical Document/n 1:document ationOf/n1 :serviceEv ent/n1:per former/n1: assignedEn tity/n1:id [@extensio n=$provide rId]/../n1 :assignedP erson/n1:n ame"
        2751                />
        2752                                                                                                                
        2753               </xsl:call -template>
        2754                                                                                                      
        2755              </xsl:vari able>
        2756                                                                                                     
        2757              <xsl:choos e>
        2758                                                                                                               
        2759               <xsl:when 
        2760                test="stri ng-length( $name4)>0"
        2761               >
        2762                                                                                                                         
        2763                <xsl:value -of 
        2764                 select="$n ame4"
        2765                />
        2766                                                                                                                
        2767               </xsl:when >
        2768                                                                                                               
        2769               <xsl:other wise>
        2770                                                                                                                         
        2771                <xsl:value -of 
        2772                 select="/n 1:Clinical Document/n 1:document ationOf/n1 :serviceEv ent/n1:per former/n1: assignedEn tity/n1:id [@extensio n=$provide rId]/@assi gningAutho rityName"
        2773                />
        2774                                                                                                                
        2775               </xsl:othe rwise>
        2776                                                                                                      
        2777              </xsl:choo se>
        2778                                                                                             
        2779             </xsl:othe rwise>
        2780                                                                                   
        2781            </xsl:choo se>
        2782                                                                         
        2783           </xsl:othe rwise>
        2784                                                               
        2785          </xsl:choo se>
        2786                                                     
        2787         </xsl:othe rwise>
        2788                                            
        2789        </xsl:choo se>
        2790                                  
        2791       </xsl:when >
        2792      
        2793             
        2794       <xsl:when 
        2795        test="stri ng-length( $providerN umber)>0 a nd
        2796                         /n1: ClinicalDo cument/n1: documentat ionOf/n1:s erviceEven t/n1:perfo rmer/n1:as signedEnti ty/n1:id/@ extension= $providerN umber and
        2797                         stri ng-length( /n1:Clinic alDocument /n1:docume ntationOf/ n1:service Event/n1:p erformer/n 1:assigned Entity[n1: id/@extens ion=$provi derNumber] /n1:assign edPerson/n 1:name)>0"
        2798       >
        2799                  
        2800        <xsl:varia ble 
        2801         name="name 1a"
        2802        >
        2803                      
        2804         <xsl:call- template 
        2805          name="getP ersonNameF romRoot"
        2806         >
        2807                         
        2808          <xsl:with- param 
        2809           name="name Root" 
        2810           select="/n 1:Clinical Document/n 1:document ationOf/n1 :serviceEv ent/n1:per former/n1: assignedEn tity[n1:id /@extensio n=$provide rNumber]/n 1:assigned Person/n1: name"
        2811          />
        2812                       
        2813         </xsl:call -template>
        2814                   
        2815        </xsl:vari able>
        2816                  
        2817        <xsl:if 
        2818         test="stri ng-length( $name1a)>0 "
        2819        >
        2820                      
        2821         <xsl:value -of 
        2822          select="$n ame1a"
        2823         />
        2824                   
        2825        </xsl:if>
        2826              
        2827       </xsl:when >
        2828             
        2829       <xsl:when 
        2830        test="$act /n1:entryR elationshi p/n1:obser vation/n1: author/n1: assignedAu thor/n1:as signedPers on/n1:name "
        2831       >
        2832                
        2833        <xsl:varia ble 
        2834         name="name 1a"
        2835        >
        2836                   
        2837         <xsl:call- template 
        2838          name="getP ersonNameF romRoot"
        2839         >
        2840                       
        2841          <xsl:with- param 
        2842           name="name Root" 
        2843           select="$a ct/n1:entr yRelations hip/n1:obs ervation/n 1:author/n 1:assigned Author/n1: assignedPe rson/n1:na me"
        2844          />
        2845                    
        2846         </xsl:call -template>
        2847                 
        2848        </xsl:vari able>
        2849                
        2850        <xsl:if 
        2851         test="stri ng-length( $name1a)>0 "
        2852        >
        2853                   
        2854         <xsl:value -of 
        2855          select="$n ame1a"
        2856         />
        2857                 
        2858        </xsl:if>
        2859              
        2860       </xsl:when >
        2861             
        2862       <xsl:when 
        2863        test="/n1: ClinicalDo cument/n1: documentat ionOf/n1:s erviceEven t/n1:perfo rmer/n1:as signedEnti ty/n1:assi gnedPerson /n1:name a nd ($isMul tiCare)"
        2864       >
        2865                
        2866        <xsl:varia ble 
        2867         name="name 1a"
        2868        >
        2869                   
        2870         <xsl:call- template 
        2871          name="getP ersonNameF romRoot"
        2872         >
        2873                       
        2874          <xsl:with- param 
        2875           name="name Root" 
        2876           select="/n 1:Clinical Document/n 1:document ationOf/n1 :serviceEv ent/n1:per former/n1: assignedEn tity/n1:as signedPers on/n1:name "
        2877          />
        2878                    
        2879         </xsl:call -template>
        2880                 
        2881        </xsl:vari able>
        2882                
        2883        <xsl:if 
        2884         test="stri ng-length( $name1a)>0 "
        2885        >
        2886                   
        2887         <xsl:value -of 
        2888          select="$n ame1a"
        2889         />
        2890                 
        2891        </xsl:if>
        2892              
        2893       </xsl:when >
        2894             
        2895             
        2896       <xsl:other wise>
        2897                                           
        2898        <xsl:call- template 
        2899         name="na"
        2900        />
        2901                                  
        2902       </xsl:othe rwise>                          
        2903                        
        2904      </xsl:choo se>
        2905              
        2906     </xsl:temp late>
        2907    
        2908             
        2909     <xsl:templ ate 
        2910      name="getP ersonNameF romRoot"
        2911     >
        2912                       
        2913      <xsl:param  
        2914       name="name Root"
        2915      />
        2916                       
        2917      <xsl:choos e>
        2918                                 
        2919       <xsl:when 
        2920        test="stri ng-length( normalize- space($nam eRoot/text ()))>0"
        2921       >
        2922                                           
        2923        <xsl:value -of 
        2924         select="no rmalize-sp ace($nameR oot/text() )"
        2925        />
        2926                                  
        2927       </xsl:when >
        2928                                 
        2929       <xsl:when 
        2930        test="stri ng-length( $nameRoot/ n1:family) >0 or stri ng-length( $nameRoot/ n1:given)> 0"
        2931       >
        2932                                           
        2933        <xsl:call- template 
        2934         name="getP ersonName"
        2935        >
        2936                                                    
        2937         <xsl:with- param 
        2938          name="name Root" 
        2939          select="$n ameRoot"
        2940         />
        2941                                            
        2942        </xsl:call -template>
        2943                                  
        2944       </xsl:when >
        2945                        
        2946      </xsl:choo se>
        2947              
        2948     </xsl:temp late>
        2949    
        2950             
        2951     <xsl:templ ate 
        2952      name="getP ersonName"
        2953     >
        2954                       
        2955      <xsl:param  
        2956       name="name Root"
        2957      />
        2958                       
        2959      <xsl:value -of 
        2960       select="$n ameRoot/n1 :family"
        2961      />
        2962                       
        2963      <xsl:if 
        2964       test="stri ng-length( $nameRoot/ n1:given)> 0"
        2965      >
        2966                                 
        2967       <xsl:text>
        2968        ,
        2969       </xsl:text >
        2970                        
        2971      </xsl:if>
        2972                       
        2973      <xsl:for-e ach 
        2974       select="$n ameRoot/n1 :given"
        2975      >
        2976                                 
        2977       <xsl:text>
        2978         
        2979       </xsl:text >
        2980                                 
        2981       <xsl:value -of 
        2982        select="."
        2983       />
        2984                        
        2985      </xsl:for- each>
        2986              
        2987     </xsl:temp late>
        2988             
        2989             
        2990     <!-- Labs  -->
        2991    
        2992             
        2993     <xsl:templ ate 
        2994      name="getP anelDT"
        2995     >
        2996                       
        2997      <xsl:param  
        2998       name="orga nizer"
        2999      />
        3000                       
        3001      <xsl:if 
        3002       test="$org anizer"
        3003      >
        3004                                 
        3005       <xsl:choos e>
        3006                                           
        3007        <xsl:when 
        3008         test="$org anizer/n1: effectiveT ime/@value "
        3009        >
        3010                                                    
        3011         <xsl:call- template 
        3012          name="form atDateShor t"
        3013         >
        3014                                                              
        3015          <xsl:with- param 
        3016           name="date String" 
        3017           select="$o rganizer/n 1:effectiv eTime/@val ue"
        3018          />
        3019                                                     
        3020         </xsl:call -template>
        3021                                            
        3022        </xsl:when >
        3023                                           
        3024        <xsl:when 
        3025         test="$org anizer/n1: effectiveT ime/n1:low /@value"
        3026        >
        3027                                                    
        3028         <xsl:call- template 
        3029          name="form atDateShor t"
        3030         >
        3031                                                              
        3032          <xsl:with- param 
        3033           name="date String" 
        3034           select="$o rganizer/n 1:effectiv eTime/n1:l ow/@value"
        3035          />
        3036                                                     
        3037         </xsl:call -template>
        3038                                            
        3039        </xsl:when >
        3040                                           
        3041        <xsl:when 
        3042         test="$org anizer/n1: component/ n1:procedu re/n1:effe ctiveTime/ @value"
        3043        >
        3044                                                    
        3045         <xsl:call- template 
        3046          name="form atDateShor t"
        3047         >
        3048                                                              
        3049          <xsl:with- param 
        3050           name="date String" 
        3051           select="$o rganizer/n 1:componen t/n1:proce dure/n1:ef fectiveTim e/@value"
        3052          />
        3053                                                     
        3054         </xsl:call -template>
        3055                                            
        3056        </xsl:when >
        3057                                           
        3058        <xsl:when 
        3059         test="$org anizer/n1: component/ n1:procedu re/n1:effe ctiveTime/ n1:low/@va lue"
        3060        >
        3061                                                    
        3062         <xsl:call- template 
        3063          name="form atDateShor t"
        3064         >
        3065                                                              
        3066          <xsl:with- param 
        3067           name="date String" 
        3068           select="$o rganizer/n 1:componen t/n1:proce dure/n1:ef fectiveTim e/n1:low/@ value"
        3069          />
        3070                                                     
        3071         </xsl:call -template>
        3072                                            
        3073        </xsl:when >
        3074                                           
        3075        <xsl:other wise/>
        3076                                  
        3077       </xsl:choo se>
        3078                        
        3079      </xsl:if>
        3080              
        3081     </xsl:temp late>
        3082    
        3083             
        3084     <xsl:templ ate 
        3085      name="getR esultDT"
        3086     >
        3087                       
        3088      <xsl:param  
        3089       name="obse rvation"
        3090      />
        3091                       
        3092      <xsl:if 
        3093       test="$obs ervation"
        3094      >
        3095                                 
        3096       <xsl:choos e>
        3097                                           
        3098        <xsl:when 
        3099         test="$obs ervation/n 1:effectiv eTime/@val ue"
        3100        >
        3101                                                    
        3102         <xsl:call- template 
        3103          name="form atDateShor t"
        3104         >
        3105                                                              
        3106          <xsl:with- param 
        3107           name="date String" 
        3108           select="$o bservation /n1:effect iveTime/@v alue"
        3109          />
        3110                                                     
        3111         </xsl:call -template>
        3112                                            
        3113        </xsl:when >
        3114                                           
        3115        <xsl:when 
        3116         test="$obs ervation/n 1:effectiv eTime/n1:l ow/@value"
        3117        >
        3118                                                    
        3119         <xsl:call- template 
        3120          name="form atDateShor t"
        3121         >
        3122                                                              
        3123          <xsl:with- param 
        3124           name="date String" 
        3125           select="$o bservation /n1:effect iveTime/n1 :low/@valu e"
        3126          />
        3127                                                     
        3128         </xsl:call -template>
        3129                                            
        3130        </xsl:when >
        3131                                           
        3132        <xsl:other wise/>
        3133                                  
        3134       </xsl:choo se>
        3135                        
        3136      </xsl:if>
        3137              
        3138     </xsl:temp late>
        3139    
        3140       
        3141     <xsl:templ ate 
        3142      name="getO rganizerNa me"
        3143     >
        3144          
        3145      <xsl:param  
        3146       name="row"
        3147      />
        3148          
        3149      <xsl:choos e>
        3150             
        3151       <xsl:when 
        3152        test="stri ng-length( $row/n1:or ganizer/n1 :code/@dis playName)"
        3153       >
        3154                
        3155        <xsl:value -of 
        3156         select="$r ow/n1:orga nizer/n1:c ode/@displ ayName"
        3157        />
        3158              
        3159       </xsl:when >
        3160             
        3161       <xsl:when 
        3162        test="stri ng-length( $row/n1:or ganizer/n1 :code/n1:o riginalTex t)"
        3163       >
        3164                
        3165        <xsl:value -of 
        3166         select="$r ow/n1:orga nizer/n1:c ode/n1:ori ginalText"
        3167        />
        3168              
        3169       </xsl:when >
        3170             
        3171       <xsl:when 
        3172        test="coun t($row/n1: organizer/ n1:compone nt/n1:obse rvation)=1  and $row/ n1:organiz er/n1:comp onent/n1:o bservation /n1:code/@ displayNam e"
        3173       >
        3174                
        3175        <xsl:choos e>
        3176                   
        3177         <xsl:when 
        3178          test="$row /n1:organi zer/n1:com ponent/n1: observatio n/n1:code/ n1:transla tion/@disp layName"
        3179         >
        3180                       
        3181          <xsl:value -of 
        3182           select="$r ow/n1:orga nizer/n1:c omponent/n 1:observat ion/n1:cod e/n1:trans lation/@di splayName"
        3183          />
        3184                    
        3185         </xsl:when >
        3186                   
        3187         <xsl:other wise>
        3188                       
        3189          <xsl:value -of 
        3190           select="$r ow/n1:orga nizer/n1:c omponent/n 1:observat ion/n1:cod e/@display Name"
        3191          />
        3192                    
        3193         </xsl:othe rwise>
        3194                 
        3195        </xsl:choo se>
        3196                
        3197        <xsl:value -of 
        3198         select="$r ow/n1:comp onent/n1:o bservation "
        3199        />
        3200              
        3201       </xsl:when >
        3202             
        3203       <xsl:other wise/>
        3204           
        3205      </xsl:choo se>
        3206        
        3207     </xsl:temp late>
        3208    
        3209       
        3210     <xsl:templ ate 
        3211      name="getR esultType"
        3212     >
        3213          
        3214      <xsl:param  
        3215       name="obse rvation"
        3216      />
        3217          
        3218      <xsl:choos e>
        3219             
        3220       <xsl:when 
        3221        test="$obs ervation/n 1:code/n1: originalTe xt"
        3222       >
        3223                
        3224        <xsl:value -of 
        3225         select="$o bservation /n1:code/n 1:original Text"
        3226        />
        3227              
        3228       </xsl:when >
        3229             
        3230       <xsl:when 
        3231        test="$obs ervation/n 1:code/@di splayName"
        3232       >
        3233                
        3234        <xsl:value -of 
        3235         select="$o bservation /n1:code/@ displayNam e"
        3236        />
        3237              
        3238       </xsl:when >
        3239             
        3240       <xsl:when 
        3241        test="$obs ervation/n 1:code/n1: translatio n/@display Name"
        3242       >
        3243                
        3244        <xsl:value -of 
        3245         select="$o bservation /n1:code/n 1:translat ion/@displ ayName"
        3246        />
        3247              
        3248       </xsl:when >
        3249             
        3250       <xsl:other wise>
        3251                
        3252        <xsl:value -of 
        3253         select="0"
        3254        />
        3255              
        3256       </xsl:othe rwise>
        3257           
        3258      </xsl:choo se>
        3259        
        3260     </xsl:temp late>
        3261    
        3262       
        3263     <xsl:templ ate 
        3264      name="getR esultType2 "
        3265     >
        3266          
        3267      <xsl:param  
        3268       name="obse rvation"
        3269      />
        3270          
        3271      <xsl:choos e>
        3272             
        3273       <xsl:when 
        3274        test="$obs ervation/n 1:code/n1: originalTe xt/n1:refe rence/@val ue"
        3275       >
        3276                
        3277        <xsl:call- template 
        3278         name="getR esultTypeF romReferen ce"
        3279        >
        3280                   
        3281         <xsl:with- param 
        3282          name="resu ltTypeRefe rence" 
        3283          select="$o bservation /n1:code/n 1:original Text/n1:re ference/@v alue"
        3284         />
        3285                   
        3286         <xsl:with- param 
        3287          name="sect ion" 
        3288          select="$o bservation /../../../ ../."
        3289         />
        3290                 
        3291        </xsl:call -template>
        3292              
        3293       </xsl:when >
        3294             
        3295       <xsl:when 
        3296        test="$obs ervation/n 1:code/@di splayName"
        3297       >
        3298                
        3299        <xsl:value -of 
        3300         select="$o bservation /n1:code/@ displayNam e"
        3301        />
        3302              
        3303       </xsl:when >
        3304             
        3305       <xsl:when 
        3306        test="$obs ervation/n 1:code/n1: translatio n/@display Name"
        3307       >
        3308                
        3309        <xsl:value -of 
        3310         select="$o bservation /n1:code/n 1:translat ion/@displ ayName"
        3311        />
        3312              
        3313       </xsl:when >
        3314             
        3315       <xsl:when 
        3316        test="$obs ervation/n 1:text/n1: reference/ @value"
        3317       >
        3318                
        3319        <xsl:call- template 
        3320         name="getR esultTypeF romReferen ce"
        3321        >
        3322                   
        3323         <xsl:with- param 
        3324          name="resu ltTypeRefe rence" 
        3325          select="$o bservation /n1:text/n 1:referenc e/@value"
        3326         />
        3327                   
        3328         <xsl:with- param 
        3329          name="sect ion" 
        3330          select="$o bservation /../../../ ../."
        3331         />
        3332                 
        3333        </xsl:call -template>
        3334              
        3335       </xsl:when >
        3336             
        3337       <xsl:other wise>
        3338                
        3339        <xsl:call- template 
        3340         name="na"
        3341        />
        3342              
        3343       </xsl:othe rwise>
        3344           
        3345      </xsl:choo se>
        3346        
        3347     </xsl:temp late>
        3348    
        3349             
        3350     <xsl:templ ate 
        3351      name="getR esultTypeF romReferen ce"
        3352     >
        3353                       
        3354      <xsl:param  
        3355       name="resu ltTypeRefe rence"
        3356      />
        3357                       
        3358      <xsl:param  
        3359       name="sect ion"
        3360      />
        3361                       
        3362      <xsl:varia ble 
        3363       name="resu ltTypeValu e" 
        3364       select="$s ection//n1 :content[@ ID=$result TypeRefere nce]"
        3365      />
        3366                       
        3367      <xsl:varia ble 
        3368       name="resu ltTypeValu e2" 
        3369       select="$s ection//n1 :content[@ ID=substri ng-after($ resultType Reference, '#')]"
        3370      />
        3371                       
        3372      <xsl:varia ble 
        3373       name="resu ltTypeValu e3" 
        3374       select="$s ection/n1: text//n1:t d[@ID=$res ultTypeRef erence]"
        3375      />
        3376                       
        3377      <xsl:varia ble 
        3378       name="resu ltTypeValu e4" 
        3379       select="$s ection/n1: text//n1:t d[@ID=subs tring-afte r($resultT ypeReferen ce,'#')]"
        3380      />
        3381                       
        3382      <xsl:if 
        3383       test="stri ng-length( $resultTyp eValue)>0"
        3384      >
        3385                                 
        3386       <xsl:value -of 
        3387        select="$r esultTypeV alue"
        3388       />
        3389                        
        3390      </xsl:if>
        3391                       
        3392      <xsl:if 
        3393       test="stri ng-length( $resultTyp eValue2)>0 "
        3394      >
        3395                                 
        3396       <xsl:value -of 
        3397        select="$r esultTypeV alue2"
        3398       />
        3399                        
        3400      </xsl:if>
        3401                       
        3402      <xsl:if 
        3403       test="stri ng-length( $resultTyp eValue3)>0 "
        3404      >
        3405                                 
        3406       <xsl:value -of 
        3407        select="$r esultTypeV alue3"
        3408       />
        3409                        
        3410      </xsl:if>
        3411                       
        3412      <xsl:if 
        3413       test="stri ng-length( $resultTyp eValue4)>0 "
        3414      >
        3415                                 
        3416       <xsl:value -of 
        3417        select="$r esultTypeV alue4"
        3418       />
        3419                        
        3420      </xsl:if>
        3421              
        3422     </xsl:temp late>
        3423    
        3424       
        3425     <xsl:templ ate 
        3426      name="getR esultValue "
        3427     >
        3428          
        3429      <xsl:param  
        3430       name="obse rvation"
        3431      />
        3432          
        3433      <xsl:if 
        3434       test="$obs ervation"
        3435      >
        3436             
        3437       <xsl:choos e>
        3438                
        3439        <xsl:when 
        3440         test="$obs ervation/n 1:value/@v alue"
        3441        >
        3442                   
        3443         <xsl:value -of 
        3444          select="$o bservation /n1:value/ @value"
        3445         />
        3446                   
        3447         <xsl:if 
        3448          test="$obs ervation/n 1:value/@u nit"
        3449         >
        3450                       
        3451          <xsl:text>
        3452           &#160;&#16 0;&#160;&# 160;
        3453          </xsl:text >
        3454                       
        3455          <xsl:value -of 
        3456           select="$o bservation /n1:value/ @unit"
        3457          />
        3458                    
        3459         </xsl:if>
        3460                 
        3461        </xsl:when >
        3462                
        3463        <xsl:when 
        3464         test="$obs ervation/n 1:value[@x si:type='S T']"
        3465        >
        3466                   
        3467         <xsl:value -of 
        3468          select="$o bservation /n1:value[ @xsi:type= 'ST']"
        3469         />
        3470                 
        3471        </xsl:when >
        3472                
        3473        <xsl:when 
        3474         test="$obs ervation/n 1:value[@x si:type='E D'] and no t($observa tion/n1:va lue[@nullF lavor='NA' ])"
        3475        >
        3476                   
        3477         <xsl:value -of 
        3478          select="$o bservation /n1:value[ @xsi:type= 'ED']"
        3479         />
        3480                 
        3481        </xsl:when >
        3482                
        3483        <xsl:when 
        3484         test="$obs ervation/n 1:value[@x si:type='C D']/@displ ayName"
        3485        >
        3486                   
        3487         <xsl:value -of 
        3488          select="$o bservation /n1:value[ @xsi:type= 'CD']/@dis playName"
        3489         />
        3490                 
        3491        </xsl:when >
        3492                
        3493        <xsl:when 
        3494         test="$obs ervation/n 1:value[@x si:type='C D']/n1:ori ginalText"
        3495        >
        3496                   
        3497         <xsl:value -of 
        3498          select="$o bservation /n1:value[ @xsi:type= 'CD']/n1:o riginalTex t"
        3499         />
        3500                 
        3501        </xsl:when >
        3502                
        3503        <xsl:when 
        3504         test="$obs ervation/n 1:value[@x si:type='I VL_PQ']/n1 :low/@valu e"
        3505        >
        3506                   
        3507         <xsl:value -of 
        3508          select="$o bservation /n1:value[ @xsi:type= 'IVL_PQ']/ n1:low/@va lue"
        3509         />
        3510                   
        3511         <xsl:if 
        3512          test="$obs ervation/n 1:value[@x si:type='I VL_PQ']/n1 :low/@unit "
        3513         >
        3514                       
        3515          <xsl:text>
        3516           &#160;&#16 0;&#160;&# 160;
        3517          </xsl:text >
        3518                       
        3519          <xsl:value -of 
        3520           select="$o bservation /n1:value[ @xsi:type= 'IVL_PQ']/ n1:low/@un it"
        3521          />
        3522                    
        3523         </xsl:if>
        3524                 
        3525        </xsl:when >
        3526                
        3527        <xsl:when 
        3528         test="$obs ervation/n 1:text/n1: reference/ @value"
        3529        >
        3530                   
        3531         <xsl:varia ble 
        3532          name="resu lt" 
        3533          select="$o bservation /n1:text/n 1:referenc e/@value"
        3534         />
        3535                   
        3536         <xsl:varia ble 
        3537          name="sect ion" 
        3538          select="$o bservation /../../../ ../."
        3539         />
        3540                   
        3541         <xsl:value -of 
        3542          select="$s ection/n1: text//n1:i tem[@ID=su bstring-af ter($resul t,'#')]"
        3543         />
        3544                 
        3545        </xsl:when >
        3546              
        3547       </xsl:choo se>
        3548           
        3549      </xsl:if>
        3550        
        3551     </xsl:temp late>
        3552    
        3553             
        3554     <xsl:templ ate 
        3555      name="getI nterpretat ion"
        3556     >
        3557                       
        3558      <xsl:param  
        3559       name="obse rvation"
        3560      />
        3561                       
        3562      <xsl:choos e>
        3563                                 
        3564       <xsl:when 
        3565        test="$obs ervation/n 1:interpre tationCode /@displayN ame"
        3566       >
        3567                                           
        3568        <xsl:value -of 
        3569         select="$o bservation /n1:interp retationCo de/@displa yName"
        3570        />
        3571                                  
        3572       </xsl:when >
        3573                                 
        3574       <xsl:when 
        3575        test="$obs ervation/n 1:interpre tationCode /n1:origin alText"
        3576       >
        3577                                           
        3578        <xsl:value -of 
        3579         select="$o bservation /n1:interp retationCo de/n1:orig inalText"
        3580        />
        3581                                  
        3582       </xsl:when >
        3583                                 
        3584       <xsl:other wise/>
        3585                        
        3586      </xsl:choo se>
        3587              
        3588     </xsl:temp late>
        3589    
        3590             
        3591     <xsl:templ ate 
        3592      name="getI nterpretat ion2"
        3593     >
        3594                       
        3595      <xsl:param  
        3596       name="obse rvation"
        3597      />
        3598                       
        3599      <xsl:choos e>
        3600                                 
        3601       <xsl:when 
        3602        test="$obs ervation/n 1:interpre tationCode /n1:origin alText/n1: reference/ @value"
        3603       >
        3604                                           
        3605        <xsl:call- template 
        3606         name="getI nterpretat ionFromRef erence"
        3607        >
        3608                                                    
        3609         <xsl:with- param 
        3610          name="inte rpretation Reference"  
        3611          select="$o bservation /n1:interp retationCo de/n1:code /n1:origin alText/n1: reference/ @value"
        3612         />
        3613                                                    
        3614         <xsl:with- param 
        3615          name="sect ion" 
        3616          select="$o bservation /n1:interp retationCo de/../../. ./../../."
        3617         />
        3618                                            
        3619        </xsl:call -template>
        3620                                  
        3621       </xsl:when >
        3622             
        3623       <xsl:when 
        3624        test="$obs ervation/n 1:interpre tationCode /@code"
        3625       >
        3626                
        3627        <xsl:value -of 
        3628         select="$o bservation /n1:interp retationCo de/@code"
        3629        />
        3630              
        3631       </xsl:when >
        3632           
        3633      </xsl:choo se>
        3634              
        3635     </xsl:temp late>
        3636    
        3637             
        3638     <xsl:templ ate 
        3639      name="getI nterpretat ionFromRef erence"
        3640     >
        3641                       
        3642      <xsl:param  
        3643       name="inte rpretation Reference"
        3644      />
        3645                       
        3646      <xsl:param  
        3647       name="sect ion"
        3648      />
        3649                       
        3650      <xsl:varia ble 
        3651       name="inte rpretation Value" 
        3652       select="$s ection//n1 :content[@ ID=$interp retationRe ference]"
        3653      />
        3654                       
        3655      <xsl:varia ble 
        3656       name="inte rpretation Value2" 
        3657       select="$s ection//n1 :content[@ ID=substri ng-after($ interpreta tionRefere nce,'#')]"
        3658      />
        3659                       
        3660      <xsl:varia ble 
        3661       name="inte rpretation Value3" 
        3662       select="$s ection/n1: text//n1:t d[@ID=$int erpretatio nReference ]"
        3663      />
        3664                       
        3665      <xsl:varia ble 
        3666       name="inte rpretation Value4" 
        3667       select="$s ection/n1: text//n1:t d[@ID=subs tring-afte r($interpr etationRef erence,'#' )]"
        3668      />
        3669                       
        3670      <xsl:if 
        3671       test="stri ng-length( $interpret ationValue )>0"
        3672      >
        3673                                 
        3674       <xsl:value -of 
        3675        select="$i nterpretat ionValue"
        3676       />
        3677                        
        3678      </xsl:if>
        3679                       
        3680      <xsl:if 
        3681       test="stri ng-length( $interpret ationValue 2)>0"
        3682      >
        3683                                 
        3684       <xsl:value -of 
        3685        select="$i nterpretat ionValue2"
        3686       />
        3687                        
        3688      </xsl:if>
        3689                       
        3690      <xsl:if 
        3691       test="stri ng-length( $interpret ationValue 3)>0"
        3692      >
        3693                                 
        3694       <xsl:value -of 
        3695        select="$i nterpretat ionValue3"
        3696       />
        3697                        
        3698      </xsl:if>
        3699                       
        3700      <xsl:if 
        3701       test="stri ng-length( $interpret ationValue 4)>0"
        3702      >
        3703                                 
        3704       <xsl:value -of 
        3705        select="$i nterpretat ionValue4"
        3706       />
        3707                        
        3708      </xsl:if>
        3709              
        3710     </xsl:temp late>
        3711    
        3712             
        3713     <xsl:templ ate 
        3714      name="getR efRange"
        3715     >
        3716                       
        3717      <xsl:param  
        3718       name="obse rvation"
        3719      />
        3720                       
        3721      <xsl:choos e>
        3722                                 
        3723       <xsl:when 
        3724        test="$obs ervation/n 1:referenc eRange/n1: observatio nRange/n1: text"
        3725       >
        3726                                           
        3727        <xsl:value -of 
        3728         select="$o bservation /n1:refere nceRange/n 1:observat ionRange/n 1:text"
        3729        />
        3730                                  
        3731       </xsl:when >
        3732                                 
        3733       <xsl:when 
        3734        test="$obs ervation/n 1:referenc eRange/n1: observatio nRange/n1: value/n1:l ow/@value  and $obser vation/n1: referenceR ange/n1:ob servationR ange/n1:va lue/n1:hig h/@value"
        3735       >
        3736                                           
        3737        <xsl:value -of 
        3738         select="$o bservation /n1:refere nceRange/n 1:observat ionRange/n 1:value/n1 :low/@valu e"
        3739        />
        3740                                           
        3741        <xsl:text>
        3742          - 
        3743        </xsl:text >
        3744                                           
        3745        <xsl:value -of 
        3746         select="$o bservation /n1:refere nceRange/n 1:observat ionRange/n 1:value/n1 :high/@val ue"
        3747        />
        3748                                           
        3749        <xsl:text>
        3750           
        3751        </xsl:text >
        3752                                           
        3753        <xsl:value -of 
        3754         select="$o bservation /n1:refere nceRange/n 1:observat ionRange/n 1:value/n1 :high/@uni t"
        3755        />
        3756                                  
        3757       </xsl:when >
        3758                                 
        3759       <xsl:other wise/>
        3760                        
        3761      </xsl:choo se>
        3762              
        3763     </xsl:temp late>
        3764    
        3765             
        3766     <!-- Immun izations - ->
        3767    
        3768             
        3769     <xsl:templ ate 
        3770      name="getI mmunizatio n"
        3771     >
        3772                       
        3773      <xsl:param  
        3774       name="subs tanceAdmin istration"
        3775      />
        3776                       
        3777      <xsl:choos e>
        3778             
        3779       <xsl:when 
        3780        test="$sub stanceAdmi nistration /n1:consum able/n1:ma nufactured Product/n1 :manufactu redMateria l/n1:code/ @displayNa me"
        3781       >
        3782                
        3783        <xsl:value -of 
        3784         select="$s ubstanceAd ministrati on/n1:cons umable/n1: manufactur edProduct/ n1:manufac turedMater ial/n1:cod e/@display Name"
        3785        />
        3786              
        3787       </xsl:when >
        3788             
        3789       <xsl:when 
        3790        test="$sub stanceAdmi nistration /n1:consum able/n1:ma nufactured Product/n1 :manufactu redMateria l/n1:code/ n1:origina lText/n1:r eference/@ value"
        3791       >
        3792                                           
        3793        <xsl:call- template 
        3794         name="getI mmunizatio nFromRefer ence"
        3795        >
        3796                                                    
        3797         <xsl:with- param 
        3798          name="immu nizationRe ference" 
        3799          select="$s ubstanceAd ministrati on/n1:cons umable/n1: manufactur edProduct/ n1:manufac turedMater ial/n1:cod e/n1:origi nalText/n1 :reference /@value"
        3800         />
        3801                                                    
        3802         <xsl:with- param 
        3803          name="sect ion" 
        3804          select="$s ubstanceAd ministrati on/../../. "
        3805         />
        3806                                            
        3807        </xsl:call -template>
        3808                                  
        3809       </xsl:when >
        3810                                 
        3811       <xsl:other wise>
        3812                                           
        3813        <xsl:call- template 
        3814         name="na"
        3815        />
        3816                                  
        3817       </xsl:othe rwise>
        3818                        
        3819      </xsl:choo se>
        3820              
        3821     </xsl:temp late>
        3822    
        3823             
        3824     <xsl:templ ate 
        3825      name="getI mmunizatio nFromRefer ence"
        3826     >
        3827                       
        3828      <xsl:param  
        3829       name="immu nizationRe ference"
        3830      />
        3831                       
        3832      <xsl:param  
        3833       name="sect ion"
        3834      />
        3835                       
        3836      <xsl:varia ble 
        3837       name="immu nizationVa lue" 
        3838       select="$s ection//n1 :content[@ ID=$immuni zationRefe rence]"
        3839      />
        3840                       
        3841      <xsl:varia ble 
        3842       name="immu nizationVa lue2" 
        3843       select="$s ection//n1 :content[@ ID=substri ng-after($ immunizati onReferenc e,'#')]"
        3844      />
        3845                       
        3846      <xsl:varia ble 
        3847       name="immu nizationVa lue3" 
        3848       select="$s ection/n1: text//n1:t d[@ID=$imm unizationR eference]"
        3849      />
        3850                       
        3851      <xsl:varia ble 
        3852       name="immu nizationVa lue4" 
        3853       select="$s ection/n1: text//n1:t d[@ID=subs tring-afte r($immuniz ationRefer ence,'#')] "
        3854      />
        3855                       
        3856      <xsl:if 
        3857       test="stri ng-length( $immunizat ionValue)> 0"
        3858      >
        3859                                 
        3860       <xsl:value -of 
        3861        select="$i mmunizatio nValue"
        3862       />
        3863                        
        3864      </xsl:if>
        3865                       
        3866      <xsl:if 
        3867       test="stri ng-length( $immunizat ionValue2) >0"
        3868      >
        3869                                 
        3870       <xsl:value -of 
        3871        select="$i mmunizatio nValue2"
        3872       />
        3873                        
        3874      </xsl:if>
        3875                       
        3876      <xsl:if 
        3877       test="stri ng-length( $immunizat ionValue3) >0"
        3878      >
        3879                                 
        3880       <xsl:value -of 
        3881        select="$i mmunizatio nValue3"
        3882       />
        3883                        
        3884      </xsl:if>
        3885                       
        3886      <xsl:if 
        3887       test="stri ng-length( $immunizat ionValue4) >0"
        3888      >
        3889                                 
        3890       <xsl:value -of 
        3891        select="$i mmunizatio nValue4"
        3892       />
        3893                        
        3894      </xsl:if>
        3895              
        3896     </xsl:temp late>
        3897    
        3898             
        3899     <!-- End d omain temp lates -->
        3900    
        3901             
        3902     <!--  Comm ents Secti on-->
        3903    
        3904             
        3905     <xsl:templ ate 
        3906      name="getC ommonForma tComments"
        3907     >
        3908                       
        3909      <xsl:varia ble 
        3910       name="ref1
        3911       select="n1 :entry/n1: act/n1:tex t/n1:refer ence/@valu e"
        3912      />
        3913                       
        3914      <xsl:varia ble 
        3915       name="ref2
        3916       select="su bstring-af ter($ref1, '#')"
        3917      />
        3918          
        3919      <xsl:choos e>
        3920                                 
        3921       <xsl:when 
        3922        test="n1:t ext//n1:co ntent[@ID= $ref1]"
        3923       >
        3924                                           
        3925        <xsl:call- template 
        3926         name="form atComments "
        3927        >
        3928                                                    
        3929         <xsl:with- param 
        3930          name="comm ents" 
        3931          select="n1 :text//n1: content[@I D=$ref1]"
        3932         />
        3933                                            
        3934        </xsl:call -template>
        3935                                  
        3936       </xsl:when >
        3937                                 
        3938       <xsl:when 
        3939        test="n1:t ext//n1:co ntent[@ID= $ref2]"
        3940       >
        3941                                           
        3942        <xsl:call- template 
        3943         name="form atComments "
        3944        >
        3945                                                    
        3946         <xsl:with- param 
        3947          name="comm ents" 
        3948          select="n1 :text//n1: content[@I D=$ref2]"
        3949         />
        3950                                            
        3951        </xsl:call -template>
        3952                                  
        3953       </xsl:when >
        3954             
        3955       <xsl:other wise>
        3956                                  
        3957       </xsl:othe rwise>
        3958                        
        3959      </xsl:choo se>
        3960              
        3961     </xsl:temp late>
        3962    
        3963             
        3964     <!-- Encou nters Comm ents-->
        3965    
        3966             
        3967     <!-- Encou nters Noti ce (Commen ts field)- ->
        3968             
        3969     <xsl:templ ate 
        3970      name="enco unterNotic e"
        3971     >
        3972                       
        3973      <div>
        3974                                 
        3975       <table 
        3976        class="com ments"
        3977       >
        3978                                           
        3979        <tbody>
        3980                                                    
        3981         <tr>
        3982                                                              
        3983          <td>
        3984                                                                        
        3985           <img 
        3986            src="resou rces/image s/comments _notice.jp g" 
        3987            alt="NOTE: "
        3988           />
        3989                                                                        
        3990           <text 
        3991            style="lin e-height:1 0%"
        3992           >
        3993                                                                                  
        3994            <b>
        3995              NOTE: Cli ck on the  Encounter  Comments f ield to di splay/hide  additiona l data whe re applica ble
        3996            </b>
        3997                                                                         
        3998           </text>
        3999                                                               
        4000          </td>
        4001                                                     
        4002         </tr>
        4003                                            
        4004        </tbody>
        4005                                  
        4006       </table>
        4007                                 
        4008       <br/>
        4009                        
        4010      </div>
        4011              
        4012     </xsl:temp late>
        4013    
        4014             
        4015     <!-- Proce dures Comm ents-->
        4016    
        4017             
        4018     <!-- Proce dures Noti ce (Commen ts field)- ->
        4019             
        4020     <xsl:templ ate 
        4021      name="proc eduresNoti ce"
        4022     >
        4023                       
        4024      <div>
        4025                                 
        4026       <table 
        4027        class="com ments"
        4028       >
        4029                                           
        4030        <tbody>
        4031                                                    
        4032         <tr>
        4033                                                              
        4034          <td>
        4035                                                                        
        4036           <img 
        4037            src="resou rces/image s/comments _notice.jp g" 
        4038            alt="NOTE: "
        4039           />
        4040                                                                        
        4041           <text>
        4042                                                                                  
        4043            <b>
        4044              NOTE: Cli ck on the  Procedure  Comments f ield to di splay/hide  additiona l data whe re applica ble
        4045            </b>
        4046                                                                         
        4047           </text>
        4048                                                               
        4049          </td>
        4050                                                     
        4051         </tr>
        4052                                            
        4053        </tbody>
        4054                                  
        4055       </table>
        4056                                 
        4057       <br/>
        4058                        
        4059      </div>
        4060              
        4061     </xsl:temp late>
        4062    
        4063             
        4064     <!-- Misce llaneous - ->
        4065             
        4066     <xsl:templ ate 
        4067      name="na"
        4068     >
        4069                       
        4070      <span 
        4071       title="Not  Available "
        4072      >
        4073                                 
        4074       <xsl:text>
        4075        --
        4076       </xsl:text >
        4077                        
        4078      </span>
        4079              
        4080     </xsl:temp late>
        4081    
        4082       
        4083     <xsl:templ ate 
        4084      name="noDa ta"
        4085     >
        4086          
        4087      <span 
        4088       style="fon t-weight:b old;"
        4089      >
        4090             
        4091       <xsl:text 
        4092        disable-ou tput-escap ing="yes"
        4093       >
        4094        &amp;nbsp; &amp;nbsp;
        4095       </xsl:text >
        4096             
        4097       <img 
        4098        src="resou rces/image s/notice.j pg" 
        4099        alt="Notic e"
        4100       />
        4101             
        4102       <xsl:text 
        4103        disable-ou tput-escap ing="yes"
        4104       >
        4105        &amp;nbsp; &amp;nbsp& amp;nbsp;N o Data Pro vided for  this Secti on
        4106       </xsl:text >
        4107           
        4108      </span>
        4109          
        4110      <br>
        4111      </br>
        4112          
        4113      <br>
        4114      </br>
        4115        
        4116     </xsl:temp late>
        4117    
        4118             
        4119     <xsl:templ ate 
        4120      name="shor tenDate"
        4121     >
        4122                       
        4123      <xsl:param  
        4124       name="inSt ring"
        4125      />
        4126                       
        4127      <xsl:choos e>
        4128                                 
        4129       <xsl:when 
        4130        test="subs tring($inS tring,9,1) ='.'"
        4131       >
        4132                                           
        4133        <xsl:value -of 
        4134         select="su bstring($i nString,1, 15)"
        4135        />
        4136                                  
        4137       </xsl:when >
        4138                                 
        4139       <xsl:other wise>
        4140                                           
        4141        <xsl:value -of 
        4142         select="su bstring($i nString,1, 14)"
        4143        />
        4144                                  
        4145       </xsl:othe rwise>
        4146                        
        4147      </xsl:choo se>
        4148              
        4149     </xsl:temp late>
        4150    
        4151             
        4152     <xsl:templ ate 
        4153      name="getL oincStatus Code"
        4154     >
        4155                       
        4156      <xsl:param  
        4157       name="entr y"
        4158      />
        4159                       
        4160      <xsl:if 
        4161       test="$ent ry"
        4162      >
        4163                                 
        4164       <xsl:choos e>
        4165                                           
        4166        <xsl:when 
        4167         test="stri ng-length( $entry//n1 :entryRela tionship/n 1:observat ion[n1:cod e[@code='3 3999-4' an d @codeSys tem='2.16. 840.1.1138 83.6.1']]/ n1:value/n 1:original Text)>0"
        4168        >
        4169                                                    
        4170         <xsl:value -of 
        4171          select="$e ntry//n1:e ntryRelati onship/n1: observatio n[n1:code[ @code='339 99-4' and  @codeSyste m='2.16.84 0.1.113883 .6.1']]/n1 :value/n1: originalTe xt"
        4172         />
        4173                                            
        4174        </xsl:when >
        4175                                           
        4176        <xsl:when 
        4177         test="stri ng-length( $entry//n1 :entryRela tionship/n 1:observat ion[n1:cod e[@code='3 3999-4' an d @codeSys tem='2.16. 840.1.1138 83.6.1']]/ n1:value/@ displayNam e)"
        4178        >
        4179                                                    
        4180         <xsl:value -of 
        4181          select="$e ntry//n1:e ntryRelati onship/n1: observatio n[n1:code[ @code='339 99-4' and  @codeSyste m='2.16.84 0.1.113883 .6.1']]/n1 :value/@di splayName"
        4182         />
        4183                                            
        4184        </xsl:when >
        4185                                           
        4186        <xsl:other wise>
        4187        </xsl:othe rwise>
        4188                                  
        4189       </xsl:choo se>
        4190                        
        4191      </xsl:if>
        4192              
        4193     </xsl:temp late>
        4194    
        4195   </xsl:styl esheet>