3153. EPMO Open Source Coordination Office Redaction File Detail Report

Produced by Araxis Merge on 6/9/2017 3:49:50 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.

3153.1 Files compared

# Location File Last Modified
1 Fri Jun 9 19:49:50 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\adapter nhinCommon.xsl Fri Apr 21 20:03:26 2017 UTC

3153.2 Comparison summary

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

3153.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

3153.4 Active regular expressions

No regular expressions were active.

3153.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     xmlns:xsi= "http://ww w.w3.org/2 001/XMLSch ema-instan ce"
        10           
        11     xmlns:n1=" urn:hl7-or g:v3" 
        12     xmlns:ns=" urn:schema s-microsof t-com:xslt "
        13   >
        14             
        15     <!-- ASHA  AMRITRAJ -  Comment c haining im port, the  stylesheet s cannot i mport 
        16                      itse lf! <xsl:i mport href ="formatti ng.xsl"/>  -->
        17    
        18             
        19     <xsl:varia ble 
        20      name="isKa iser"
        21                      
        22      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'])" 
        23     />
        24    
        25             
        26     <xsl:templ ate 
        27      name="faci lityProper ty"
        28     >
        29                       
        30      <xsl:varia ble 
        31       name="root
        32       select="/n 1:Clinical Document" 
        33      />
        34                       
        35      <Facility>
        36                                 
        37       <xsl:choos e>
        38                                           
        39        <xsl:when
        40                                                   
        41         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"
        42        >
        43                                                    
        44         <xsl:value -of
        45                                                             
        46          select="$r oot/n1:cus todian/n1: assignedCu stodian/n1 :represent edCustodia nOrganizat ion/n1:nam e" 
        47         />
        48                                            
        49        </xsl:when >
        50       
        51                                           
        52        <xsl:when
        53                                                   
        54         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 "
        55        >
        56                                                    
        57         <xsl:value -of
        58                                                             
        59          select="$r oot/n1:doc umentation Of/n1:serv iceEvent/n 1:performe r/n1:assig nedEntity/ n1:represe ntedOrgani zation/n1: name" 
        60         />
        61                                            
        62        </xsl:when >
        63                                           
        64        <xsl:other wise />
        65                                  
        66       </xsl:choo se>
        67                                 
        68       <!--xsl:if  test="n1: act/n1:aut hor/n1:ass ignedAutho r/n1:repre sentedOrga nization/n 1:name"> 
        69                                          <xsl:tex t> / </xsl :text> <xs l:value-of  select="n 1:act/n1:a uthor/n1:a ssignedAut hor/n1:rep resentedOr ganization /n1:name"/
        70                                          </xsl:if  -->
        71                        
        72      </Facility >
        73     
        74              
        75     </xsl:temp late>
        76    
        77             
        78     <xsl:templ ate 
        79      name="gend erString"
        80     >
        81                       
        82      <xsl:param  
        83       name="sex"  
        84       select="'u nknown'" 
        85      />
        86                       
        87      <xsl:choos e>
        88                                 
        89       <xsl:when 
        90        test="$sex ='M' or $s ex='m' or  $sex='Male ' or $sex= 'male'"
        91       >
        92                                           
        93        <xsl:text>
        94         Male
        95        </xsl:text >
        96                                  
        97       </xsl:when >
        98                                 
        99       <xsl:when 
        100        test="$sex ='F' or $s ex='f' or  $sex='Fema le' or $se x='female' "
        101       >
        102                                           
        103        <xsl:text>
        104         Female
        105        </xsl:text >
        106                                  
        107       </xsl:when >
        108                        
        109      </xsl:choo se>
        110              
        111     </xsl:temp late>
        112    
        113    
        114    
        115             
        116     <xsl:templ ate 
        117      name="getI mmunizatio n"
        118     >
        119                       
        120      <xsl:param  
        121       name="manu facturedMa terial" 
        122      />
        123     
        124                       
        125      <xsl:varia ble 
        126       name="immR eference"
        127      >
        128                                 
        129       <xsl:choos e>
        130                                           
        131        <xsl:when
        132                                                   
        133         test="star ts-with($m anufacture dMaterial/ n1:code/n1 :originalT ext/n1:ref erence/@va lue,'#')"
        134        >
        135                                                    
        136         <xsl:value -of
        137                                                             
        138          select="su bstring($m anufacture dMaterial/ n1:code/n1 :originalT ext/n1:ref erence/@va lue,2)" 
        139         />
        140                                            
        141        </xsl:when >
        142                                           
        143        <xsl:other wise>
        144                                                    
        145         <xsl:value -of
        146                                                             
        147          select="$m anufacture dMaterial/ n1:code/n1 :originalT ext/n1:ref erence/@va lue" 
        148         />
        149                                            
        150        </xsl:othe rwise>
        151                                  
        152       </xsl:choo se>
        153                        
        154      </xsl:vari able>
        155     
        156                       
        157      <xsl:choos e>
        158                                 
        159       <xsl:when 
        160        test="$imm Reference"
        161       >
        162                                           
        163        <xsl:choos e>
        164                                                    
        165         <xsl:when
        166                                                             
        167          test="../n 1:text/n1: table/n1:t body/n1:tr /n1:td/n1: content[@I D=$immRefe rence]"
        168         >
        169                                                              
        170          <xsl:value -of
        171                                                                       
        172           select=".. /n1:text/n 1:table/n1 :tbody/n1: tr/n1:td/n 1:content[ @ID=$immRe ference]" 
        173          />
        174                                                     
        175         </xsl:when >
        176                                                    
        177         <xsl:other wise>
        178                                                              
        179          <xsl:if
        180                                                                       
        181           test="../n 1:text/n1: table/n1:t body/n1:tr /n1:td[@ID =$immRefer ence]"
        182          >
        183                                                                        
        184           <xsl:value -of
        185                                                                                 
        186            select=".. /n1:text/n 1:table/n1 :tbody/n1: tr/n1:td[@ ID=$immRef erence]" 
        187           />
        188                                                               
        189          </xsl:if>
        190                                                     
        191         </xsl:othe rwise>
        192                                            
        193        </xsl:choo se>
        194                                  
        195       </xsl:when >
        196                                 
        197       <xsl:other wise>
        198                                           
        199        <xsl:value -of 
        200         select="$m anufacture dMaterial/ n1:name" 
        201        />
        202                                  
        203       </xsl:othe rwise>
        204                        
        205      </xsl:choo se>
        206              
        207     </xsl:temp late>
        208    
        209             
        210     <xsl:templ ate 
        211      name="getI mmunizatio nSeries"
        212     >
        213                       
        214      <xsl:param  
        215       name="manu facturedMa terial" 
        216      />
        217     
        218                       
        219      <xsl:value -of 
        220       select="$m anufacture dMaterial/ n1:lotNumb erText" 
        221      />
        222     
        223              
        224     </xsl:temp late>
        225    
        226             
        227     <xsl:templ ate 
        228      name="getA llergen"
        229     >
        230                       
        231      <xsl:param  
        232       name="obse rvation" 
        233      />
        234                       
        235      <xsl:if 
        236       test="$obs ervation"
        237      >
        238                                 
        239       <xsl:choos e>
        240                                           
        241        <xsl:when
        242                                                   
        243         test="stri ng-length( $observati on/n1:part icipant/n1 :participa ntRole/n1: playingEnt ity/n1:nam e)>0"
        244        >
        245                                                    
        246         <xsl:value -of
        247                                                             
        248          select="$o bservation /n1:partic ipant/n1:p articipant Role/n1:pl ayingEntit y/n1:name"  
        249         />
        250                                            
        251        </xsl:when >
        252                                           
        253        <xsl:when
        254                                                   
        255         test="$obs ervation/n 1:particip ant/n1:par ticipantRo le/n1:play ingEntity/ n1:code/n1 :originalT ext/n1:ref erence/@va lue"
        256        >
        257                                                    
        258         <xsl:varia ble 
        259          name="reac tionNameRe f1"
        260                                                             
        261          select="$o bservation /n1:partic ipant/n1:p articipant Role/n1:pl ayingEntit y/n1:code/ n1:origina lText/n1:r eference/@ value" 
        262         />
        263                                                    
        264         <xsl:varia ble 
        265          name="reac tionNameRe f2"
        266                                                             
        267          select="su bstring($o bservation /n1:partic ipant/n1:p articipant Role/n1:pl ayingEntit y/n1:code/ n1:origina lText/n1:r eference/@ value,2)" 
        268         />
        269                                                    
        270         <xsl:if
        271                                                             
        272          test="../n 1:text/n1: table/n1:t body/n1:tr /n1:td[@ID =$reaction NameRef1]"
        273         >
        274                                                              
        275          <xsl:value -of
        276                                                                       
        277           select=".. /n1:text/n 1:table/n1 :tbody/n1: tr/n1:td[@ ID=$reacti onNameRef1 ]" 
        278          />
        279                                                     
        280         </xsl:if>
        281                                                    
        282         <xsl:if
        283                                                             
        284          test="../n 1:text/n1: table/n1:t body/n1:tr /n1:td[@ID =$reaction NameRef2]"
        285         >
        286                                                              
        287          <xsl:value -of
        288                                                                       
        289           select=".. /n1:text/n 1:table/n1 :tbody/n1: tr/n1:td[@ ID=$reacti onNameRef2 ]" 
        290          />
        291                                                     
        292         </xsl:if>
        293                                                    
        294         <xsl:if
        295                                                             
        296          test="../n 1:text/n1: table/n1:t body/n1:tr /n1:td/n1: content[@I D=$reactio nNameRef1] "
        297         >
        298                                                              
        299          <xsl:value -of
        300                                                                       
        301           select=".. /n1:text/n 1:table/n1 :tbody/n1: tr/n1:td/n 1:content[ @ID=$react ionNameRef 1]" 
        302          />
        303                                                     
        304         </xsl:if>
        305                                                    
        306         <xsl:if
        307                                                             
        308          test="../n 1:text/n1: table/n1:t body/n1:tr /n1:td/n1: content[@I D=$reactio nNameRef2] "
        309         >
        310                                                              
        311          <xsl:value -of
        312                                                                       
        313           select=".. /n1:text/n 1:table/n1 :tbody/n1: tr/n1:td/n 1:content[ @ID=$react ionNameRef 2]" 
        314          />
        315                                                     
        316         </xsl:if>
        317                                            
        318        </xsl:when >
        319                                           
        320        <xsl:other wise>
        321                                                    
        322         <xsl:value -of
        323                                                             
        324          select="$o bservation /n1:partic ipant[@typ eCode='CSM ']/n1:part icipantRol e[@classCo de='MANU'] /n1:playin gEntity[@c lassCode=' MMAT']" 
        325         />
        326                                            
        327        </xsl:othe rwise>
        328                                  
        329       </xsl:choo se>
        330                        
        331      </xsl:if>
        332              
        333     </xsl:temp late>
        334    
        335             
        336     <xsl:templ ate 
        337      name="getA llergenTex t"
        338     >
        339                       
        340      <xsl:param  
        341       name="obse rvation" 
        342      />
        343                       
        344      <xsl:if 
        345       test="$obs ervation"
        346      >
        347                                 
        348       <xsl:choos e>
        349                                           
        350        <xsl:when
        351                                                   
        352         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"
        353        >
        354                                                    
        355         <xsl:value -of
        356                                                             
        357          select="$o bservation /n1:partic ipant/n1:p articipant Role/n1:pl ayingEntit y/n1:name"  
        358         />
        359                                            
        360        </xsl:when >
        361                                           
        362        <xsl:other wise>
        363                                                    
        364         <xsl:value -of
        365                                                             
        366          select="$o bservation /participa nt[@typeCo de='CSM']/ n1:partici pantRole[@ classCode= 'MANU']/n1 :playingEn tity[@clas sCode='MMA T']/@name"  
        367         />
        368                                            
        369        </xsl:othe rwise>
        370                                  
        371       </xsl:choo se>
        372                        
        373      </xsl:if>
        374              
        375     </xsl:temp late>
        376    
        377             
        378     <xsl:templ ate 
        379      name="getE ventType"
        380     >
        381                       
        382      <xsl:param  
        383       name="obs"  
        384      />
        385                       
        386      <xsl:if 
        387       test="$obs "
        388      >
        389                                 
        390       <xsl:choos e>
        391                                           
        392        <xsl:when 
        393         test="stri ng-length( $obs/n1:co de/n1:disp layName)>0 "
        394        >
        395                                                    
        396         <xsl:value -of 
        397          select="$o bs/n1:code /n1:displa yName" 
        398         />
        399                                            
        400        </xsl:when >
        401                                           
        402        <xsl:when 
        403         test="stri ng-length( $obs/n1:co de/@displa yName)>0"
        404        >
        405                                                    
        406         <xsl:value -of 
        407          select="$o bs/n1:code /@displayN ame" 
        408         />
        409                                            
        410        </xsl:when >
        411                                           
        412        <xsl:when 
        413         test="$obs /n1:code/n 1:original Text/n1:re ference/@v alue"
        414        >
        415                                                    
        416         <xsl:varia ble 
        417          name="type NameRef1"
        418                                                             
        419          select="$o bs/n1:code /n1:origin alText/n1: reference/ @value" 
        420         />
        421                                                    
        422         <xsl:varia ble 
        423          name="type NameRef2"
        424                                                             
        425          select="su bstring($o bs/n1:code /n1:origin alText/n1: reference/ @value,2)"  
        426         />
        427                                                    
        428         <xsl:if
        429                                                             
        430          test="../n 1:text/n1: table/n1:t body/n1:tr /n1:td[@ID =$typeName Ref1]"
        431         >
        432                                                              
        433          <xsl:value -of
        434                                                                       
        435           select=".. /n1:text/n 1:table/n1 :tbody/n1: tr/n1:td[@ ID=$typeNa meRef1]" 
        436          />
        437                                                     
        438         </xsl:if>
        439                                                    
        440         <xsl:if
        441                                                             
        442          test="../n 1:text/n1: table/n1:t body/n1:tr /n1:td[@ID =$typeName Ref2]"
        443         >
        444                                                              
        445          <xsl:value -of
        446                                                                       
        447           select=".. /n1:text/n 1:table/n1 :tbody/n1: tr/n1:td[@ ID=$typeNa meRef2]" 
        448          />
        449                                                     
        450         </xsl:if>
        451                                                    
        452         <xsl:if
        453                                                             
        454          test="../n 1:text/n1: table/n1:t body/n1:tr /n1:td/n1: content[@I D=$typeNam eRef1]"
        455         >
        456                                                              
        457          <xsl:value -of
        458                                                                       
        459           select=".. /n1:text/n 1:table/n1 :tbody/n1: tr/n1:td/n 1:content[ @ID=$typeN ameRef1]" 
        460          />
        461                                                     
        462         </xsl:if>
        463                                                    
        464         <xsl:if
        465                                                             
        466          test="../n 1:text/n1: table/n1:t body/n1:tr /n1:td/n1: content[@I D=$typeNam eRef2]"
        467         >
        468                                                              
        469          <xsl:value -of
        470                                                                       
        471           select=".. /n1:text/n 1:table/n1 :tbody/n1: tr/n1:td/n 1:content[ @ID=$typeN ameRef2]" 
        472          />
        473                                                     
        474         </xsl:if>
        475                                            
        476        </xsl:when >
        477                                           
        478        <xsl:other wise>
        479                                                    
        480         <xsl:call- template 
        481          name="na" 
        482         />
        483                                            
        484        </xsl:othe rwise>
        485                                  
        486       </xsl:choo se>
        487                        
        488      </xsl:if>
        489     
        490     
        491              
        492     </xsl:temp late>
        493    
        494             
        495     <!--<xsl:t emplate na me="getRea ction"> <x sl:param n ame="react ion"/> <xs l:variable  
        496                      name ="reaction Reference"  select="$ reaction"/ > <xsl:cho ose> <xsl: when test= "/n1:Clini calDocumen t/n1:compo nent/n1:st ructuredBo dy/n1:comp onent/n1:s ection/n1: text/n1:co ntent[@ID= $reactionR eference]"
        497                      <xsl :value-of  select="/n 1:Clinical Document/n 1:componen t/n1:struc turedBody/ n1:compone nt/n1:sect ion/n1:tex t/n1:conte nt[@ID=$re actionRefe rence]"/> 
        498                      </xs l:when> <x sl:when te st="starts -with($rea ctionRefer ence,'#')" > <xsl:var iable 
        499                      name ="reaction Reference1 " select=" substring( $reactionR eference,2 )"/> <xsl: value-of 
        500                      sele ct="/n1:Cl inicalDocu ment/n1:co mponent/n1 :structure dBody/n1:c omponent/n 1:section/ n1:text/n1 :content[@ ID=$reacti onReferenc e1]"/> 
        501                      </xs l:when> </ xsl:choose > </xsl:te mplate> -- >
        502    
        503             
        504     <xsl:templ ate 
        505      name="getR eactionVal ue"
        506     >
        507                       
        508      <xsl:param  
        509       name="reac tion" 
        510      />
        511                       
        512      <xsl:varia ble 
        513       name="reac tionRefere nce" 
        514       select="$r eaction" 
        515      />
        516                       
        517      <xsl:varia ble 
        518       name="reac tionValue"
        519                                
        520       select="/n 1:Clinical Document/n 1:componen t/n1:struc turedBody/ n1:compone nt/n1:sect ion/n1:tex t/n1:conte nt[@ID=$re actionRefe rence]" 
        521      />
        522                       
        523      <xsl:varia ble 
        524       name="reac tionValue2 "
        525                                
        526       select="/n 1:Clinical Document/n 1:componen t/n1:struc turedBody/ n1:compone nt/n1:sect ion/n1:tex t/n1:conte nt[@ID=sub string-aft er($reacti onReferenc e,'#')]" 
        527      />
        528                       
        529      <xsl:varia ble 
        530       name="reac tionValue3 "
        531                                
        532       select="/n 1:Clinical Document/n 1:componen t/n1:struc turedBody/ n1:compone nt/n1:sect ion/n1:tex t/n1:table /n1:tbody/ n1:tr/n1:t d/n1:conte nt[@ID=$re actionRefe rence]" 
        533      />
        534                       
        535      <xsl:varia ble 
        536       name="reac tionValue4 "
        537                                
        538       select="/n 1:Clinical Document/n 1:componen t/n1:struc turedBody/ n1:compone nt/n1:sect ion/n1:tex t/n1:table /n1:tbody/ n1:tr/n1:t d/n1:conte nt[@ID=sub string-aft er($reacti onReferenc e,'#')]" 
        539      />
        540                       
        541      <xsl:varia ble 
        542       name="reac tionValue5 "
        543                                
        544       select="/n 1:Clinical Document/n 1:componen t/n1:struc turedBody/ n1:compone nt/n1:sect ion/n1:tex t/n1:table /n1:tbody/ n1:tr/n1:t d[@ID=$rea ctionRefer ence]" 
        545      />
        546                       
        547      <xsl:varia ble 
        548       name="reac tionValue6 "
        549                                
        550       select="/n 1:Clinical Document/n 1:componen t/n1:struc turedBody/ n1:compone nt/n1:sect ion/n1:tex t/n1:table /n1:tbody/ n1:tr/n1:t d[@ID=subs tring-afte r($reactio nReference ,'#')]" 
        551      />
        552                       
        553      <!--<xsl:v alue-of se lect="$rea ctionValue "/> -->
        554                       
        555      <xsl:if 
        556       test="stri ng-length( $reactionV alue)>1"
        557      >
        558                                 
        559       <xsl:if 
        560        test="posi tion()>1"
        561       >
        562                                           
        563        <xsl:text>
        564        
        565        </xsl:text >
        566                                  
        567       </xsl:if>
        568                                 
        569       <xsl:value -of 
        570        select="$r eactionVal ue" 
        571       />
        572                        
        573      </xsl:if>
        574                       
        575      <xsl:if 
        576       test="stri ng-length( $reactionV alue2)>1"
        577      >
        578                                 
        579       <xsl:if 
        580        test="posi tion()>1"
        581       >
        582                                           
        583        <xsl:text>
        584        
        585        </xsl:text >
        586                                  
        587       </xsl:if>
        588                                 
        589       <xsl:value -of 
        590        select="$r eactionVal ue2" 
        591       />
        592                        
        593      </xsl:if>
        594                       
        595      <xsl:if 
        596       test="stri ng-length( $reactionV alue3)>1"
        597      >
        598                                 
        599       <xsl:if 
        600        test="posi tion()>1"
        601       >
        602                                           
        603        <xsl:text>
        604        
        605        </xsl:text >
        606                                  
        607       </xsl:if>
        608                                 
        609       <xsl:value -of 
        610        select="$r eactionVal ue3" 
        611       />
        612                        
        613      </xsl:if>
        614                       
        615      <xsl:if 
        616       test="stri ng-length( $reactionV alue4)>1"
        617      >
        618                                 
        619       <xsl:if 
        620        test="posi tion()>1"
        621       >
        622                                           
        623        <xsl:text>
        624        
        625        </xsl:text >
        626                                  
        627       </xsl:if>
        628                                 
        629       <xsl:value -of 
        630        select="$r eactionVal ue4" 
        631       />
        632                        
        633      </xsl:if>
        634                       
        635      <xsl:if 
        636       test="stri ng-length( $reactionV alue5)>1"
        637      >
        638                                 
        639       <xsl:if 
        640        test="posi tion()>1"
        641       >
        642                                           
        643        <xsl:text>
        644        
        645        </xsl:text >
        646                                  
        647       </xsl:if>
        648                                 
        649       <xsl:value -of 
        650        select="$r eactionVal ue5" 
        651       />
        652                        
        653      </xsl:if>
        654                       
        655      <xsl:if 
        656       test="stri ng-length( $reactionV alue6)>1"
        657      >
        658                                 
        659       <xsl:if 
        660        test="posi tion()>1"
        661       >
        662                                           
        663        <xsl:text>
        664        
        665        </xsl:text >
        666                                  
        667       </xsl:if>
        668                                 
        669       <xsl:value -of 
        670        select="$r eactionVal ue6" 
        671       />
        672                        
        673      </xsl:if>
        674              
        675     </xsl:temp late>
        676    
        677             
        678     <xsl:templ ate 
        679      name="getA llergySour ce"
        680     >
        681                       
        682      <xsl:param  
        683       name="row"  
        684      />
        685                       
        686      <xsl:param  
        687       name="isPl aintext" 
        688       select="bo olean(true )" 
        689      />
        690                       
        691      <xsl:choos e>
        692                                 
        693       <xsl:when
        694                                          
        695        test="$row /n1:act/n1 :author/n1 :assignedA uthor/n1:r epresented Organizati on/n1:name "
        696       >
        697                                           
        698        <xsl:value -of
        699                                                   
        700         select="$r ow/n1:act/ n1:author/ n1:assigne dAuthor/n1 :represent edOrganiza tion/n1:na me" 
        701        />
        702                                  
        703       </xsl:when >
        704                                 
        705       <xsl:other wise>
        706                                           
        707        <xsl:call- template 
        708         name="na" 
        709        />
        710                                  
        711       </xsl:othe rwise>
        712                        
        713      </xsl:choo se>
        714              
        715     </xsl:temp late>
        716    
        717             
        718     <xsl:templ ate 
        719      name="getS everity"
        720     >
        721                       
        722      <xsl:param  
        723       name="obse rvation" 
        724      />
        725                       
        726      <xsl:varia ble 
        727       name="seve rityRefere nce"
        728                                
        729       select="$o bservation /n1:entryR elationshi p[@typeCod e='SUBJ']/ n1:observa tion/n1:te xt/n1:refe rence/@val ue" 
        730      />
        731     
        732                       
        733      <xsl:value -of 
        734       select=".. /n1:text/n 1:content[ @ID=$sever ityReferen ce]" 
        735      />
        736                       
        737      <xsl:value -of
        738                                
        739       select=".. /n1:text/n 1:content[ @ID=substr ing-after( $severityR eference,' #')]" 
        740      />
        741     
        742                       
        743      <xsl:text>
        744        
        745      </xsl:text >
        746     
        747     
        748              
        749     </xsl:temp late>
        750    
        751    
        752             
        753     <xsl:templ ate 
        754      name="getR eactionCod ed"
        755     >
        756                       
        757      <xsl:param  
        758       name="eR" 
        759      />
        760                       
        761      <xsl:varia ble 
        762       name="code d"
        763                                
        764       select="$e R[@inversi onInd='tru e' and @ty peCode='MF ST']" 
        765      />
        766                       
        767      <xsl:for-e ach 
        768       select="$c oded"
        769      >
        770                                 
        771       <xsl:if 
        772        test="n1:o bservation /n1:value/ n1:transla tion/@disp layName"
        773       >
        774                                           
        775        <xsl:value -of 
        776         select="n1 :observati on/n1:valu e/n1:trans lation/@di splayName"  
        777        />
        778                                  
        779       </xsl:if>
        780                        
        781      </xsl:for- each>
        782              
        783     </xsl:temp late>
        784    
        785             
        786     <xsl:templ ate 
        787      name="getP roblemOnse tDateStrin g"
        788     >
        789                       
        790      <xsl:param  
        791       name="act"  
        792      />
        793                       
        794      <xsl:if 
        795       test="$act "
        796      >
        797                                 
        798       <xsl:choos e>
        799                                           
        800        <xsl:when
        801                                                   
        802         test="stri ng-length( $act/n1:en tryRelatio nship/n1:o bservation /n1:effect iveTime/n1 :low/@valu e)>1"
        803        >
        804                                                    
        805         <xsl:value -of
        806                                                             
        807          select="$a ct/n1:entr yRelations hip/n1:obs ervation/n 1:effectiv eTime/n1:l ow/@value"  
        808         />
        809                                            
        810        </xsl:when >
        811                                           
        812        <xsl:when 
        813         test="stri ng-length( $act/n1:ef fectiveTim e/n1:low/@ value)>1"
        814        >
        815                                                    
        816         <xsl:value -of 
        817          select="n1 :act/n1:ef fectiveTim e/n1:low/@ value" 
        818         />
        819                                            
        820        </xsl:when >
        821                                  
        822       </xsl:choo se>
        823                        
        824      </xsl:if>
        825              
        826     </xsl:temp late>
        827    
        828             
        829     <xsl:templ ate 
        830      name="getP roblemCode "
        831     >
        832                       
        833      <xsl:param  
        834       name="rowD ata" 
        835      />
        836                       
        837      <!--<xsl:v ariable na me="probco denull" se lect="$row Data/n1:co de/@nullFl avor"/> -- >
        838                       
        839      <xsl:choos e>
        840                                 
        841       <!--<xsl:w hen test=" string($pr obcodenull )='UNK' ">  <xsl:call -template 
        842                                          name="na "/> </xsl: when> -->
        843                                 
        844       <xsl:when 
        845        test="$row Data/n1:va lue/@code  and not($i sKaiser)"
        846       >
        847                                           
        848        <xsl:value -of 
        849         select="$r owData/n1: value/@cod e" 
        850        />
        851                                  
        852       </xsl:when >
        853                                 
        854       <xsl:when 
        855        test="$row Data/n1:va lue/n1:tra nslation/@ code"
        856       >
        857                                           
        858        <xsl:value -of 
        859         select="$r owData/n1: value/n1:t ranslation /@code" 
        860        />
        861                                  
        862       </xsl:when >
        863                                 
        864       <xsl:other wise>
        865                                           
        866        <xsl:call- template 
        867         name="na" 
        868        />
        869                                  
        870       </xsl:othe rwise>
        871                        
        872      </xsl:choo se>
        873              
        874     </xsl:temp late>
        875    
        876             
        877     <xsl:templ ate 
        878      name="getE ncounterID "
        879     >
        880                       
        881      <xsl:param  
        882       name="enco unter" 
        883      />
        884                       
        885      <xsl:choos e>
        886                                 
        887       <xsl:when 
        888        test="$enc ounter/n1: id/@root"
        889       >
        890                                           
        891        <xsl:value -of 
        892         select="$e ncounter/n 1:id/@root
        893        />
        894                                  
        895       </xsl:when >
        896                                 
        897       <xsl:other wise>
        898                                           
        899        <xsl:call- template 
        900         name="na" 
        901        />
        902                                  
        903       </xsl:othe rwise>
        904                        
        905      </xsl:choo se>
        906              
        907     </xsl:temp late>
        908    
        909             
        910     <xsl:templ ate 
        911      name="getE ncounterTy pe"
        912     >
        913                       
        914      <xsl:param  
        915       name="enco unter" 
        916      />
        917                       
        918      <xsl:choos e>
        919      
        920                                 
        921       <xsl:when 
        922        test="$enc ounter/n1: code/@disp layName"
        923       >
        924                                           
        925        <xsl:value -of 
        926         select="$e ncounter/n 1:code/@di splayName"  
        927        />
        928                                  
        929       </xsl:when >
        930                                 
        931       <xsl:when 
        932        test="$enc ounter/n1: code/@code "
        933       >
        934                                           
        935        <xsl:value -of 
        936         select="$e ncounter/n 1:code/@co de" 
        937        />
        938                                  
        939       </xsl:when >
        940                                 
        941       <xsl:other wise>
        942                                           
        943        <xsl:call- template 
        944         name="na" 
        945        />
        946                                  
        947       </xsl:othe rwise>
        948                        
        949      </xsl:choo se>
        950     
        951              
        952     </xsl:temp late>
        953    
        954             
        955     <xsl:templ ate 
        956      name="getE ncounterFr eeText"
        957     >
        958                       
        959      <xsl:param  
        960       name="enco unter" 
        961      />
        962                       
        963      <xsl:choos e>
        964                                 
        965       <xsl:when
        966                                          
        967        test="star ts-with($e ncounter/n 1:code/n1: originalTe xt/n1:refe rence/@val ue,'#')"
        968       >
        969                                           
        970        <xsl:value -of
        971                                                   
        972         select="$e ncounter/. ./../n1:te xt/n1:cont ent[@ID=su bstring($e ncounter/n 1:code/n1: originalTe xt/n1:refe rence/@val ue,2)]" 
        973        />
        974                                  
        975       </xsl:when >
        976                                 
        977       <xsl:when 
        978        test="star ts-with($e ncounter/n 1:text/n1: reference/ @value,'#' )"
        979       >
        980                                           
        981        <xsl:if
        982                                                   
        983         test="$enc ounter/../ ../n1:text /n1:conten t[@ID=subs tring($enc ounter/n1: text/n1:re ference/@v alue,2)]"
        984        >
        985                                                    
        986         <xsl:value -of
        987                                                             
        988          select="$e ncounter/. ./../n1:te xt/n1:cont ent[@ID=su bstring($e ncounter/n 1:text/n1: reference/ @value,2)]
        989         />
        990                                            
        991        </xsl:if>
        992                                           
        993        <xsl:if
        994                                                   
        995         test="$enc ounter/../ ../n1:text /n1:table/ n1:tbody/n 1:tr/n1:td [@ID=subst ring($enco unter/n1:t ext/n1:ref erence/@va lue,2)]"
        996        >
        997                                                    
        998         <xsl:value -of
        999                                                             
        1000          select="$e ncounter/. ./../n1:te xt/n1:tabl e/n1:tbody /n1:tr/n1: td[@ID=sub string($en counter/n1 :text/n1:r eference/@ value,2)]"  
        1001         />
        1002                                            
        1003        </xsl:if>
        1004       
        1005                                  
        1006       </xsl:when >
        1007                                 
        1008       <xsl:when 
        1009        test="$enc ounter/n1: code/n1:or iginalText /n1:refere nce/@value "
        1010       >
        1011                                           
        1012        <xsl:value -of
        1013                                                   
        1014         select="$e ncounter/. ./../n1:te xt/n1:cont ent[@ID=$e ncounter/n 1:code/n1: originalTe xt/n1:refe rence/@val ue]" 
        1015        />
        1016                                  
        1017       </xsl:when >
        1018      
        1019                                 
        1020       <xsl:when 
        1021        test="star ts-with($e ncounter/n 1:text/n1: reference/ @value,'#' )"
        1022       >
        1023                                           
        1024        <xsl:varia ble 
        1025         name="encR ef"
        1026                                                   
        1027         select="su bstring($e ncounter/n 1:text/n1: reference/ @value,2)"  
        1028        />
        1029                                           
        1030        <xsl:varia ble 
        1031         name="enc"
        1032                                                   
        1033         select="$e ncounter/. ./../n1:te xt/n1:cont ent[@ID=$e ncRef]" 
        1034        />
        1035                                           
        1036        <xsl:value -of 
        1037         select="$e nc" 
        1038        />
        1039                                  
        1040       </xsl:when >
        1041                                 
        1042       <xsl:other wise>
        1043                                           
        1044        <xsl:varia ble 
        1045         name="encR ef"
        1046                                                   
        1047         select="$e ncounter/n 1:code/n1: originalTe xt/n1:refe rence/@val ue" 
        1048        />
        1049                                           
        1050        <xsl:varia ble 
        1051         name="enc"
        1052                                                   
        1053         select="$e ncounter/. ./../n1:te xt/n1:cont ent[@ID=$e ncRef]" 
        1054        />
        1055                                           
        1056        <xsl:value -of 
        1057         select="$e nc" 
        1058        />
        1059                                  
        1060       </xsl:othe rwise>
        1061                        
        1062      </xsl:choo se>
        1063              
        1064     </xsl:temp late>
        1065    
        1066    
        1067             
        1068     <xsl:templ ate 
        1069      name="getE ncounterDa teTime"
        1070     >
        1071                       
        1072      <xsl:param  
        1073       name="enco unter" 
        1074      />
        1075                       
        1076      <xsl:if 
        1077       test="$enc ounter"
        1078      >
        1079                                 
        1080       <xsl:choos e>
        1081                                           
        1082        <xsl:when 
        1083         test="$enc ounter/n1: effectiveT ime/n1:low /@value"
        1084        >
        1085                                                    
        1086         <xsl:value -of 
        1087          select="$e ncounter/n 1:effectiv eTime/n1:l ow/@value"  
        1088         />
        1089                                            
        1090        </xsl:when >
        1091                                  
        1092       </xsl:choo se>
        1093                        
        1094      </xsl:if>
        1095              
        1096     </xsl:temp late>
        1097    
        1098             
        1099     <xsl:templ ate 
        1100      name="getE ncounterPr ovider"
        1101     >
        1102                       
        1103      <xsl:param  
        1104       name="enco unter" 
        1105      />
        1106                       
        1107      <xsl:if 
        1108       test="$enc ounter"
        1109      >
        1110                                 
        1111       <xsl:choos e>
        1112                                           
        1113        <xsl:when
        1114                                                   
        1115         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"
        1116        >
        1117                                                    
        1118         <xsl:varia ble 
        1119          name="firs t"
        1120                                                             
        1121          select="$e ncounter/n 1:performe r/n1:assig nedEntity/ n1:assigne dPerson/n1 :name/n1:g iven" 
        1122         />
        1123                                                    
        1124         <xsl:varia ble 
        1125          name="last "
        1126                                                             
        1127          select="$e ncounter/n 1:performe r/n1:assig nedEntity/ n1:assigne dPerson/n1 :name/n1:f amily" 
        1128         />
        1129                                                    
        1130         <xsl:call- template 
        1131          name="form atProvider Name"
        1132         >
        1133                                                              
        1134          <xsl:with- param 
        1135           name="row"  
        1136           select="."  
        1137          />
        1138                                                              
        1139          <xsl:with- param 
        1140           name="firs t" 
        1141           select="$f irst" 
        1142          />
        1143                                                              
        1144          <xsl:with- param 
        1145           name="last
        1146           select="$l ast" 
        1147          />
        1148                                                     
        1149         </xsl:call -template>
        1150                                            
        1151        </xsl:when >
        1152                                           
        1153        <xsl:other wise>
        1154                                                    
        1155         <xsl:value -of
        1156                                                             
        1157          select="$e ncounter/n 1:performe r/n1:assig nedEntity/ n1:assigne dPerson" 
        1158         />
        1159                                            
        1160        </xsl:othe rwise>
        1161                                  
        1162       </xsl:choo se>
        1163                        
        1164      </xsl:if>
        1165              
        1166     </xsl:temp late>
        1167    
        1168             
        1169     <xsl:templ ate 
        1170      name="getE ncounterSo urce"
        1171     >
        1172                       
        1173      <xsl:param  
        1174       name="enco unter" 
        1175      />
        1176                       
        1177      <xsl:param  
        1178       name="isPl aintext" 
        1179       select="bo olean(true )" 
        1180      />
        1181                       
        1182      <xsl:choos e>
        1183                                 
        1184       <xsl:when
        1185                                          
        1186        test="$enc ounter/n1: author/n1: assignedAu thor/n1:re presentedO rganizatio n/n1:name"
        1187       >
        1188                                           
        1189        <xsl:value -of
        1190                                                   
        1191         select="$e ncounter/n 1:author/n 1:assigned Author/n1: represente dOrganizat ion/n1:nam e" 
        1192        />
        1193                                  
        1194       </xsl:when >
        1195                                 
        1196       <xsl:other wise>
        1197                                           
        1198        <xsl:call- template 
        1199         name="na" 
        1200        />
        1201                                  
        1202       </xsl:othe rwise>
        1203                        
        1204      </xsl:choo se>
        1205              
        1206     </xsl:temp late>
        1207    
        1208             
        1209     <xsl:templ ate 
        1210      name="getE ncounterRe ason"
        1211     >
        1212                       
        1213      <xsl:param  
        1214       name="enco unter" 
        1215      />
        1216                       
        1217      <xsl:param  
        1218       name="isPl aintext" 
        1219       select="bo olean(true )" 
        1220      />
        1221                       
        1222      <xsl:choos e>
        1223                                 
        1224       <xsl:when
        1225                                          
        1226        test="$enc ounter/n1: entryRelat ionship/n1 :observati on/n1:text /n1:refere nce/@value "
        1227       >
        1228                                           
        1229        <xsl:varia ble 
        1230         name="encR easonRef"
        1231                                                   
        1232         select="$e ncounter/n 1:entryRel ationship/ n1:observa tion/n1:te xt/n1:refe rence/@val ue" 
        1233        />
        1234                                           
        1235        <xsl:choos e>
        1236                                                    
        1237         <xsl:when 
        1238          test="$enc ounter/../ ../n1:text /n1:conten t[@ID=$enc ReasonRef] "
        1239         >
        1240                                                              
        1241          <xsl:value -of
        1242                                                                       
        1243           select="$e ncounter/. ./../n1:te xt/n1:cont ent[@ID=$e ncReasonRe f]" 
        1244          />
        1245                                                     
        1246         </xsl:when >
        1247                                                    
        1248         <xsl:when
        1249                                                             
        1250          test="$enc ounter/../ ../n1:text /n1:conten t[@ID=subs tring($enc ReasonRef, 2)]"
        1251         >
        1252                                                              
        1253          <xsl:value -of
        1254                                                                       
        1255           select="$e ncounter/. ./../n1:te xt/n1:cont ent[@ID=su bstring($e ncReasonRe f,2)]" 
        1256          />
        1257                                                     
        1258         </xsl:when >
        1259                                            
        1260        </xsl:choo se>
        1261       
        1262       
        1263       
        1264                                  
        1265       </xsl:when >
        1266                                 
        1267       <xsl:other wise>
        1268                                           
        1269        <xsl:call- template 
        1270         name="na" 
        1271        />
        1272                                  
        1273       </xsl:othe rwise>
        1274                        
        1275      </xsl:choo se>
        1276              
        1277     </xsl:temp late>
        1278    
        1279    
        1280             
        1281     <xsl:templ ate 
        1282      name="getP rocedureID "
        1283     >
        1284                       
        1285      <xsl:param  
        1286       name="proc edure" 
        1287      />
        1288                       
        1289      <xsl:if 
        1290       test="$pro cedure"
        1291      >
        1292                                 
        1293       <xsl:choos e>
        1294                                           
        1295        <xsl:when 
        1296         test="$pro cedure/n1: id/@root"
        1297        >
        1298                                                    
        1299         <xsl:value -of 
        1300          select="$p rocedure/n 1:id/@root
        1301         />
        1302                                            
        1303        </xsl:when >
        1304                                           
        1305        <xsl:other wise />
        1306                                  
        1307       </xsl:choo se>
        1308                        
        1309      </xsl:if>
        1310              
        1311     </xsl:temp late>
        1312    
        1313             
        1314     <xsl:templ ate 
        1315      name="getP rocedureTy pe"
        1316     >
        1317                       
        1318      <xsl:param  
        1319       name="proc edure" 
        1320      />
        1321                       
        1322      <xsl:varia ble 
        1323       name="disp layName" 
        1324       select="$p rocedure/n 1:code/@di splayName"  
        1325      />
        1326                       
        1327      <xsl:varia ble 
        1328       name="code
        1329       select="$p rocedure/n 1:code/@co de" 
        1330      />
        1331                       
        1332      <xsl:choos e>
        1333                                 
        1334       <xsl:when 
        1335        test="cont ains($disp layName,$c ode)"
        1336       >
        1337                                           
        1338        <xsl:value -of 
        1339         select="su bstring-af ter($displ ayName,$co de)" 
        1340        />
        1341                                  
        1342       </xsl:when >
        1343                                 
        1344       <xsl:other wise>
        1345                                           
        1346        <xsl:value -of 
        1347         select="$p rocedure/n 1:code/@di splayName"  
        1348        />
        1349                                  
        1350       </xsl:othe rwise>
        1351                        
        1352      </xsl:choo se>
        1353              
        1354     </xsl:temp late>
        1355    
        1356             
        1357     <xsl:templ ate 
        1358      name="getP rocedureQu alifier"
        1359     >
        1360                       
        1361      <xsl:param  
        1362       name="proc edure" 
        1363      />
        1364                       
        1365      <xsl:value -of 
        1366       select="$p rocedure/n 1:name/@di splayName"  
        1367      />
        1368                       
        1369      <xsl:text>
        1370        
        1371      </xsl:text >
        1372                       
        1373      <xsl:value -of 
        1374       select="$p rocedure/n 1:value/@d isplayName
        1375      />
        1376              
        1377     </xsl:temp late>
        1378    
        1379    
        1380             
        1381     <xsl:templ ate 
        1382      name="getP rocedureFr eeText"
        1383     >
        1384                       
        1385      <xsl:param  
        1386       name="proc edure" 
        1387      />
        1388                       
        1389      <xsl:choos e>
        1390                                 
        1391       <xsl:when 
        1392        test="star ts-with($p rocedure/n 1:text/n1: reference/ @value,'#' )"
        1393       >
        1394                                           
        1395        <xsl:varia ble 
        1396         name="proc Ref"
        1397                                                   
        1398         select="su bstring($p rocedure/n 1:text/n1: reference/ @value,2)"  
        1399        />
        1400                                           
        1401        <xsl:varia ble 
        1402         name="proc "
        1403                                                   
        1404         select="$p rocedure/. ./../n1:te xt/n1:cont ent[@ID=$p rocRef]" 
        1405        />
        1406                                           
        1407        <xsl:value -of 
        1408         select="$p roc" 
        1409        />
        1410                                  
        1411       </xsl:when >
        1412                                 
        1413       <xsl:when
        1414                                          
        1415        test="star ts-with($p rocedure/n 1:code/n1: originalTe xt/n1:refe rence/@val ue,'#')"
        1416       >
        1417                                           
        1418        <xsl:varia ble 
        1419         name="proc Ref"
        1420                                                   
        1421         select="su bstring($p rocedure/n 1:code/n1: originalTe xt/n1:refe rence/@val ue,2)" 
        1422        />
        1423                                           
        1424        <xsl:varia ble 
        1425         name="proc "
        1426                                                   
        1427         select="$p rocedure/. ./../n1:te xt/n1:cont ent[@ID=$p rocRef]" 
        1428        />
        1429                                           
        1430        <xsl:value -of 
        1431         select="$p roc" 
        1432        />
        1433                                  
        1434       </xsl:when >
        1435                                 
        1436       <xsl:other wise>
        1437                                           
        1438        <xsl:varia ble 
        1439         name="proc Ref"
        1440                                                   
        1441         select="$p rocedure/n 1:code/n1: originalTe xt/n1:refe rence/@val ue" 
        1442        />
        1443                                           
        1444        <xsl:varia ble 
        1445         name="proc "
        1446                                                   
        1447         select="$p rocedure/. ./../n1:te xt/n1:cont ent[@ID=$p rocRef]" 
        1448        />
        1449                                           
        1450        <xsl:value -of 
        1451         select="$p roc" 
        1452        />
        1453                                  
        1454       </xsl:othe rwise>
        1455                        
        1456      </xsl:choo se>
        1457              
        1458     </xsl:temp late>
        1459    
        1460    
        1461             
        1462     <xsl:templ ate 
        1463      name="getP rocedureDa teTime"
        1464     >
        1465                       
        1466      <xsl:param  
        1467       name="proc edure" 
        1468      />
        1469                       
        1470      <xsl:if 
        1471       test="$pro cedure"
        1472      >
        1473                                 
        1474       <xsl:choos e>
        1475                                           
        1476        <xsl:when 
        1477         test="$pro cedure/n1: effectiveT ime/n1:low /@value"
        1478        >
        1479                                                    
        1480         <xsl:value -of 
        1481          select="$p rocedure/n 1:effectiv eTime/n1:l ow/@value"  
        1482         />
        1483                                            
        1484        </xsl:when >
        1485                                  
        1486       </xsl:choo se>
        1487                        
        1488      </xsl:if>
        1489              
        1490     </xsl:temp late>
        1491    
        1492             
        1493     <xsl:templ ate 
        1494      name="getP rocedurePr ovider"
        1495     >
        1496                       
        1497      <xsl:param  
        1498       name="proc edure" 
        1499      />
        1500                       
        1501      <xsl:if 
        1502       test="$pro cedure"
        1503      >
        1504                                 
        1505       <xsl:choos e>
        1506                                           
        1507        <xsl:when
        1508                                                   
        1509         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"
        1510        >
        1511                                                    
        1512         <xsl:varia ble 
        1513          name="firs t"
        1514                                                             
        1515          select="$p rocedure/n 1:performe r/n1:assig nedEntity/ n1:assigne dPerson/n1 :name/n1:g iven" 
        1516         />
        1517                                                    
        1518         <xsl:varia ble 
        1519          name="last "
        1520                                                             
        1521          select="$p rocedure/n 1:performe r/n1:assig nedEntity/ n1:assigne dPerson/n1 :name/n1:f amily" 
        1522         />
        1523                                                    
        1524         <xsl:call- template 
        1525          name="form atProvider Name"
        1526         >
        1527                                                              
        1528          <xsl:with- param 
        1529           name="row"  
        1530           select="."  
        1531          />
        1532                                                              
        1533          <xsl:with- param 
        1534           name="firs t" 
        1535           select="$f irst" 
        1536          />
        1537                                                              
        1538          <xsl:with- param 
        1539           name="last
        1540           select="$l ast" 
        1541          />
        1542                                                     
        1543         </xsl:call -template>
        1544                                            
        1545        </xsl:when >
        1546                                           
        1547        <xsl:other wise>
        1548                                                    
        1549         <xsl:value -of
        1550                                                             
        1551          select="$p rocedure/n 1:performe r/n1:assig nedEntity/ n1:assigne dPerson" 
        1552         />
        1553                                            
        1554        </xsl:othe rwise>
        1555                                  
        1556       </xsl:choo se>
        1557                        
        1558      </xsl:if>
        1559              
        1560     </xsl:temp late>
        1561    
        1562    
        1563    
        1564    
        1565    
        1566    
        1567    
        1568             
        1569     <xsl:templ ate 
        1570      name="getP rocedureSo urce"
        1571     >
        1572                       
        1573      <xsl:param  
        1574       name="proc edure" 
        1575      />
        1576                       
        1577      <xsl:param  
        1578       name="isPl aintext" 
        1579       select="bo olean(true )" 
        1580      />
        1581                       
        1582      <xsl:choos e>
        1583                                 
        1584       <xsl:when
        1585                                          
        1586        test="$pro cedure/n1: author/n1: assignedAu thor/n1:re presentedO rganizatio n/n1:name"
        1587       >
        1588                                           
        1589        <xsl:value -of
        1590                                                   
        1591         select="$p rocedure/n 1:author/n 1:assigned Author/n1: represente dOrganizat ion/n1:nam e" 
        1592        />
        1593                                  
        1594       </xsl:when >
        1595                                 
        1596       <xsl:other wise>
        1597                                           
        1598        <xsl:call- template 
        1599         name="na" 
        1600        />
        1601                                  
        1602       </xsl:othe rwise>
        1603                        
        1604      </xsl:choo se>
        1605              
        1606     </xsl:temp late>
        1607    
        1608    
        1609    
        1610    
        1611    
        1612             
        1613     <xsl:templ ate 
        1614      name="medD ateBeginSt ring"
        1615     >
        1616                       
        1617      <xsl:param  
        1618       name="subs tanceAdmin
        1619      />
        1620                       
        1621      <xsl:if 
        1622       test="$sub stanceAdmi n"
        1623      >
        1624                                 
        1625       <xsl:choos e>
        1626       
        1627                                           
        1628        <xsl:when
        1629                                                   
        1630         test="$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[@moodCod e='EVN' an d @classCo de='SPLY'] /n1:time/@ value"
        1631        >
        1632                                                    
        1633         <xsl:value -of
        1634                                                             
        1635          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:time /@value" 
        1636         />
        1637                                            
        1638        </xsl:when >
        1639                                           
        1640        <xsl:when
        1641                                                   
        1642         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"
        1643        >
        1644                                                    
        1645         <xsl:value -of
        1646                                                             
        1647          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" 
        1648         />
        1649                                            
        1650        </xsl:when >
        1651       
        1652                                  
        1653       </xsl:choo se>
        1654                        
        1655      </xsl:if>
        1656              
        1657     </xsl:temp late>
        1658    
        1659             
        1660     <xsl:templ ate 
        1661      name="getM edicationN ame"
        1662     >
        1663                       
        1664      <xsl:param  
        1665       name="subs tanceAdmin
        1666      />
        1667                       
        1668      <xsl:param  
        1669       name="row"  
        1670      />
        1671                       
        1672      <xsl:varia ble 
        1673       name="ref1 "
        1674                                
        1675       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" 
        1676      />
        1677                       
        1678      <xsl:if 
        1679       test="$sub stanceAdmi n"
        1680      >
        1681                                 
        1682       <xsl:choos e>
        1683                                           
        1684        <xsl:when 
        1685         test="$row /../n1:tex t/n1:list/ n1:item/n1 :content[@ ID=$ref1]"
        1686        >
        1687                                                    
        1688         <xsl:value -of
        1689                                                             
        1690          select="$r ow/../n1:t ext/n1:lis t/n1:item/ n1:content [@ID=$ref1 ]" 
        1691         />
        1692                                            
        1693        </xsl:when >
        1694                                           
        1695        <xsl:when
        1696                                                   
        1697         test="$row /../n1:tex t/n1:list/ n1:item/n1 :content[@ ID=substri ng-after($ ref1,'#')] "
        1698        >
        1699                                                    
        1700         <xsl:value -of
        1701                                                             
        1702          select="$r ow/../n1:t ext/n1:lis t/n1:item/ n1:content [@ID=subst ring-after ($ref1,'#' )]" 
        1703         />
        1704                                            
        1705        </xsl:when >
        1706                                           
        1707        <xsl:when
        1708                                                   
        1709         test="$row /../n1:tex t/n1:conte nt[@ID=sub string-aft er($ref1,' #')]"
        1710        >
        1711                                                    
        1712         <xsl:value -of
        1713                                                             
        1714          select="$r ow/../n1:t ext/n1:con tent[@ID=s ubstring-a fter($ref1 ,'#')]" 
        1715         />
        1716                                            
        1717        </xsl:when >
        1718                                           
        1719        <xsl:when
        1720                                                   
        1721         test="$row /../n1:tex t/n1:table /n1:tbody/ n1:tr/n1:t d/n1:conte nt[@ID=sub string-aft er($ref1,' #')]"
        1722        >
        1723                                                    
        1724         <xsl:value -of
        1725                                                             
        1726          select="$r ow/../n1:t ext/n1:tab le/n1:tbod y/n1:tr/n1 :td/n1:con tent[@ID=s ubstring-a fter($ref1 ,'#')]" 
        1727         />
        1728                                            
        1729        </xsl:when >
        1730                                           
        1731        <xsl:when
        1732                                                   
        1733         test="$row /../n1:tex t/n1:table /n1:tbody/ n1:tr/n1:t d[@ID=subs tring-afte r($ref1,'# ')]"
        1734        >
        1735                                                    
        1736         <xsl:value -of
        1737                                                             
        1738          select="$r ow/../n1:t ext/n1:tab le/n1:tbod y/n1:tr/n1 :td[@ID=su bstring-af ter($ref1, '#')]" 
        1739         />
        1740                                            
        1741        </xsl:when >
        1742                                           
        1743        <xsl:when
        1744                                                   
        1745         test="$sub stanceAdmi n/n1:consu mable/n1:m anufacture dProduct/n 1:manufact uredMateri al/n1:code /n1:origin alText"
        1746        >
        1747                                                    
        1748         <xsl:value -of
        1749                                                             
        1750          select="$s ubstanceAd min/n1:con sumable/n1 :manufactu redProduct /n1:manufa cturedMate rial/n1:co de/n1:orig inalText" 
        1751         />
        1752                                            
        1753        </xsl:when >
        1754                                           
        1755        <xsl:when
        1756                                                   
        1757         test="$sub stanceAdmi n/n1:consu mable/n1:m anufacture dProduct/n 1:manufact uredMateri al/n1:code /@displayN ame"
        1758        >
        1759                                                    
        1760         <xsl:value -of
        1761                                                             
        1762          select="$s ubstanceAd min/n1:con sumable/n1 :manufactu redProduct /n1:manufa cturedMate rial/n1:co de/@displa yName" 
        1763         />
        1764                                            
        1765        </xsl:when >
        1766                                           
        1767        <xsl:other wise>
        1768                                                    
        1769         <xsl:value -of
        1770                                                             
        1771          select="$s ubstanceAd min/n1:con sumable/n1 :manufactu redProduct /n1:manufa cturedMate rial/n1:na me" 
        1772         />
        1773                                            
        1774        </xsl:othe rwise>
        1775                                  
        1776       </xsl:choo se>
        1777                        
        1778      </xsl:if>
        1779              
        1780     </xsl:temp late>
        1781    
        1782             
        1783     <xsl:templ ate 
        1784      name="medE xpireDateS tring"
        1785     >
        1786                       
        1787      <xsl:param  
        1788       name="subs tanceAdmin
        1789      />
        1790                       
        1791      <xsl:if 
        1792       test="$sub stanceAdmi n"
        1793      >
        1794                                 
        1795       <xsl:choos e>
        1796       
        1797       
        1798                                           
        1799        <xsl:when
        1800                                                   
        1801         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 "
        1802        >
        1803                                                    
        1804         <xsl:value -of
        1805                                                             
        1806          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" 
        1807         />
        1808                                            
        1809        </xsl:when >
        1810                                           
        1811        <xsl:when
        1812                                                   
        1813         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 /n1:high/@ value)>1"
        1814        >
        1815                                                    
        1816         <xsl:value -of
        1817                                                             
        1818          select="$s ubstanceAd min/n1:ent ryRelation ship[@type Code='REFR ']/n1:supp ly[@classC ode='SPLY'  and @mood Code='INT' ]/n1:effec tiveTime/n 1:high/@va lue" 
        1819         />
        1820                                            
        1821        </xsl:when >
        1822       
        1823                                  
        1824       </xsl:choo se>
        1825                        
        1826      </xsl:if>
        1827              
        1828     </xsl:temp late>
        1829    
        1830             
        1831     <xsl:templ ate 
        1832      name="getM edStatusSt ring"
        1833     >
        1834                       
        1835      <xsl:param  
        1836       name="subs tanceAdmin
        1837      />
        1838                       
        1839      <xsl:if 
        1840       test="$sub stanceAdmi n"
        1841      >
        1842                                 
        1843       <xsl:choos e>
        1844                                           
        1845        <xsl:when
        1846                                                   
        1847         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"
        1848        >
        1849                                                    
        1850         <xsl:value -of
        1851                                                             
        1852          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" 
        1853         />
        1854                                            
        1855        </xsl:when >
        1856       
        1857                                           
        1858        <xsl:when
        1859                                                   
        1860         test="stri ng-length( $substance Admin/n1:e ntryRelati onship[@ty peCode='RE FR']/n1:ob servation[ @classCode ='OBS' and  @moodCode ='EVN']/n1 :value/@di splayName) >1"
        1861        >
        1862                                                    
        1863         <xsl:value -of
        1864                                                             
        1865          select="$s ubstanceAd min/n1:ent ryRelation ship[@type Code='REFR ']/n1:obse rvation[@c lassCode=' OBS' and @ moodCode=' EVN']/n1:v alue/@disp layName" 
        1866         />
        1867                                            
        1868        </xsl:when >
        1869       
        1870                                           
        1871        <xsl:when
        1872                                                   
        1873         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"
        1874        >
        1875                                                    
        1876         <xsl:value -of
        1877                                                             
        1878          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
        1879         />
        1880                                            
        1881        </xsl:when >
        1882       
        1883       
        1884       
        1885       
        1886                                           
        1887        <xsl:when
        1888                                                   
        1889         test="stri ng-length( $substance Admin/n1:e ntryRelati onship/n1: observatio n/n1:value [@xsi:type ='CE']/n1: originalTe xt)>1"
        1890        >
        1891                                                    
        1892         <xsl:value -of
        1893                                                             
        1894          select="$s ubstanceAd min/n1:ent ryRelation ship/n1:ob servation/ n1:value[@ xsi:type=' CE']/n1:or iginalText
        1895         />
        1896                                            
        1897        </xsl:when >
        1898                                           
        1899        <xsl:when
        1900                                                   
        1901         test="stri ng-length( $substance Admin/n1:e ntryRelati onship/n1: observatio n/n1:value [@xsi:type ='CE']/@di splayName) >1"
        1902        >
        1903                                                    
        1904         <xsl:value -of
        1905                                                             
        1906          select="$s ubstanceAd min/n1:ent ryRelation ship/n1:ob servation/ n1:value[@ xsi:type=' CE']/@disp layName" 
        1907         />
        1908                                            
        1909        </xsl:when >
        1910                                  
        1911       </xsl:choo se>
        1912                        
        1913      </xsl:if>
        1914              
        1915     </xsl:temp late>
        1916    
        1917             
        1918     <xsl:templ ate 
        1919      name="getR xNumString "
        1920     >
        1921                       
        1922      <xsl:param  
        1923       name="subs tanceAdmin
        1924      />
        1925                       
        1926      <xsl:if 
        1927       test="$sub stanceAdmi n"
        1928      >
        1929                                 
        1930       <xsl:choos e>
        1931                                           
        1932        <xsl:when
        1933                                                   
        1934         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"
        1935        >
        1936                                                    
        1937         <xsl:value -of
        1938                                                             
        1939          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" 
        1940         />
        1941                                            
        1942        </xsl:when >
        1943                                           
        1944        <xsl:when
        1945                                                   
        1946         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"
        1947        >
        1948                                                    
        1949         <xsl:value -of
        1950                                                             
        1951          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"  
        1952         />
        1953                                            
        1954        </xsl:when >
        1955                                  
        1956       </xsl:choo se>
        1957                        
        1958      </xsl:if>
        1959              
        1960     </xsl:temp late>
        1961    
        1962             
        1963     <xsl:templ ate 
        1964      name="getM edProvider "
        1965     >
        1966                       
        1967      <xsl:param  
        1968       name="subs tanceAdmin
        1969      />
        1970                       
        1971      <xsl:varia ble 
        1972       name="assi gnedPerson 1"
        1973                                
        1974       select="$s ubstanceAd min/n1:ent ryRelation ship[@type Code='REFR ']/n1:supp ly/n1:auth or/n1:assi gnedAuthor /n1:assign edPerson" 
        1975      />
        1976                       
        1977      <xsl:varia ble 
        1978       name="assi gnedPerson 2"
        1979                                
        1980       select="$s ubstanceAd min/n1:ent ryRelation ship/n1:su pply/n1:au thor/n1:as signedAuth or/n1:assi gnedPerson
        1981      />
        1982                       
        1983      <xsl:varia ble 
        1984       name="assi gnedPerson 3"
        1985                                
        1986       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" 
        1987      />
        1988     
        1989                       
        1990      <xsl:if 
        1991       test="$sub stanceAdmi n"
        1992      >
        1993      
        1994                                 
        1995       <xsl:choos e>
        1996       
        1997                                           
        1998        <xsl:when 
        1999         test="stri ng-length( $assignedP erson1/n1: name)>1"
        2000        >
        2001                                                    
        2002         <xsl:choos e>
        2003                                                              
        2004          <xsl:when
        2005                                                                       
        2006           test="$ass ignedPerso n1/n1:name /n1:given  and $assig nedPerson1 /n1:name/n 1:family"
        2007          >
        2008                                                                        
        2009           <xsl:call- template 
        2010            name="form atProvider Name"
        2011           >
        2012                                                                                  
        2013            <xsl:with- param 
        2014             name="row"  
        2015             select="."  
        2016            />
        2017                                                                                  
        2018            <xsl:with- param 
        2019             name="firs t"
        2020                                                                                           
        2021             select="$a ssignedPer son1/n1:na me/n1:give n" 
        2022            />
        2023                                                                                  
        2024            <xsl:with- param 
        2025             name="last "
        2026                                                                                           
        2027             select="$a ssignedPer son1/n1:na me/n1:fami ly" 
        2028            />
        2029                                                                         
        2030           </xsl:call -template>
        2031                                                               
        2032          </xsl:when >
        2033                                                              
        2034          <xsl:other wise>
        2035                                                                        
        2036           <xsl:value -of 
        2037            select="$a ssignedPer son1/n1:na me" 
        2038           />
        2039                                                               
        2040          </xsl:othe rwise>
        2041                                                     
        2042         </xsl:choo se>
        2043                                            
        2044        </xsl:when >
        2045       
        2046                                           
        2047        <xsl:when
        2048                                                   
        2049         test="stri ng-length( $substance Admin/n1:e ntryRelati onship/n1: supply/n1: author/n1: assignedAu thor/n1:as signedPers on/n1:name )>1"
        2050        >
        2051                                                    
        2052         <xsl:choos e>
        2053                                                              
        2054          <xsl:when
        2055                                                                       
        2056           test="$ass ignedPerso n2/n1:name /n1:given  and $assig nedPerson2 /n1:name/n 1:family"
        2057          >
        2058                                                                        
        2059           <xsl:call- template 
        2060            name="form atProvider Name"
        2061           >
        2062                                                                                  
        2063            <xsl:with- param 
        2064             name="row"  
        2065             select="."  
        2066            />
        2067                                                                                  
        2068            <xsl:with- param 
        2069             name="firs t"
        2070                                                                                           
        2071             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" 
        2072            />
        2073                                                                                  
        2074            <xsl:with- param 
        2075             name="last "
        2076                                                                                           
        2077             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" 
        2078            />
        2079                                                                         
        2080           </xsl:call -template>
        2081                                                               
        2082          </xsl:when >
        2083                                                              
        2084          <xsl:other wise>
        2085                                                                        
        2086           <xsl:value -of
        2087                                                                                 
        2088            select="$s ubstanceAd min/n1:ent ryRelation ship/n1:su pply/n1:au thor/n1:as signedAuth or/n1:assi gnedPerson /n1:name" 
        2089           />
        2090                                                               
        2091          </xsl:othe rwise>
        2092                                                     
        2093         </xsl:choo se>
        2094                                            
        2095        </xsl:when >
        2096       
        2097                                           
        2098        <xsl:when
        2099                                                   
        2100         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"
        2101        >
        2102                                                    
        2103         <xsl:choos e>
        2104                                                              
        2105          <xsl:when
        2106                                                                       
        2107           test="$ass ignedPerso n3/n1:name /n1:given  and $assig nedPerson3 /n1:name/n 1:family"
        2108          >
        2109                                                                        
        2110           <xsl:call- template 
        2111            name="form atProvider Name"
        2112           >
        2113                                                                                  
        2114            <xsl:with- param 
        2115             name="row"  
        2116             select="."  
        2117            />
        2118                                                                                  
        2119            <xsl:with- param 
        2120             name="firs t"
        2121                                                                                           
        2122             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" 
        2123            />
        2124                                                                                  
        2125            <xsl:with- param 
        2126             name="last "
        2127                                                                                           
        2128             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"  
        2129            />
        2130                                                                         
        2131           </xsl:call -template>
        2132                                                               
        2133          </xsl:when >
        2134                                                              
        2135          <xsl:other wise>
        2136                                                                        
        2137           <xsl:value -of
        2138                                                                                 
        2139            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"  
        2140           />
        2141                                                               
        2142          </xsl:othe rwise>
        2143                                                     
        2144         </xsl:choo se>
        2145                                            
        2146        </xsl:when >
        2147       
        2148       
        2149       
        2150                                           
        2151        <!--<xsl:w hen test=" string-len gth($subst anceAdmin/ n1:entryRe lationship /n1:supply /n1:author /n1:assign edAuthor/n 1:assigned Person/n1: name)>1"> 
        2152                                                    <xsl:value -of select ="$substan ceAdmin/n1 :entryRela tionship/n 1:supply/n 1:author/n 1:assigned Author/n1: assignedPe rson/n1:na me"/> 
        2153                                                    </xsl:when > <xsl:whe n test="st ring-lengt h($substan ceAdmin/n1 :consumabl e/n1:manuf acturedPro duct/n1:ma nufactured Material/n 1:entryRel ationship/ n1:supply/ n1:author/ n1:assigne dAuthor/n1 :assignedP erson/n1:n ame)>1"> 
        2154                                                    <xsl:value -of select ="$substan ceAdmin/n1 :consumabl e/n1:manuf acturedPro duct/n1:ma nufactured Material/n 1:entryRel ationship/ n1:supply/ n1:author/ n1:assigne dAuthor/n1 :assignedP erson/n1:n ame"/> 
        2155                                                    </xsl:when > -->
        2156       
        2157                                  
        2158       </xsl:choo se>
        2159                        
        2160      </xsl:if>
        2161              
        2162     </xsl:temp late>
        2163    
        2164             
        2165     <xsl:templ ate 
        2166      name="getM edQuantity String"
        2167     >
        2168                       
        2169      <xsl:param  
        2170       name="subs tanceAdmin
        2171      />
        2172                       
        2173      <xsl:if 
        2174       test="$sub stanceAdmi n"
        2175      >
        2176                                 
        2177       <xsl:choos e>
        2178                                           
        2179        <xsl:when
        2180                                                   
        2181         test="stri ng-length( $substance Admin/n1:e ntryRelati onship[@ty peCode='RE FR']/n1:su pply/n1:qu antity/@va lue)>1"
        2182        >
        2183                                                    
        2184         <xsl:value -of
        2185                                                             
        2186          select="$s ubstanceAd min/n1:ent ryRelation ship[@type Code='REFR ']/n1:supp ly/n1:quan tity/@valu e" 
        2187         />
        2188                                            
        2189        </xsl:when >
        2190                                           
        2191        <xsl:when
        2192                                                   
        2193         test="stri ng-length( $substance Admin/n1:e ntryRelati onship/n1: supply[@cl assCode='S PLY' and @ moodCode=' INT']/n1:q uantity/@v alue)>0"
        2194        >
        2195                                                    
        2196         <xsl:value -of
        2197                                                             
        2198          select="$s ubstanceAd min/n1:ent ryRelation ship/n1:su pply[@clas sCode='SPL Y' and @mo odCode='IN T']/n1:qua ntity/@val ue" 
        2199         />
        2200                                            
        2201        </xsl:when >
        2202                                           
        2203        <xsl:when
        2204                                                   
        2205         test="stri ng-length( $substance Admin/n1:e ntryRelati onship/n1: supply/n1: quantity/@ value)>1"
        2206        >
        2207                                                    
        2208         <xsl:value -of
        2209                                                             
        2210          select="$s ubstanceAd min/n1:ent ryRelation ship/n1:su pply/n1:qu antity/@va lue" 
        2211         />
        2212                                            
        2213        </xsl:when >
        2214                                           
        2215        <xsl:when 
        2216         test="stri ng-length( $substance Admin/n1:d oseQuantit y/@value)> 1"
        2217        >
        2218                                                    
        2219         <xsl:value -of 
        2220          select="$s ubstanceAd min/n1:dos eQuantity/ @value" 
        2221         />
        2222                                            
        2223        </xsl:when >
        2224                                           
        2225        <xsl:when
        2226                                                   
        2227         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/@va lue)>1"
        2228        >
        2229                                                    
        2230         <xsl:value -of
        2231                                                             
        2232          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/@valu e" 
        2233         />
        2234                                            
        2235        </xsl:when >
        2236                                  
        2237       </xsl:choo se>
        2238                        
        2239      </xsl:if>
        2240              
        2241     </xsl:temp late>
        2242    
        2243             
        2244     <xsl:templ ate 
        2245      name="getS ig"
        2246     >
        2247                       
        2248      <xsl:param  
        2249       name="subs tanceAdmin
        2250      />
        2251                       
        2252      <xsl:varia ble 
        2253       name="sigI d1"
        2254                                
        2255       select="$s ubstanceAd min/n1:tex t/n1:refer ence/@valu e" 
        2256      />
        2257                       
        2258      <xsl:varia ble 
        2259       name="sigI d2" 
        2260       select="su bstring-af ter($sigId 1,'#')" 
        2261      />
        2262                       
        2263      <!--<xsl:i f test="$s ubstanceAd min/n1:tex t/n1:refer ence/@valu e"> -->
        2264                       
        2265      <xsl:choos e>
        2266                                 
        2267       <xsl:when
        2268                                          
        2269        test="$sub stanceAdmi n/../../n1 :text/n1:l ist/n1:ite m/n1:conte nt[@ID=$si gId1]"
        2270       >
        2271                                           
        2272        <xsl:value -of
        2273                                                   
        2274         select="$s ubstanceAd min/../../ n1:text/n1 :list/n1:i tem/n1:con tent[@ID=$ sigId1]" 
        2275        />
        2276                                  
        2277       </xsl:when >
        2278                                 
        2279       <xsl:when
        2280                                          
        2281        test="$sub stanceAdmi n/../../n1 :text/n1:l ist/n1:ite m/n1:conte nt[@ID=$si gId2]"
        2282       >
        2283                                           
        2284        <xsl:value -of
        2285                                                   
        2286         select="$s ubstanceAd min/../../ n1:text/n1 :list/n1:i tem/n1:con tent[@ID=$ sigId2]" 
        2287        />
        2288                                  
        2289       </xsl:when >
        2290                                 
        2291       <xsl:when
        2292                                          
        2293        test="$sub stanceAdmi n/../../n1 :text/n1:t able/n1:tb ody/n1:tr/ n1:td/n1:c ontent[@ID =$sigId2]"
        2294       >
        2295                                           
        2296        <xsl:value -of
        2297                                                   
        2298         select="$s ubstanceAd min/../../ n1:text/n1 :table/n1: tbody/n1:t r/n1:td/n1 :content[@ ID=$sigId2 ]" 
        2299        />
        2300                                  
        2301       </xsl:when >
        2302                                 
        2303       <xsl:other wise />
        2304                        
        2305      </xsl:choo se>
        2306                       
        2307      <!--</xsl: if> -->
        2308              
        2309     </xsl:temp late>
        2310    
        2311             
        2312     <xsl:templ ate 
        2313      name="getP roblemSour ce"
        2314     >
        2315                       
        2316      <xsl:param  
        2317       name="row"  
        2318      />
        2319                       
        2320      <xsl:param  
        2321       name="isPl aintext" 
        2322       select="bo olean(true )" 
        2323      />
        2324                       
        2325      <xsl:choos e>
        2326                                 
        2327       <xsl:when
        2328                                          
        2329        test="$row /n1:act/n1 :author/n1 :assignedA uthor/n1:r epresented Organizati on/n1:name "
        2330       >
        2331                                           
        2332        <xsl:value -of
        2333                                                   
        2334         select="$r ow/n1:act/ n1:author/ n1:assigne dAuthor/n1 :represent edOrganiza tion/n1:na me" 
        2335        />
        2336                                  
        2337       </xsl:when >
        2338                                 
        2339       <xsl:other wise>
        2340                                           
        2341        <xsl:call- template 
        2342         name="na" 
        2343        />
        2344                                  
        2345       </xsl:othe rwise>
        2346                        
        2347      </xsl:choo se>
        2348              
        2349     </xsl:temp late>
        2350    
        2351             
        2352     <xsl:templ ate 
        2353      name="getP roblemProv ider"
        2354     >
        2355                       
        2356      <xsl:param  
        2357       name="perf ormer" 
        2358      />
        2359                       
        2360      <xsl:varia ble 
        2361       name="prov iderRef"
        2362                                
        2363       select="$p erformer/n 1:assigned Entity/n1: id/@extens ion" 
        2364      />
        2365                       
        2366      <xsl:choos e>
        2367                                 
        2368       <xsl:when
        2369                                          
        2370        test="/n1: ClinicalDo cument/n1: documentat ionOf/n1:s erviceEven t/n1:perfo rmer/n1:as signedEnti ty/n1:id[@ extension= $providerR ef]/../n1: assignedPe rson/n1:na me"
        2371       >
        2372                                           
        2373        <xsl:value -of
        2374                                                   
        2375         select="/n 1:Clinical Document/n 1:document ationOf/n1 :serviceEv ent/n1:per former/n1: assignedEn tity/n1:id [@extensio n=$provide rRef]/../n 1:assigned Person/n1: name" 
        2376        />
        2377                                  
        2378       </xsl:when >
        2379                                 
        2380       <xsl:other wise>
        2381                                           
        2382        <xsl:call- template 
        2383         name="na" 
        2384        />
        2385                                  
        2386       </xsl:othe rwise>
        2387                        
        2388      </xsl:choo se>
        2389              
        2390     </xsl:temp late>
        2391    
        2392             
        2393     <!-- LABS  -->
        2394    
        2395             
        2396     <xsl:templ ate 
        2397      name="getR esultDT"
        2398     >
        2399                       
        2400      <xsl:param  
        2401       name="obse rvation" 
        2402      />
        2403                       
        2404      <xsl:if 
        2405       test="$obs ervation"
        2406      >
        2407                                 
        2408       <xsl:choos e>
        2409                                           
        2410        <xsl:when 
        2411         test="$obs ervation/n 1:effectiv eTime/@val ue"
        2412        >
        2413                                                    
        2414         <xsl:call- template 
        2415          name="form atDate"
        2416         >
        2417                                                              
        2418          <xsl:with- param 
        2419           name="date "
        2420                                                                       
        2421           select="$o bservation /n1:effect iveTime/@v alue" 
        2422          />
        2423                                                     
        2424         </xsl:call -template>
        2425                                            
        2426        </xsl:when >
        2427                                           
        2428        <xsl:when
        2429                                                   
        2430         test="n1:e ntry/n1:or ganizer/n1 :component /n1:observ ation/n1:e ffectiveTi me/@value"
        2431        >
        2432                                                    
        2433         <xsl:call- template 
        2434          name="form atDate"
        2435         >
        2436                                                              
        2437          <xsl:with- param 
        2438           name="date "
        2439                                                                       
        2440           select="n1 :entry/n1: organizer/ n1:compone nt/n1:obse rvation/n1 :effective Time/@valu e" 
        2441          />
        2442                                                     
        2443         </xsl:call -template>
        2444                                            
        2445        </xsl:when >
        2446                                           
        2447        <xsl:other wise />
        2448                                  
        2449       </xsl:choo se>
        2450                        
        2451      </xsl:if>
        2452              
        2453     </xsl:temp late>
        2454    
        2455             
        2456     <xsl:templ ate 
        2457      name="getR esultID"
        2458     >
        2459                       
        2460      <xsl:param  
        2461       name="obse rvation" 
        2462      />
        2463                       
        2464      <xsl:if 
        2465       test="$obs ervation"
        2466      >
        2467                                 
        2468       <xsl:choos e>
        2469                                           
        2470        <xsl:when 
        2471         test="$obs ervation/n 1:id/@root "
        2472        >
        2473                                                    
        2474         <xsl:value -of 
        2475          select="$o bservation /n1:id/@ro ot" 
        2476         />
        2477                                            
        2478        </xsl:when >
        2479                                           
        2480        <xsl:other wise />
        2481                                  
        2482       </xsl:choo se>
        2483                        
        2484      </xsl:if>
        2485              
        2486     </xsl:temp late>
        2487    
        2488             
        2489     <xsl:templ ate 
        2490      name="getR esultType"
        2491     >
        2492                       
        2493      <xsl:param  
        2494       name="obse rvation" 
        2495      />
        2496                       
        2497      <xsl:choos e>
        2498                                 
        2499       <!--<xsl:w hen test=" $observati on/n1:code /@code"> < xsl:value- of select= "$observat ion/n1:cod e/@code"/>  
        2500                                          </xsl:wh en> -->
        2501                                 
        2502       <xsl:when 
        2503        test="$obs ervation/n 1:code/@di splayName"
        2504       >
        2505                                           
        2506        <xsl:value -of 
        2507         select="$o bservation /n1:code/@ displayNam e" 
        2508        />
        2509                                  
        2510       </xsl:when >
        2511                                 
        2512       <xsl:other wise />
        2513                        
        2514      </xsl:choo se>
        2515              
        2516     </xsl:temp late>
        2517    
        2518             
        2519     <xsl:templ ate 
        2520      name="getR esultValue "
        2521     >
        2522                       
        2523      <xsl:param  
        2524       name="obse rvation" 
        2525      />
        2526                       
        2527      <xsl:if 
        2528       test="$obs ervation"
        2529      >
        2530                                 
        2531       <xsl:choos e>
        2532                                           
        2533        <xsl:when 
        2534         test="$obs ervation/n 1:value/@v alue"
        2535        >
        2536                                                    
        2537         <xsl:value -of 
        2538          select="$o bservation /n1:value/ @value" 
        2539         />
        2540                                                    
        2541         <xsl:if 
        2542          test="$obs ervation/n 1:value/@u nit"
        2543         >
        2544                                                              
        2545          <xsl:text>
        2546            
        2547          </xsl:text >
        2548                                                              
        2549          <xsl:value -of 
        2550           select="$o bservation /n1:value/ @unit" 
        2551          />
        2552                                                     
        2553         </xsl:if>
        2554                                            
        2555        </xsl:when >
        2556                                           
        2557        <xsl:other wise>
        2558                                                    
        2559         <xsl:call- template 
        2560          name="na" 
        2561         />
        2562                                            
        2563        </xsl:othe rwise>
        2564                                  
        2565       </xsl:choo se>
        2566                        
        2567      </xsl:if>
        2568              
        2569     </xsl:temp late>
        2570    
        2571             
        2572     <xsl:templ ate 
        2573      name="getI nterpretat ion"
        2574     >
        2575                       
        2576      <xsl:param  
        2577       name="inte rpretation
        2578      />
        2579                       
        2580      <xsl:choos e>
        2581                                 
        2582       <xsl:when 
        2583        test="$int erpretatio n/@display Name"
        2584       >
        2585                                           
        2586        <xsl:value -of 
        2587         select="$i nterpretat ion/@displ ayName" 
        2588        />
        2589                                  
        2590       </xsl:when >
        2591                                 
        2592       <xsl:when 
        2593        test="$int erpretatio n/n1:origi nalText"
        2594       >
        2595                                           
        2596        <xsl:value -of 
        2597         select="$i nterpretat ion/n1:ori ginalText"  
        2598        />
        2599                                  
        2600       </xsl:when >
        2601                                 
        2602       <xsl:other wise />
        2603                        
        2604      </xsl:choo se>
        2605              
        2606     </xsl:temp late>
        2607    
        2608             
        2609     <xsl:templ ate 
        2610      name="getR efRange"
        2611     >
        2612                       
        2613      <xsl:param  
        2614       name="row"  
        2615      />
        2616                       
        2617      <xsl:choos e>
        2618                                 
        2619       <xsl:when
        2620                                          
        2621        test="$row /n1:observ ation/n1:r eferenceRa nge/n1:obs ervationRa nge/n1:tex t"
        2622       >
        2623                                           
        2624        <xsl:value -of
        2625                                                   
        2626         select="$r ow/n1:obse rvation/n1 :reference Range/n1:o bservation Range/n1:t ext" 
        2627        />
        2628                                  
        2629       </xsl:when >
        2630                                 
        2631       <xsl:when
        2632                                          
        2633        test="$row /n1:organi zer/n1:com ponent/n1: observatio n/n1:refer enceRange/ n1:observa tionRange/ n1:text"
        2634       >
        2635                                           
        2636        <xsl:value -of
        2637                                                   
        2638         select="$r ow/n1:orga nizer/n1:c omponent/n 1:observat ion/n1:ref erenceRang e/n1:obser vationRang e/n1:text"  
        2639        />
        2640                                  
        2641       </xsl:when >
        2642                                 
        2643       <xsl:other wise />
        2644                        
        2645      </xsl:choo se>
        2646              
        2647     </xsl:temp late>
        2648    
        2649    
        2650             
        2651     <xsl:templ ate 
        2652      name="na"
        2653     >
        2654                       
        2655      <span 
        2656       title="Not  Available "
        2657      >
        2658                                 
        2659       <xsl:text>
        2660        --
        2661       </xsl:text >
        2662                        
        2663      </span>
        2664              
        2665     </xsl:temp late>
        2666    
        2667             
        2668     <!-- Comme nts Sectio n -->
        2669    
        2670             
        2671     <!-- Med C omments -- >
        2672             
        2673     <xsl:templ ate 
        2674      name="medC omments"
        2675     >
        2676                       
        2677      <xsl:varia ble 
        2678       name="ref1 "
        2679                                
        2680       select="n1 :entry/n1: act/n1:tex t/n1:refer ence/@valu e" 
        2681      />
        2682                       
        2683      <xsl:varia ble 
        2684       name="ref2
        2685       select="su bstring-af ter($ref1, '#')" 
        2686      />
        2687                       
        2688      <xsl:choos e>
        2689                                 
        2690       <xsl:when 
        2691        test="n1:t ext/n1:con tent[@ID=$ ref1]"
        2692       >
        2693                                           
        2694        <xsl:call- template 
        2695         name="form atComments "
        2696        >
        2697                                                    
        2698         <xsl:with- param 
        2699          name="comm ents" 
        2700          select="n1 :text/n1:c ontent[@ID =$ref1]" 
        2701         />
        2702                                            
        2703        </xsl:call -template>
        2704                                  
        2705       </xsl:when >
        2706                                 
        2707       <xsl:when 
        2708        test="n1:t ext/n1:con tent[@ID=$ ref2]"
        2709       >
        2710                                           
        2711        <xsl:call- template 
        2712         name="form atComments "
        2713        >
        2714                                                    
        2715         <xsl:with- param 
        2716          name="comm ents" 
        2717          select="n1 :text/n1:c ontent[@ID =$ref2]" 
        2718         />
        2719                                            
        2720        </xsl:call -template>
        2721                                  
        2722       </xsl:when >
        2723                                 
        2724       <xsl:other wise>
        2725                                  
        2726       </xsl:othe rwise>
        2727                        
        2728      </xsl:choo se>
        2729              
        2730     </xsl:temp late>
        2731    
        2732             
        2733     <!-- Probl em Comment s -->
        2734             
        2735     <xsl:templ ate 
        2736      name="prob Comments"
        2737     >
        2738                       
        2739      <xsl:param  
        2740       name="sect ion" 
        2741      />
        2742                       
        2743      <xsl:varia ble 
        2744       name="ref1 "
        2745                                
        2746       select="n1 :entry/n1: act/n1:tex t/n1:refer ence/@valu e" 
        2747      />
        2748                       
        2749      <xsl:varia ble 
        2750       name="ref2
        2751       select="su bstring-af ter($ref1, '#')" 
        2752      />
        2753                       
        2754      <xsl:choos e>
        2755                                 
        2756       <xsl:when 
        2757        test="n1:t ext/n1:con tent[@ID=$ ref1]"
        2758       >
        2759                                           
        2760        <xsl:call- template 
        2761         name="form atComments "
        2762        >
        2763                                                    
        2764         <xsl:with- param 
        2765          name="comm ents" 
        2766          select="n1 :text/n1:c ontent[@ID =$ref1]" 
        2767         />
        2768                                            
        2769        </xsl:call -template>
        2770                                  
        2771       </xsl:when >
        2772                                 
        2773       <xsl:when 
        2774        test="n1:t ext/n1:con tent[@ID=$ ref2]"
        2775       >
        2776                                           
        2777        <xsl:call- template 
        2778         name="form atComments "
        2779        >
        2780                                                    
        2781         <xsl:with- param 
        2782          name="comm ents" 
        2783          select="n1 :text/n1:c ontent[@ID =$ref2]" 
        2784         />
        2785                                            
        2786        </xsl:call -template>
        2787                                  
        2788       </xsl:when >
        2789                                 
        2790       <xsl:other wise>
        2791                                  
        2792       </xsl:othe rwise>
        2793                        
        2794      </xsl:choo se>
        2795              
        2796     </xsl:temp late>
        2797    
        2798             
        2799     <!-- Aller gy Comment s -->
        2800             
        2801     <xsl:templ ate 
        2802      name="alle rgyComment s"
        2803     >
        2804                       
        2805      <xsl:param  
        2806       name="sect ion" 
        2807      />
        2808                       
        2809      <xsl:varia ble 
        2810       name="ref1 "
        2811                                
        2812       select="n1 :entry/n1: act/n1:tex t/n1:refer ence/@valu e" 
        2813      />
        2814                       
        2815      <xsl:varia ble 
        2816       name="ref2
        2817       select="su bstring-af ter($ref1, '#')" 
        2818      />
        2819                       
        2820      <xsl:choos e>
        2821                                 
        2822       <xsl:when 
        2823        test="n1:t ext/n1:con tent[@ID=$ ref1]"
        2824       >
        2825                                           
        2826        <xsl:call- template 
        2827         name="form atComments "
        2828        >
        2829                                                    
        2830         <xsl:with- param 
        2831          name="comm ents" 
        2832          select="n1 :text/n1:c ontent[@ID =$ref1]" 
        2833         />
        2834                                            
        2835        </xsl:call -template>
        2836                                  
        2837       </xsl:when >
        2838                                 
        2839       <xsl:when 
        2840        test="n1:t ext/n1:con tent[@ID=$ ref2]"
        2841       >
        2842                                           
        2843        <xsl:call- template 
        2844         name="form atComments "
        2845        >
        2846                                                    
        2847         <xsl:with- param 
        2848          name="comm ents" 
        2849          select="n1 :text/n1:c ontent[@ID =$ref2]" 
        2850         />
        2851                                            
        2852        </xsl:call -template>
        2853                                  
        2854       </xsl:when >
        2855                                 
        2856       <xsl:other wise>
        2857                                  
        2858       </xsl:othe rwise>
        2859                        
        2860      </xsl:choo se>
        2861              
        2862     </xsl:temp late>
        2863    
        2864             
        2865     <!-- Resul ts Comment s -->
        2866             
        2867     <xsl:templ ate 
        2868      name="resu ltsComment s"
        2869     >
        2870                       
        2871      <xsl:param  
        2872       name="sect ion" 
        2873      />
        2874                       
        2875      <xsl:varia ble 
        2876       name="ref1 "
        2877                                
        2878       select="n1 :entry/n1: act/n1:tex t/n1:refer ence/@valu e" 
        2879      />
        2880                       
        2881      <xsl:varia ble 
        2882       name="ref2
        2883       select="su bstring-af ter($ref1, '#')" 
        2884      />
        2885                       
        2886      <xsl:choos e>
        2887                                 
        2888       <xsl:when 
        2889        test="n1:t ext/n1:con tent[@ID=$ ref1]"
        2890       >
        2891                                           
        2892        <xsl:call- template 
        2893         name="form atComments "
        2894        >
        2895                                                    
        2896         <xsl:with- param 
        2897          name="comm ents" 
        2898          select="n1 :text/n1:c ontent[@ID =$ref1]" 
        2899         />
        2900                                            
        2901        </xsl:call -template>
        2902                                  
        2903       </xsl:when >
        2904                                 
        2905       <xsl:when 
        2906        test="n1:t ext/n1:con tent[@ID=$ ref2]"
        2907       >
        2908                                           
        2909        <xsl:call- template 
        2910         name="form atComments "
        2911        >
        2912                                                    
        2913         <xsl:with- param 
        2914          name="comm ents" 
        2915          select="n1 :text/n1:c ontent[@ID =$ref2]" 
        2916         />
        2917                                            
        2918        </xsl:call -template>
        2919                                  
        2920       </xsl:when >
        2921                                 
        2922       <xsl:other wise>
        2923                                  
        2924       </xsl:othe rwise>
        2925                        
        2926      </xsl:choo se>
        2927              
        2928     </xsl:temp late>
        2929    
        2930             
        2931     <!-- Encou nters Comm ents -->
        2932    
        2933             
        2934     <!-- Proce dures Comm ents -->
        2935    
        2936    
        2937   </xsl:styl esheet>