540. EPMO Open Source Coordination Office Redaction File Detail Report

Produced by Araxis Merge on 4/5/2017 4:25:26 PM Central 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.

540.1 Files compared

# Location File Last Modified
1 C:\working_scrub\Unredacted\VAP Code Base\VAP_Bld2_Source_Code_CIF_2017-02-14\nvap-client\src\main\resources\gov\va\nvap\document\xsl\custom custom_cda.xsl Wed Feb 1 18:37:28 2017 UTC
2 eHX-CIF.zip\eHX-CIF\VAP Code Base\VAP_Bld2_Source_Code_CIF_2017-02-14\nvap-client\src\main\resources\gov\va\nvap\document\xsl\custom custom_cda.xsl Mon Apr 3 14:00:16 2017 UTC

540.2 Comparison summary

Description Between
Files 1 and 2
Text Blocks Lines
Unchanged 15 34142
Changed 14 28
Inserted 0 0
Removed 0 0

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

540.4 Active regular expressions

No regular expressions were active.

540.5 Comparison detail

  1   <?xml 
  2     version="1 .0"
  3   ?>
  4   <xsl:style sheet 
  5     version="1 .0"
  6           
  7     xmlns:xsl= "http://ww w.w3.org/1 999/XSL/Tr ansform" 
  8     xmlns:n3=" http://www .w3.org/19 99/xhtml"
  9           
  10     xmlns:n1=" urn:hl7-or g:v3" 
  11     xmlns:n2=" urn:hl7-or g:v3/meta/ voc" 
  12     xmlns:voc= "urn:hl7-o rg:v3/voc"
  13           
  14     xmlns:xsi= "http://ww w.w3.org/2 001/XMLSch ema-instan ce" 
  15     xmlns:sect ion="urn:g ov.va.med"
  16   >
  17    
  18             
  19     <xsl:outpu
  20      method="ht ml" 
  21      indent="ye s" 
  22      version="4 .01"
  23                      
  24      encoding=" ISO-8859-1
  25     />
  26    
  27             
  28     <xsl:varia ble 
  29      name="snom edCode"
  30     >
  31                       2.16 .840.1.113 883.6.96
  32              
  33     </xsl:vari able>
  34             
  35     <xsl:varia ble 
  36      name="snom edProblemC ode"
  37     >
  38                       5560 7006
  39              
  40     </xsl:vari able>
  41             
  42     <xsl:varia ble 
  43      name="snom edProblemC ode2"
  44     >
  45                       4046 84003
  46              
  47     </xsl:vari able>
  48             
  49     <xsl:varia ble 
  50      name="snom edProblemC ode3"
  51     >
  52                       4187 99008
  53              
  54     </xsl:vari able>
  55             
  56     <xsl:varia ble 
  57      name="snom edAllergyC ode"
  58     >
  59                       4160 98002
  60              
  61     </xsl:vari able>
  62    
  63             
  64     <xsl:varia ble 
  65      name="loin cCode"
  66     >
  67                       2.16 .840.1.113 883.6.1
  68              
  69     </xsl:vari able>
  70             
  71     <xsl:varia ble 
  72      name="loin cProblemCo de"
  73     >
  74                       1145 0-4
  75              
  76     </xsl:vari able>
  77             
  78     <xsl:varia ble 
  79      name="loin cAllergyCo de"
  80     >
  81                       4876 5-2
  82              
  83     </xsl:vari able>
  84             
  85     <xsl:varia ble 
  86      name="loin cMedCode"
  87     >
  88                       1016 0-0
  89              
  90     </xsl:vari able>
  91             
  92     <xsl:varia ble 
  93      name="loin cEncounter Code"
  94     >
  95                       4624 0-8
  96              
  97     </xsl:vari able>
  98             
  99     <xsl:varia ble 
  100      name="loin cResultsCo de"
  101     >
  102                       3095 4-2
  103              
  104     </xsl:vari able>
  105             
  106     <xsl:varia ble 
  107      name="loin cProcedure sCode"
  108     >
  109                       4751 9-4
  110              
  111     </xsl:vari able>
  112             
  113     <xsl:varia ble 
  114      name="loin cImmunizat ionsCode"
  115     >
  116                       1136 9-6
  117              
  118     </xsl:vari able>
  119             
  120     <xsl:varia ble 
  121      name="loin cVitalsCod e"
  122     >
  123                       8716 -3
  124              
  125     </xsl:vari able>
  126    
  127             
  128     <xsl:varia ble 
  129      name="vita lsTemplate Code"
  130     >
  131                        2.16.840.1 .113883. IP         
  132              
  133     </xsl:vari able>
  134             
  135     <xsl:varia ble 
  136      name="labs TemplateCo de"
  137     >
  138                        2.16.840.1 .113883. IP         
  139              
  140     </xsl:vari able>
  141             
  142     <xsl:varia ble 
  143      name="immu nizationsT emplateCod e"
  144     >
  145                        2.16.840.1 .113883. IP         
  146              
  147     </xsl:vari able>
  148             
  149     <xsl:varia ble 
  150      name="alle rgyTemplat eCode"
  151     >
  152                        2.16.840.1 .113883. IP         
  153              
  154     </xsl:vari able>
  155             
  156     <xsl:varia ble 
  157      name="prob lemTemplat eCode"
  158     >
  159                        2.16.840.1 .113883. IP         
  160              
  161     </xsl:vari able>
  162    
  163             
  164     <xsl:varia ble 
  165      name="row"
  166     >
  167                       "Cli nicalDocum ent/"
  168              
  169     </xsl:vari able>
  170    
  171             
  172     <xsl:varia ble 
  173      name="isKa iser"
  174                      
  175      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'])" 
  176     />
  177    
  178    
  179             
  180     <!-- globa l variable  title -->
  181             
  182     <xsl:varia ble 
  183      name="titl e"
  184     >
  185                       
  186      <xsl:choos e>
  187                                 
  188       <xsl:when 
  189        test="stri ng-length( /n1:Clinic alDocument /n1:title)   &gt;= 1"
  190       >
  191                                           
  192        <xsl:value -of 
  193         select="/n 1:Clinical Document/n 1:title" 
  194        />
  195                                  
  196       </xsl:when >
  197                                 
  198       <xsl:when 
  199        test="/n1: ClinicalDo cument/n1: code/@disp layName"
  200       >
  201                                           
  202        <xsl:value -of 
  203         select="/n 1:Clinical Document/n 1:code/@di splayName"  
  204        />
  205                                  
  206       </xsl:when >
  207                                 
  208       <xsl:other wise>
  209                                           
  210        <xsl:text>
  211         Clinical D ocument
  212        </xsl:text >
  213                                  
  214       </xsl:othe rwise>
  215                        
  216      </xsl:choo se>
  217              
  218     </xsl:vari able>
  219    
  220             
  221     <!-- CDA d ocument -- >
  222             
  223     <xsl:templ ate 
  224      match="n1: ClinicalDo cument"
  225     >
  226                       
  227      <h1 
  228       class="h1c enter"
  229      >
  230                                 
  231       <xsl:value -of 
  232        select="$t itle" 
  233       />
  234                        
  235      </h1>
  236                       
  237      <!-- START  display t op portion  of clinic al documen t -->
  238                       
  239      <b>
  240                                 
  241       <xsl:text>
  242        Created On
  243       </xsl:text >
  244                        
  245      </b>
  246                       
  247      <xsl:call- template 
  248       name="getC reatedOnDa te" 
  249      />
  250                       
  251      <xsl:call- template 
  252       name="date Range" 
  253      />
  254                       
  255      <br />
  256                       
  257      <br />
  258                       
  259      <xsl:call- template 
  260       name="reco rdTarget" 
  261      />
  262                       
  263      <xsl:call- template 
  264       name="docu mentGenera l" 
  265      />
  266                       
  267      <xsl:call- template 
  268       name="docu mentationO f" 
  269      />
  270                       
  271      <xsl:call- template 
  272       name="auth or" 
  273      />
  274                       
  275      <xsl:call- template 
  276       name="comp onentof" 
  277      />
  278                       
  279      <xsl:call- template 
  280       name="part icipant" 
  281      />
  282                       
  283      <xsl:call- template 
  284       name="data Enterer" 
  285      />
  286                       
  287      <xsl:call- template 
  288       name="auth enticator"  
  289      />
  290                       
  291      <xsl:call- template 
  292       name="info rmant" 
  293      />
  294                       
  295      <xsl:call- template 
  296       name="info rmationRec ipient" 
  297      />
  298                       
  299      <xsl:call- template 
  300       name="lega lAuthentic ator" 
  301      />
  302                       
  303      <xsl:call- template 
  304       name="cust odian" 
  305      />
  306                       
  307      <!-- END d isplay top  portion o f clinical  document  -->
  308                       
  309      <hr 
  310       align="lef t" 
  311       color="tea l" 
  312       size="2" 
  313       width="100 %" 
  314      />
  315                       
  316      <!-- Struc tured Cont ent -->
  317                       
  318      <xsl:choos e>
  319                                 
  320       <xsl:when 
  321        test="not( //n1:nonXM LBody)"
  322       >
  323                                           
  324        <xsl:if
  325                                                   
  326         test="coun t(/n1:Clin icalDocume nt/n1:comp onent/n1:s tructuredB ody/n1:com ponent[n1: section])  &gt; 1"
  327        >
  328                                                    
  329         <xsl:call- template 
  330          name="make -toc" 
  331         />
  332                                                    
  333         <xsl:apply -templates  
  334          select="n1 :component /n1:struct uredBody" 
  335         />
  336                                            
  337        </xsl:if>
  338                                  
  339       </xsl:when >
  340                                 
  341       <xsl:other wise>
  342                                           
  343        <!-- produ ce human r eadable do cument con tent -->
  344                                           
  345        <xsl:apply -templates  
  346         select="n1 :component /n1:nonXML Body" 
  347        />
  348                                           
  349        <xsl:apply -templates
  350                                                   
  351         select="n1 :component /n1:struct uredBody/n 1:componen t/n1:secti on/n1:entr y/n1:act/n 1:entryRel ationship"  
  352        />
  353                                  
  354       </xsl:othe rwise>
  355                        
  356      </xsl:choo se>
  357                       
  358      <br />
  359                       
  360      <br />
  361                       
  362      <!-- Botto m portion  of display  -->
  363                       
  364      <xsl:call- template 
  365       name="emer gencyConta ct" 
  366      />
  367                       
  368      <xsl:call- template 
  369       name="bott omline" 
  370      />
  371                       
  372      <xsl:call- template 
  373       name="foot er" 
  374      />
  375              
  376     </xsl:temp late>
  377    
  378             
  379     <xsl:templ ate 
  380      name="date Range"
  381     >
  382                       
  383      <xsl:if
  384                                
  385       test="/n1: ClinicalDo cument/n1: documentat ionOf/n1:s erviceEven t/n1:perfo rmer/n1:ef fectiveTim e/n1:low/@ value"
  386      >
  387                                 
  388       <xsl:text 
  389        disable-ou tput-escap ing="yes"
  390       >
  391        &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
  392       </xsl:text >
  393                                 
  394       <b>
  395                                           
  396        <xsl:text>
  397         Date Range
  398        </xsl:text >
  399                                  
  400       </b>
  401                                 
  402       <xsl:choos e>
  403                                           
  404        <xsl:when
  405                                                   
  406         test="stri ng-length( /n1:Clinic alDocument /n1:docume ntationOf/ n1:service Event/n1:p erformer/n 1:effectiv eTime/n1:l ow/@value) =0"
  407        >
  408                                                    
  409         <xsl:call- template 
  410          name="na" 
  411         />
  412                                            
  413        </xsl:when >
  414                                           
  415        <xsl:when
  416                                                   
  417         test="star ts-with(/n 1:Clinical Document/n 1:document ationOf/n1 :serviceEv ent/n1:per former/n1: effectiveT ime/n1:low /@value,'  ')"
  418        >
  419                                                    
  420         <xsl:call- template 
  421          name="na" 
  422         />
  423                                            
  424        </xsl:when >
  425                                           
  426        <xsl:other wise>
  427                                                    
  428         <xsl:call- template 
  429          name="form atDateFull "
  430         >
  431                                                              
  432          <xsl:with- param 
  433           name="date "
  434                                                                       
  435           select="/n 1:Clinical Document/n 1:document ationOf/n1 :serviceEv ent/n1:per former/n1: effectiveT ime/n1:low /@value" 
  436          />
  437                                                     
  438         </xsl:call -template>
  439                                            
  440        </xsl:othe rwise>
  441                                  
  442       </xsl:choo se>
  443                                 
  444       <b>
  445                                           
  446        <xsl:text 
  447         disable-ou tput-escap ing="yes"
  448        >
  449          - 
  450        </xsl:text >
  451                                  
  452       </b>
  453                                 
  454       <xsl:choos e>
  455                                           
  456        <xsl:when
  457                                                   
  458         test="stri ng-length( /n1:Clinic alDocument /n1:docume ntationOf/ n1:service Event/n1:p erformer/n 1:effectiv eTime/n1:h igh/@value )=0"
  459        >
  460                                                    
  461         <xsl:call- template 
  462          name="na" 
  463         />
  464                                            
  465        </xsl:when >
  466                                           
  467        <xsl:when
  468                                                   
  469         test="star ts-with(/n 1:Clinical Document/n 1:document ationOf/n1 :serviceEv ent/n1:per former/n1: effectiveT ime/n1:hig h/@value,'  ')"
  470        >
  471                                                    
  472         <xsl:call- template 
  473          name="na" 
  474         />
  475                                            
  476        </xsl:when >
  477                                           
  478        <xsl:other wise>
  479                                                    
  480         <xsl:call- template 
  481          name="form atDateFull "
  482         >
  483                                                              
  484          <xsl:with- param 
  485           name="date "
  486                                                                       
  487           select="/n 1:Clinical Document/n 1:document ationOf/n1 :serviceEv ent/n1:per former/n1: effectiveT ime/n1:hig h/@value" 
  488          />
  489                                                     
  490         </xsl:call -template>
  491                                            
  492        </xsl:othe rwise>
  493                                  
  494       </xsl:choo se>
  495                        
  496      </xsl:if>
  497              
  498     </xsl:temp late>
  499    
  500             
  501     <!-- gener ate table  of content s -->
  502             
  503     <xsl:templ ate 
  504      name="make -toc"
  505     >
  506                       
  507      <xsl:if 
  508       test="n1:c omponent/n 1:structur edBody"
  509      >
  510                                 
  511       <div>
  512                                           
  513        <h3>
  514                                                    
  515         <a 
  516          name="toc"
  517         >
  518          Table of C ontents
  519         </a>
  520                                            
  521        </h3>
  522                                           
  523        <ul>
  524                                                    
  525         <xsl:for-e ach
  526                                                             
  527          select="n1 :component /n1:struct uredBody/n 1:componen t/n1:secti on/n1:titl e"
  528         >
  529                                                              
  530          <xsl:if
  531                                                                       
  532           test="../n 1:code/@co de=$loincA llergyCode
  533                                                                        or . ./n1:code/ @code=$loi ncMedCode
  534                                                                        or . ./n1:code/ @code=$loi ncProblemC ode
  535                                                                        or . ./n1:code/ @code=$loi ncEncounte rCode
  536                                                                        or . ./n1:code/ @code=$loi ncResultsC ode
  537                                                                        or . ./n1:code/ @code=$loi ncProcedur esCode
  538                                                                        or . ./n1:code/ @code=$loi ncImmuniza tionsCode
  539                                                                        or . ./n1:code/ @code=$loi ncVitalsCo de"
  540          >
  541                                                                        
  542           <li>
  543                                                                                  
  544            <a 
  545             href="#{ge nerate-id( .)}"
  546            >
  547                                                                                            
  548             <xsl:value -of 
  549              select="."  
  550             />
  551                                                                                   
  552            </a>
  553                                                                         
  554           </li>
  555                                                               
  556          </xsl:if>
  557                                                     
  558         </xsl:for- each>
  559                                            
  560        </ul>
  561                                  
  562       </div>
  563                        
  564      </xsl:if>
  565              
  566     </xsl:temp late>
  567    
  568             
  569     <xsl:templ ate 
  570      name="emer gencyConta ct"
  571     >
  572                       
  573      <br />
  574                       
  575      <br />
  576                       
  577      <xsl:choos e>
  578                                 
  579       <xsl:when
  580                                          
  581        test="stri ng-length( /n1:Clinic alDocument /n1:partic ipant[@typ eCode='IND ']/n1:asso ciatedEnti ty[@classC ode='NOK'] )>0"
  582       >
  583                                           
  584        <table>
  585                                                    
  586         <tr>
  587                                                              
  588          <td 
  589           width="100 px" 
  590           valign="to p" 
  591           align='lef t'
  592          >
  593                                                                        
  594           <b>
  595            Emergency  Contact: 
  596           </b>
  597                                                               
  598          </td>
  599                                                              
  600          <td 
  601           valign="to p"
  602          >
  603                                                                        
  604           <xsl:call- template 
  605            name="getP articipant "
  606           >
  607                                                                                  
  608            <xsl:with- param 
  609             name="part icipant"
  610                                                                                           
  611             select="/n 1:Clinical Document/n 1:particip ant[@typeC ode='IND'] /n1:associ atedEntity [@classCod e='NOK']" 
  612            />
  613                                                                         
  614           </xsl:call -template>
  615                                                               
  616          </td>
  617                                                     
  618         </tr>
  619                                            
  620        </table>
  621                                  
  622       </xsl:when >
  623                                 
  624       <xsl:other wise>
  625                                           
  626        <b>
  627        </b>
  628                                  
  629       </xsl:othe rwise>
  630                        
  631      </xsl:choo se>
  632              
  633     </xsl:temp late>
  634    
  635             
  636     <xsl:templ ate 
  637      name="foot er"
  638     >
  639                       
  640      <div 
  641       id="TipBox "
  642      >
  643                                 
  644       <xsl:text 
  645        disable-ou tput-escap ing="yes"
  646       >
  647        &amp;nbsp;
  648       </xsl:text >
  649                        
  650      </div>
  651                       
  652      <!-- ASHA  AMRITRAJ -  Commented  body tag  since this  will be i ncluded in  
  653                                anothr e HTML <bo dy> -->
  654                       
  655      <script 
  656       type="text /javascrip t"
  657      >
  658                                 var Ti pBoxID = " TipBox";
  659                                 var ti p_box_id;
  660                                 functi on
  661                                 findPo sX(obj)
  662                                 {
  663                                 var cu rleft = 0;
  664                                 if(obj .offsetPar ent)
  665                                 while( 1)
  666                                 {
  667                                 curlef t +=
  668                                 obj.of fsetLeft;
  669                                 if(!ob j.offsetPa rent)
  670                                 break;
  671                                 obj =  obj.offset Parent;
  672                                 }
  673                                 else i f(obj.x)
  674                                 curlef t += obj.x ;
  675                                 return  curleft;
  676                                 }
  677      
  678                                 functi on findPos Y(obj)
  679                                 {
  680                                 var cu rtop = 0;
  681                                 if(obj .offsetPar ent)
  682                                 while( 1)
  683                                 {
  684                                 curtop  +=
  685                                 obj.of fsetTop;
  686                                 if(!ob j.offsetPa rent)
  687                                 break;
  688                                 obj =  obj.offset Parent;
  689                                 }
  690                                 else i f(obj.y)
  691                                 curtop  += obj.y;
  692                                 return  curtop;
  693                                 }
  694      
  695                                 functi on HideTip () {
  696                                 tip_bo x_id.style .display =  "none";
  697                                 }
  698      
  699                                 functi on ShowTip () {
  700                                 tip_bo x_id.style .display =  "block";
  701                                 }
  702      
  703                                 functi on ToggleT ip() {
  704                                 if
  705                                 (tip_b ox_id.styl e.display  == "none") {
  706                                 tip_bo x_id.style .display =
  707                                 "block ";
  708                                 }
  709                                 else i f (tip_box _id.style. display
  710                                 == "bl ock"){
  711                                 tip_bo x_id.style .display =  "none";
  712                                 }
  713                                 }
  714      
  715                                 functi on Display Tip(me,off X,offY)
  716                                 {
  717                                 var co ntent = me .innerHTML ;
  718                                 var td Length =
  719                                 me.par entNode.of fsetWidth;
  720                                 var te xtLength =  me.innerH TML.length ;
  721                                 if(((t extLength- 1)*10) >
  722                                 tdLeng th) {
  723                                 var ti pO = me;
  724                                 tip_bo x_id =
  725                                 docume nt.getElem entById(Ti pBoxID);
  726                                 var x  = findPosX (me);
  727                                 var y  =
  728                                 findPo sY(me);
  729                                 var le ft = x + o ffX - 100;
  730      
  731                                 if( le ft &lt; 0)  {
  732                                 left =  0;
  733                                 }
  734                                 var to p = y + of fY - 10;
  735      
  736                                 tip_bo x_id.style .left = St ring(parse Int(left)
  737                                 + 'px' );
  738                                 tip_bo x_id.style .width = S tring('400 px');
  739      
  740                                 tip_bo x_id.style .top = Str ing(parseI nt(top) +  'px');
  741                                 tip_bo x_id.inner HTML = con tent;
  742                                 tip_bo x_id.style .display =  "block";
  743                                 tipO.o nmouseout  = HideTip;
  744                                 }
  745                                 }
  746      
  747                                 functi on Display Text(me,of fX,offY) {
  748                                 var
  749                                 conten t = me.inn erHTML;
  750                                 var td Length =
  751                                 me.par entNode.of fsetWidth;
  752                                 var
  753                                 textLe ngth = me. innerHTML. length;
  754                                 if(((t extLength- 1)*10) > t dLength) {
  755                                 var ti pO = me;
  756                                 tip_bo x_id =
  757                                 docume nt.getElem entById(Ti pBoxID);
  758                                 var x  =
  759                                 findPo sX(me);
  760                                 var y  =
  761                                 findPo sY(me);
  762                                 var le ft = x + o ffX - 300;
  763      
  764                                 if( le ft
  765                                 &lt; 0 ) {
  766                                 left =  0;
  767                                 }
  768                                 var to p = y + of fY + 75;
  769      
  770                                 tip_bo x_id.style .left =
  771                                 String (parseInt( left) + 'p x');
  772                                 tip_bo x_id.style .top =
  773                                 String (parseInt( top) + 'px ');
  774                                 tip_bo x_id.style .width =
  775                                 String ('400px');
  776                                 tip_bo x_id.inner HTML = con tent;
  777                                 tip_bo x_id.style .display =  "none";
  778                                 tipO.o nclick = T oggleTip;
  779                                 }
  780                                 }
  781               
  782                      
  783      </script>
  784              
  785     </xsl:temp late>
  786    
  787             
  788     <xsl:templ ate 
  789      name="getP articipant "
  790     >
  791                       
  792      <xsl:param  
  793       name="part icipant" 
  794      />
  795                       
  796      <p>
  797                                 
  798       <xsl:call- template 
  799        name="getN ame"
  800       >
  801                                           
  802        <xsl:with- param 
  803         name="name "
  804                                                   
  805         select="$p articipant /n1:associ atedPerson /n1:name" 
  806        />
  807                                  
  808       </xsl:call -template>
  809                                 
  810       <xsl:if 
  811        test="$par ticipant/n 1:addr"
  812       >
  813                                           
  814        <xsl:choos e>
  815                                                    
  816         <xsl:when 
  817          test="$isK aiser"
  818         >
  819                                                              
  820          <xsl:call- template 
  821           name="getS ingleAddre ss"
  822          >
  823                                                                        
  824           <xsl:with- param 
  825            name="addr
  826            select="$p articipant /n1:addr" 
  827           />
  828                                                               
  829          </xsl:call -template>
  830                                                     
  831         </xsl:when >
  832                                                    
  833         <xsl:other wise>
  834                                                              
  835          <xsl:call- template 
  836           name="getA ddress"
  837          >
  838                                                                        
  839           <xsl:with- param 
  840            name="addr
  841            select="$p articipant /n1:addr" 
  842           />
  843                                                               
  844          </xsl:call -template>
  845                                                     
  846         </xsl:othe rwise>
  847                                            
  848        </xsl:choo se>
  849                                  
  850       </xsl:if>
  851                                 
  852       <xsl:choos e>
  853                                           
  854        <xsl:when 
  855         test="$par ticipant/n 1:telecom/ @value"
  856        >
  857                                                    
  858         <xsl:for-e ach 
  859          select="$p articipant /n1:teleco m"
  860         >
  861                                                              
  862          <xsl:call- template 
  863           name="getT elecom"
  864          >
  865                                                                        
  866           <xsl:with- param 
  867            name="tele com" 
  868            select="."  
  869           />
  870                                                               
  871          </xsl:call -template>
  872                                                     
  873         </xsl:for- each>
  874                                            
  875        </xsl:when >
  876                                           
  877        <xsl:other wise>
  878                                                    
  879         <br />
  880                                                    
  881         <b>
  882                                                              
  883          <xsl:text>
  884           Tel: CONTA CT PHONE M ISSING
  885          </xsl:text >
  886                                                     
  887         </b>
  888                                            
  889        </xsl:othe rwise>
  890                                  
  891       </xsl:choo se>
  892                                 
  893       <xsl:if 
  894        test="$par ticipant/n 1:code/n1: originalTe xt"
  895       >
  896                                           
  897        <br />
  898                                           
  899        <b>
  900         Relationsh ip:
  901        </b>
  902                                           
  903        <xsl:value -of 
  904         select="$p articipant /n1:code/n 1:original Text" 
  905        />
  906                                  
  907       </xsl:if>
  908                        
  909      </p>
  910              
  911     </xsl:temp late>
  912    
  913             
  914     <xsl:templ ate 
  915      name="getS ingleAddre ss"
  916     >
  917                       
  918      <xsl:param  
  919       name="addr
  920      />
  921                       
  922      <xsl:if 
  923       test="$add r/n1:stree tAddressLi ne != ' '"
  924      >
  925                                 
  926       <br />
  927                                 
  928       <xsl:if 
  929        test="stri ng-length( $addr/n1:s treetAddre ssLine)>0"
  930       >
  931                                           
  932        <xsl:value -of 
  933         select="$a ddr/n1:str eetAddress Line" 
  934        />
  935                                  
  936       </xsl:if>
  937      
  938                                 
  939       <br />
  940                                 
  941       <xsl:value -of 
  942        select="$a ddr/n1:cit y" 
  943       />
  944                                 ,
  945                                 
  946       <xsl:value -of 
  947        select="$a ddr/n1:sta te" 
  948       />
  949                                 ,
  950                                 
  951       <xsl:value -of 
  952        select="$a ddr/n1:pos talCode" 
  953       />
  954                        
  955      </xsl:if>
  956              
  957     </xsl:temp late>
  958    
  959             
  960     <xsl:templ ate 
  961      name="getA ddress"
  962     >
  963                       
  964      <xsl:param  
  965       name="addr
  966      />
  967                       
  968      <xsl:if 
  969       test="$add r/n1:stree tAddressLi ne != ' '"
  970      >
  971                                 
  972       <xsl:for-e ach 
  973        select="$a ddr/n1:str eetAddress Line"
  974       >
  975                                           
  976        <br />
  977                                           
  978        <xsl:if 
  979         test="stri ng-length( $addr/n1:s treetAddre ssLine)>0"
  980        >
  981                                                    
  982         <xsl:value -of 
  983          select="."  
  984         />
  985                                            
  986        </xsl:if>
  987                                  
  988       </xsl:for- each>
  989                                 
  990       <br />
  991                                 
  992       <xsl:value -of 
  993        select="$a ddr/n1:cit y" 
  994       />
  995                                 ,
  996                                 
  997       <xsl:value -of 
  998        select="$a ddr/n1:sta te" 
  999       />
  1000                                 ,
  1001                                 
  1002       <xsl:value -of 
  1003        select="$a ddr/n1:pos talCode" 
  1004       />
  1005                        
  1006      </xsl:if>
  1007              
  1008     </xsl:temp late>
  1009    
  1010             
  1011     <xsl:templ ate 
  1012      name="getT elecom"
  1013     >
  1014                       
  1015      <xsl:param  
  1016       name="tele com" 
  1017      />
  1018                       
  1019      <br />
  1020                       
  1021      <xsl:if 
  1022       test="stri ng-length( $telecom/@ value)>0"
  1023      >
  1024                                 
  1025       <xsl:value -of 
  1026        select="$t elecom/@va lue" 
  1027       />
  1028                                 
  1029       <xsl:choos e>
  1030                                           
  1031        <xsl:when 
  1032         test="./@u se='HP' "
  1033        >
  1034                                                    
  1035         <b>
  1036                                                              
  1037          <xsl:text>
  1038            Home
  1039          </xsl:text >
  1040                                                     
  1041         </b>
  1042                                            
  1043        </xsl:when >
  1044                                           
  1045        <xsl:when 
  1046         test="./@u se='WP' "
  1047        >
  1048                                                    
  1049         <b>
  1050                                                              
  1051          <xsl:text>
  1052            Work
  1053          </xsl:text >
  1054                                                     
  1055         </b>
  1056                                            
  1057        </xsl:when >
  1058                                           
  1059        <xsl:when 
  1060         test="./@u se='HV' "
  1061        >
  1062                                                    
  1063         <b>
  1064                                                              
  1065          <xsl:text>
  1066            Vacation
  1067          </xsl:text >
  1068                                                     
  1069         </b>
  1070                                            
  1071        </xsl:when >
  1072                                           
  1073        <xsl:when 
  1074         test="./@u se='MC' "
  1075        >
  1076                                                    
  1077         <b>
  1078                                                              
  1079          <xsl:text>
  1080            Mobile
  1081          </xsl:text >
  1082                                                     
  1083         </b>
  1084                                            
  1085        </xsl:when >
  1086                                           
  1087        <xsl:other wise>
  1088                                                    
  1089         <b>
  1090                                                              
  1091          <xsl:text>
  1092          </xsl:text >
  1093                                                     
  1094         </b>
  1095                                            
  1096        </xsl:othe rwise>
  1097                                  
  1098       </xsl:choo se>
  1099                        
  1100      </xsl:if>
  1101              
  1102     </xsl:temp late>
  1103    
  1104             
  1105     <!-- Get a  Name -->
  1106             
  1107     <xsl:templ ate 
  1108      name="getN ame"
  1109     >
  1110                       
  1111      <xsl:param  
  1112       name="name
  1113      />
  1114                       
  1115      <xsl:choos e>
  1116                                 
  1117       <xsl:when 
  1118        test="stri ng-length( $name/n1:f amily)=0"
  1119       >
  1120                                  
  1121       </xsl:when >
  1122                                 
  1123       <xsl:when 
  1124        test="$nam e/n1:famil y"
  1125       >
  1126                                           
  1127        <xsl:for-e ach 
  1128         select="$n ame/n1:giv en"
  1129        >
  1130                                                    
  1131         <xsl:text>
  1132           
  1133         </xsl:text >
  1134                                                    
  1135         <xsl:value -of 
  1136          select="."  
  1137         />
  1138                                            
  1139        </xsl:for- each>
  1140                                           
  1141        <xsl:text>
  1142          
  1143        </xsl:text >
  1144                                           
  1145        <xsl:if 
  1146         test="stri ng-length( $name/n1:f amily)>0"
  1147        >
  1148                                                    
  1149         <xsl:value -of 
  1150          select="$n ame/n1:fam ily" 
  1151         />
  1152                                            
  1153        </xsl:if>
  1154                                           
  1155        <xsl:text>
  1156          
  1157        </xsl:text >
  1158                                           
  1159        <xsl:if 
  1160         test="stri ng-length( $name/n1:s uffix)>0"
  1161        >
  1162                                                    
  1163         <xsl:if 
  1164          test="$nam e/n1:suffi x != ' '"
  1165         >
  1166                                                              
  1167          <xsl:text>
  1168          
  1169          </xsl:text >
  1170                                                              
  1171          <xsl:value -of 
  1172           select="$n ame/n1:suf fix" 
  1173          />
  1174                                                     
  1175         </xsl:if>
  1176                                            
  1177        </xsl:if>
  1178                                  
  1179       </xsl:when >
  1180                                 
  1181       <xsl:other wise>
  1182                                           
  1183        <xsl:value -of 
  1184         select="$n ame" 
  1185        />
  1186                                  
  1187       </xsl:othe rwise>
  1188                        
  1189      </xsl:choo se>
  1190              
  1191     </xsl:temp late>
  1192    
  1193             
  1194     <!-- Get A uthor -->
  1195             
  1196     <xsl:templ ate 
  1197      name="getA uthor"
  1198     >
  1199                       
  1200      <xsl:varia ble 
  1201       name="auth or" 
  1202      />
  1203                       
  1204      <xsl:call- template 
  1205       name="getN ame"
  1206      >
  1207                                 
  1208       <xsl:with- param 
  1209        name="name "
  1210                                          
  1211        select="n1 :author/n1 :assignedA uthor/n1:a ssignedPer son/n1:nam e" 
  1212       />
  1213                        
  1214      </xsl:call -template>
  1215                       
  1216      <xsl:choos e>
  1217                                 
  1218       <xsl:when 
  1219        test="$aut hor"
  1220       >
  1221                                           
  1222        <xsl:value -of
  1223                                                   
  1224         select="n1 :author/n1 :assignedA uthor/n1:a ssignedPer son/n1:nam e" 
  1225        />
  1226                                  
  1227       </xsl:when >
  1228                        
  1229      </xsl:choo se>
  1230              
  1231     </xsl:temp late>
  1232    
  1233             
  1234     <!-- Struc turedBody  -->
  1235    
  1236             
  1237     <!-- Compo nent/Secti on -->
  1238             
  1239     <xsl:templ ate 
  1240      match="n1: component/ n1:section
  1241      name="deta ilSection"
  1242     >
  1243                       
  1244      <xsl:choos e>
  1245                                 
  1246       <xsl:when 
  1247        test="n1:c ode[@code= $loincProb lemCode]"
  1248       >
  1249         
  1250        <!-- took  out "and c ount(n1:te xt/n1:tabl e/n1:thead /n1:tr/n1: th)!=3" -- >
  1251                                           
  1252        <xsl:apply -templates  
  1253         select="n1 :title" 
  1254        />
  1255                                           
  1256        <xsl:call- template 
  1257         name="prob Comments"
  1258        >
  1259                                                    
  1260         <xsl:with- param 
  1261          select="."  
  1262          name="sect ion" 
  1263         />
  1264                                            
  1265        </xsl:call -template>
  1266                                           
  1267        <xsl:call- template 
  1268         name="prob lemDetails "
  1269        >
  1270                                                    
  1271         <xsl:with- param 
  1272          select="."  
  1273          name="sect ion" 
  1274         />
  1275                                            
  1276        </xsl:call -template>
  1277                                  
  1278       </xsl:when >
  1279                                 
  1280       <xsl:when 
  1281        test="n1:c ode[@code= $loincAlle rgyCode]"
  1282       >
  1283                                           
  1284        <xsl:apply -templates  
  1285         select="n1 :title" 
  1286        />
  1287                                           
  1288        <xsl:call- template 
  1289         name="alle rgyComment s"
  1290        >
  1291                                                    
  1292         <xsl:with- param 
  1293          select="."  
  1294          name="sect ion" 
  1295         />
  1296                                            
  1297        </xsl:call -template>
  1298                                           
  1299        <xsl:call- template 
  1300         name="alle rgyDetails "
  1301        >
  1302                                                    
  1303         <xsl:with- param 
  1304          select="."  
  1305          name="sect ion" 
  1306         />
  1307                                            
  1308        </xsl:call -template>
  1309                                  
  1310       </xsl:when >
  1311                                 
  1312       <xsl:when 
  1313        test="n1:c ode[@code= $loincMedC ode]"
  1314       >
  1315                                           
  1316        <xsl:apply -templates  
  1317         select="n1 :title" 
  1318        />
  1319                                           
  1320        <xsl:call- template 
  1321         name="medC omments"
  1322        >
  1323                                                    
  1324         <xsl:with- param 
  1325          select="."  
  1326          name="sect ion" 
  1327         />
  1328                                            
  1329        </xsl:call -template>
  1330                                           
  1331        <xsl:call- template 
  1332         name="medD etails"
  1333        >
  1334                                                    
  1335         <xsl:with- param 
  1336          select="."  
  1337          name="sect ion" 
  1338         />
  1339                                            
  1340        </xsl:call -template>
  1341                                  
  1342       </xsl:when >
  1343                                 
  1344       <xsl:when 
  1345        test="n1:c ode[@code= $loincEnco unterCode] "
  1346       >
  1347                                           
  1348        <xsl:apply -templates  
  1349         select="n1 :title" 
  1350        />
  1351                                           
  1352        <xsl:call- template 
  1353         name="enco unterDetai ls"
  1354        >
  1355                                                    
  1356         <xsl:with- param 
  1357          select="."  
  1358          name="sect ion" 
  1359         />
  1360                                            
  1361        </xsl:call -template>
  1362                                  
  1363       </xsl:when >
  1364                                 
  1365       <xsl:when 
  1366        test="n1:c ode[@code= $loincResu ltsCode]"
  1367       >
  1368                                           
  1369        <xsl:apply -templates  
  1370         select="n1 :title" 
  1371        />
  1372                                           
  1373        <xsl:call- template 
  1374         name="resu ltsComment s"
  1375        >
  1376                                                    
  1377         <xsl:with- param 
  1378          select="."  
  1379          name="sect ion" 
  1380         />
  1381                                            
  1382        </xsl:call -template>
  1383                                           
  1384        <xsl:call- template 
  1385         name="resu ltsDetails "
  1386        >
  1387                                                    
  1388         <xsl:with- param 
  1389          select="."  
  1390          name="sect ion" 
  1391         />
  1392                                            
  1393        </xsl:call -template>
  1394                                  
  1395       </xsl:when >
  1396                                 
  1397       <xsl:when 
  1398        test="n1:c ode[@code= $loincProc eduresCode ]"
  1399       >
  1400                                           
  1401        <xsl:apply -templates  
  1402         select="n1 :title" 
  1403        />
  1404                                           
  1405        <xsl:call- template 
  1406         name="proc eduresDeta ils"
  1407        >
  1408                                                    
  1409         <xsl:with- param 
  1410          select="."  
  1411          name="sect ion" 
  1412         />
  1413                                            
  1414        </xsl:call -template>
  1415                                  
  1416       </xsl:when >
  1417                                 
  1418       <xsl:when 
  1419        test="n1:c ode[@code= $loincImmu nizationsC ode]"
  1420       >
  1421                                           
  1422        <xsl:apply -templates  
  1423         select="n1 :title" 
  1424        />
  1425                                           
  1426        <xsl:call- template 
  1427         name="immu nizationsD etails"
  1428        >
  1429                                                    
  1430         <xsl:with- param 
  1431          select="."  
  1432          name="sect ion" 
  1433         />
  1434                                            
  1435        </xsl:call -template>
  1436                                  
  1437       </xsl:when >
  1438                                 
  1439       <xsl:when 
  1440        test="n1:c ode[@code= $loincVita lsCode]"
  1441       >
  1442                                           
  1443        <xsl:apply -templates  
  1444         select="n1 :title" 
  1445        />
  1446                                           
  1447        <xsl:call- template 
  1448         name="vita lsDetails"
  1449        >
  1450                                                    
  1451         <xsl:with- param 
  1452          select="."  
  1453          name="sect ion" 
  1454         />
  1455                                            
  1456        </xsl:call -template>
  1457                                  
  1458       </xsl:when >
  1459                                 
  1460       <xsl:other wise>
  1461                                           
  1462        <!-- tempo rary hold  place so t hat unsupp orted modu les not di splayed -- >
  1463                                           
  1464        <xsl:text  />
  1465                                  
  1466       </xsl:othe rwise>
  1467                        
  1468      </xsl:choo se>
  1469                       
  1470      <xsl:apply -templates  
  1471       select="n1 :component /n1:sectio n" 
  1472      />
  1473              
  1474     </xsl:temp late>
  1475    
  1476             
  1477     <!-- Encou nter Detai l Section  -->
  1478             
  1479     <xsl:templ ate 
  1480      name="enco unterDetai ls"
  1481     >
  1482                       
  1483      <xsl:param  
  1484       name="sect ion" 
  1485      />
  1486                       
  1487      <table>
  1488                                 
  1489       <thead>
  1490                                           
  1491        <tr>
  1492                                                    
  1493         <th>
  1494                                                              
  1495          <xsl:text>
  1496           Date/Time
  1497          </xsl:text >
  1498                                                              
  1499          <xsl:if 
  1500           test="n1:e ntry/n1:en counter"
  1501          >
  1502                                                                        
  1503           <xsl:text>
  1504             - Count (
  1505           </xsl:text >
  1506                                                                        
  1507           <xsl:value -of 
  1508            select="co unt(n1:ent ry/n1:enco unter)" 
  1509           />
  1510                                                                        
  1511           <xsl:text>
  1512            )
  1513           </xsl:text >
  1514                                                               
  1515          </xsl:if>
  1516                                                     
  1517         </th>
  1518                                                    
  1519         <th>
  1520          Encounter  Type
  1521         </th>
  1522                                                    
  1523         <th>
  1524          Encounter  Descriptio n
  1525         </th>
  1526                                                    
  1527         <th>
  1528          Reason
  1529         </th>
  1530                                                    
  1531         <th>
  1532          Arrival
  1533         </th>
  1534                                                    
  1535         <th>
  1536          Departure
  1537         </th>
  1538                                                    
  1539         <th>
  1540          Provider
  1541         </th>
  1542                                                    
  1543         <th>
  1544          Source
  1545         </th>
  1546                                            
  1547        </tr>
  1548                                  
  1549       </thead>
  1550                                 
  1551       <tbody>
  1552                                           
  1553        <xsl:apply -templates  
  1554         select="$s ection/n1: entry"
  1555        >
  1556                                                    
  1557         <xsl:sort 
  1558          select="n1 :encounter /n1:effect iveTime/n1 :low/@valu e"
  1559                                                             
  1560          order="des cending" 
  1561         />
  1562                                            
  1563        </xsl:appl y-template s>
  1564                                  
  1565       </tbody>
  1566                        
  1567      </table>
  1568                       
  1569      <br>
  1570      </br>
  1571                       
  1572      <br>
  1573      </br>
  1574              
  1575     </xsl:temp late>
  1576    
  1577             
  1578     <!-- Meds  Detail Sec tion -->
  1579             
  1580     <xsl:templ ate 
  1581      name="medD etails"
  1582     >
  1583                       
  1584      <xsl:param  
  1585       name="sect ion" 
  1586      />
  1587                       
  1588      <table>
  1589                                 
  1590       <thead>
  1591                                           
  1592        <tr>
  1593                                                    
  1594         <th>
  1595                                                              
  1596          <xsl:text>
  1597           Medication s
  1598          </xsl:text >
  1599                                                              
  1600          <xsl:if 
  1601           test="n1:e ntry/n1:su bstanceAdm inistratio n"
  1602          >
  1603                                                                        
  1604           <xsl:text>
  1605             - Count (
  1606           </xsl:text >
  1607                                                                        
  1608           <xsl:value -of 
  1609            select="co unt(n1:ent ry/n1:subs tanceAdmin istration)
  1610           />
  1611                                                                        
  1612           <xsl:text>
  1613            )
  1614           </xsl:text >
  1615                                                               
  1616          </xsl:if>
  1617                                                     
  1618         </th>
  1619                                                    
  1620         <!--<th>Ro ute</th> - ->
  1621                                                    
  1622         <!--<th>In terval</th > -->
  1623                                                    
  1624         <th>
  1625          Status
  1626         </th>
  1627                                                    
  1628         <th>
  1629          Quantity
  1630         </th>
  1631                                                    
  1632         <th>
  1633          Order Expi ration
  1634         </th>
  1635                                                    
  1636         <th>
  1637          Provider
  1638         </th>
  1639                                                    
  1640         <th>
  1641          Prescripti on #
  1642         </th>
  1643                                                    
  1644         <th>
  1645          Dispense D ate
  1646         </th>
  1647                                                    
  1648         <th>
  1649          Sig
  1650         </th>
  1651                                                    
  1652         <th>
  1653          Source
  1654         </th>
  1655                                            
  1656        </tr>
  1657                                  
  1658       </thead>
  1659                                 
  1660       <tbody>
  1661                                           
  1662        <xsl:choos e>
  1663                                                    
  1664         <xsl:when
  1665                                                             
  1666          test="$sec tion/n1:en try/n1:sub stanceAdmi nistration /n1:effect iveTime/n1 :high"
  1667         >
  1668                                                              
  1669          <xsl:apply -templates  
  1670           select="$s ection/n1: entry"
  1671          >
  1672                                                                        
  1673           <xsl:sort
  1674                                                                                 
  1675            select="$s ection/n1: entry/n1:s ubstanceAd ministrati on/n1:effe ctiveTime/ n1:high/@v alue" 
  1676           />
  1677                                                               
  1678          </xsl:appl y-template s>
  1679                                                     
  1680         </xsl:when >
  1681                                                    
  1682         <xsl:other wise>
  1683                                                              
  1684          <xsl:apply -templates  
  1685           select="$s ection/n1: entry"
  1686          >
  1687                                                                        
  1688           <xsl:sort
  1689                                                                                 
  1690            select="$s ection/n1: entry/n1:s ubstanceAd ministrati on/n1:entr yRelations hip/n1:sup ply/n1:eff ectiveTime /@value" 
  1691           />
  1692                                                               
  1693          </xsl:appl y-template s>
  1694                                                     
  1695         </xsl:othe rwise>
  1696                                            
  1697        </xsl:choo se>
  1698                                  
  1699       </tbody>
  1700                        
  1701      </table>
  1702                       
  1703      <br>
  1704      </br>
  1705                       
  1706      <br>
  1707      </br>
  1708              
  1709     </xsl:temp late>
  1710    
  1711             
  1712     <!-- Probl em Detail  Section -- >
  1713             
  1714     <xsl:templ ate 
  1715      name="prob lemDetails "
  1716     >
  1717                       
  1718      <xsl:param  
  1719       name="sect ion" 
  1720      />
  1721                       
  1722      <table>
  1723                                 
  1724       <thead>
  1725                                           
  1726        <tr>
  1727                                                    
  1728         <th>
  1729                                                              
  1730          <xsl:text>
  1731           Problems
  1732          </xsl:text >
  1733                                                              
  1734          <xsl:if
  1735                                                                       
  1736           test="n1:e ntry/n1:ac t/n1:entry Relationsh ip[@typeCo de='SUBJ'] /n1:observ ation"
  1737          >
  1738                                                                        
  1739           <xsl:text>
  1740             - Count (
  1741           </xsl:text >
  1742                                                                        
  1743           <xsl:value -of
  1744                                                                                 
  1745            select="co unt(n1:ent ry/n1:act/ n1:entryRe lationship [@typeCode ='SUBJ']/n 1:observat ion)" 
  1746           />
  1747                                                                        
  1748           <xsl:text>
  1749            )
  1750           </xsl:text >
  1751                                                               
  1752          </xsl:if>
  1753                                                     
  1754         </th>
  1755                                                    
  1756         <th>
  1757          Status
  1758         </th>
  1759                                                    
  1760         <th>
  1761          Problem Co de
  1762         </th>
  1763                                                    
  1764         <th>
  1765          Date of On set
  1766         </th>
  1767                                                    
  1768         <th>
  1769          Provider
  1770         </th>
  1771                                                    
  1772         <th>
  1773          Source
  1774         </th>
  1775                                            
  1776        </tr>
  1777       
  1778                                  
  1779       </thead>
  1780                                 
  1781       <tbody>
  1782                                           
  1783        <xsl:choos e>
  1784                                                    
  1785         <xsl:when
  1786                                                             
  1787          test="$sec tion/n1:en try/n1:act /n1:entryR elationshi p/n1:obser vation/n1: effectiveT ime/n1:low "
  1788         >
  1789                                                              
  1790          <xsl:apply -templates  
  1791           select="$s ection/n1: entry"
  1792          >
  1793                                                                        
  1794           <xsl:sort
  1795                                                                                 
  1796            select="n1 :act/n1:en tryRelatio nship/n1:o bservation /n1:effect iveTime/n1 :low/@valu e"
  1797                                                                                 
  1798            order="des cending" 
  1799           />
  1800                                                               
  1801          </xsl:appl y-template s>
  1802                                                     
  1803         </xsl:when >
  1804                                                    
  1805         <xsl:other wise>
  1806                                                              
  1807          <xsl:apply -templates  
  1808           select="$s ection/n1: entry"
  1809          >
  1810                                                                        
  1811           <xsl:sort 
  1812            select="n1 :act/n1:ef fectiveTim e/n1:low/@ value"
  1813                                                                                 
  1814            order="des cending" 
  1815           />
  1816                                                               
  1817          </xsl:appl y-template s>
  1818                                                     
  1819         </xsl:othe rwise>
  1820                                            
  1821        </xsl:choo se>
  1822                                  
  1823       </tbody>
  1824                        
  1825      </table>
  1826                       
  1827      <br>
  1828      </br>
  1829                       
  1830      <br>
  1831      </br>
  1832              
  1833     </xsl:temp late>
  1834    
  1835             
  1836     <!-- Aller gy Detail  Section -- >
  1837             
  1838     <xsl:templ ate 
  1839      name="alle rgyDetails "
  1840     >
  1841                       
  1842      <xsl:param  
  1843       name="sect ion" 
  1844      />
  1845                       
  1846      <table>
  1847                                 
  1848       <thead>
  1849                                           
  1850        <tr>
  1851                                                    
  1852         <th>
  1853                                                              
  1854          <xsl:text>
  1855           Allergens
  1856          </xsl:text >
  1857                                                              
  1858          <xsl:if
  1859                                                                       
  1860           test="n1:e ntry/n1:ac t/n1:entry Relationsh ip[@typeCo de='SUBJ'] /n1:observ ation"
  1861          >
  1862                                                                        
  1863           <xsl:text>
  1864             - Count (
  1865           </xsl:text >
  1866                                                                        
  1867           <xsl:value -of
  1868                                                                                 
  1869            select="co unt(n1:ent ry/n1:act/ n1:entryRe lationship [@typeCode ='SUBJ']/n 1:observat ion)" 
  1870           />
  1871                                                                        
  1872           <xsl:text>
  1873            )
  1874           </xsl:text >
  1875                                                               
  1876          </xsl:if>
  1877                                                     
  1878         </th>
  1879                                                    
  1880         <th>
  1881          Verificati on Date
  1882         </th>
  1883                                                    
  1884         <th>
  1885          Event Type
  1886         </th>
  1887                                                    
  1888         <!--<th>Pr oduct Free -Text</th>  -->
  1889                                                    
  1890         <!--<th>Pr oduct Code d</th> -->
  1891                                                    
  1892         <th>
  1893          Reaction
  1894         </th>
  1895                                                    
  1896         <!--<th>Re action Fre e-Text</th > -->
  1897                                                    
  1898         <!--<th>Re action Cod ed</th> -- >
  1899                                                    
  1900         <th>
  1901          Severity
  1902         </th>
  1903                                                    
  1904         <!--<th>Se verity Fre e-Text</th > -->
  1905                                                    
  1906         <!--<th>Se verity Cod ed</th> -- >
  1907                                                    
  1908         <th>
  1909          Source
  1910         </th>
  1911                                            
  1912        </tr>
  1913                                  
  1914       </thead>
  1915                                 
  1916       <tbody>
  1917                                           
  1918        <xsl:choos e>
  1919                                                    
  1920         <xsl:when
  1921                                                             
  1922          test="$sec tion/n1:en try/n1:act /n1:entryR elationshi p/n1:obser vation/n1: effectiveT ime/n1:low "
  1923         >
  1924                                                              
  1925          <xsl:apply -templates  
  1926           select="$s ection/n1: entry"
  1927          >
  1928                                                                        
  1929           <xsl:sort
  1930                                                                                 
  1931            select="n1 :act/n1:en tryRelatio nship/n1:o bservation /n1:effect iveTime/n1 :low/@valu e"
  1932                                                                                 
  1933            order="des cending" 
  1934           />
  1935                                                               
  1936          </xsl:appl y-template s>
  1937                                                     
  1938         </xsl:when >
  1939                                                    
  1940         <xsl:other wise>
  1941                                                              
  1942          <xsl:apply -templates  
  1943           select="$s ection/n1: entry"
  1944          >
  1945                                                                        
  1946           <xsl:sort 
  1947            select="n1 :act/n1:ef fectiveTim e/n1:low/@ value"
  1948                                                                                 
  1949            order="des cending" 
  1950           />
  1951                                                               
  1952          </xsl:appl y-template s>
  1953                                                     
  1954         </xsl:othe rwise>
  1955                                            
  1956        </xsl:choo se>
  1957                                  
  1958       </tbody>
  1959                        
  1960      </table>
  1961                       
  1962      <br>
  1963      </br>
  1964                       
  1965      <br>
  1966      </br>
  1967              
  1968     </xsl:temp late>
  1969    
  1970             
  1971     <!-- (Lab) Results De tail Secti on -->
  1972             
  1973     <xsl:templ ate 
  1974      name="resu ltsDetails "
  1975     >
  1976                       
  1977      <xsl:param  
  1978       name="sect ion" 
  1979      />
  1980                       
  1981      <table>
  1982                                 
  1983       <thead>
  1984                                           
  1985        <tr>
  1986                                                    
  1987         <th>
  1988                                                              
  1989          <xsl:text>
  1990           Date/Time
  1991          </xsl:text >
  1992                                                              
  1993          <xsl:if 
  1994           test="n1:e ntry/n1:ob servation"
  1995          >
  1996                                                                        
  1997           <xsl:text>
  1998             - Count (
  1999           </xsl:text >
  2000                                                                        
  2001           <xsl:value -of 
  2002            select="co unt(n1:ent ry/n1:obse rvation)" 
  2003           />
  2004                                                                        
  2005           <xsl:text>
  2006            )
  2007           </xsl:text >
  2008                                                               
  2009          </xsl:if>
  2010                                                     
  2011         </th>
  2012                                                    
  2013         <th>
  2014          Result Typ e
  2015         </th>
  2016                                                    
  2017         <th>
  2018          Source
  2019         </th>
  2020                                                    
  2021         <th>
  2022          Result - U nit
  2023         </th>
  2024                                                    
  2025         <th>
  2026          Interpreta tion
  2027         </th>
  2028                                                    
  2029         <th>
  2030          Reference  Range
  2031         </th>
  2032                                                    
  2033         <th>
  2034          Status
  2035         </th>
  2036                                                    
  2037         <th>
  2038          Comment
  2039         </th>
  2040                                            
  2041        </tr>
  2042                                  
  2043       </thead>
  2044                                 
  2045       <tbody>
  2046                                           
  2047        <xsl:choos e>
  2048                                                    
  2049         <xsl:when 
  2050          test="n1:o bservation /n1:effect iveTime/@v alue"
  2051         >
  2052                                                              
  2053          <xsl:apply -templates  
  2054           select="$s ection/n1: entry"
  2055          >
  2056                                                                        
  2057           <xsl:sort 
  2058            select="n1 :observati on/n1:effe ctiveTime/ @value"
  2059                                                                                 
  2060            order="des cending" 
  2061           />
  2062                                                               
  2063          </xsl:appl y-template s>
  2064                                                     
  2065         </xsl:when >
  2066                                                    
  2067         <xsl:other wise>
  2068                                                              
  2069          <xsl:apply -templates  
  2070           select="$s ection/n1: entry"
  2071          >
  2072                                                                        
  2073           <xsl:sort
  2074                                                                                 
  2075            select="n1 :organizer /n1:compon ent/n1:obs ervation/n 1:effectiv eTime/@val ue"
  2076                                                                                 
  2077            order="des cending" 
  2078           />
  2079                                                               
  2080          </xsl:appl y-template s>
  2081                                                     
  2082         </xsl:othe rwise>
  2083                                            
  2084        </xsl:choo se>
  2085                                  
  2086       </tbody>
  2087                        
  2088      </table>
  2089                       
  2090      <br>
  2091      </br>
  2092                       
  2093      <br>
  2094      </br>
  2095              
  2096     </xsl:temp late>
  2097    
  2098             
  2099     <!-- Proce dures Deta il Section  -->
  2100             
  2101     <xsl:templ ate 
  2102      name="proc eduresDeta ils"
  2103     >
  2104                       
  2105      <xsl:param  
  2106       name="sect ion" 
  2107      />
  2108                       
  2109      <table>
  2110                                 
  2111       <thead>
  2112                                           
  2113        <tr>
  2114                                                    
  2115         <th>
  2116                                                              
  2117          <xsl:text>
  2118           Date/Time
  2119          </xsl:text >
  2120                                                              
  2121          <xsl:if 
  2122           test="n1:e ntry/n1:pr ocedure/n1 :code/@cod e"
  2123          >
  2124                                                                        
  2125           <xsl:text>
  2126             - Count (
  2127           </xsl:text >
  2128                                                                        
  2129           <xsl:value -of 
  2130            select="co unt(n1:ent ry/n1:proc edure)" 
  2131           />
  2132                                                                        
  2133           <xsl:text>
  2134            )
  2135           </xsl:text >
  2136                                                               
  2137          </xsl:if>
  2138                                                     
  2139         </th>
  2140                                                    
  2141         <th>
  2142          Procedure  Type
  2143         </th>
  2144                                                    
  2145         <th>
  2146          Qualifiers
  2147         </th>
  2148                                                    
  2149         <th>
  2150          Descriptio n
  2151         </th>
  2152                                                    
  2153         <th>
  2154          Provider
  2155         </th>
  2156                                                    
  2157         <th>
  2158          Source
  2159         </th>
  2160                                            
  2161        </tr>
  2162                                  
  2163       </thead>
  2164                                 
  2165       <tbody>
  2166                                           
  2167        <xsl:apply -templates  
  2168         select="$s ection/n1: entry"
  2169        >
  2170                                                    
  2171         <xsl:sort 
  2172          select="n1 :procedure /n1:effect iveTime/@v alue"
  2173                                                             
  2174          order="des cending" 
  2175         />
  2176                                            
  2177        </xsl:appl y-template s>
  2178                                  
  2179       </tbody>
  2180                        
  2181      </table>
  2182                       
  2183      <br>
  2184      </br>
  2185                       
  2186      <br>
  2187      </br>
  2188              
  2189     </xsl:temp late>
  2190    
  2191             
  2192     <!-- Immun izations D etail Sect ion -->
  2193             
  2194     <xsl:templ ate 
  2195      name="immu nizationsD etails"
  2196     >
  2197                       
  2198      <xsl:param  
  2199       name="sect ion" 
  2200      />
  2201                       
  2202      <table>
  2203                                 
  2204       <thead>
  2205                                           
  2206        <tr>
  2207                                                    
  2208         <th>
  2209          Immunizati ons
  2210         </th>
  2211                                                    
  2212         <th>
  2213          Series
  2214         </th>
  2215                                                    
  2216         <th>
  2217          Date Issue d
  2218         </th>
  2219                                                    
  2220         <th>
  2221          Reaction
  2222         </th>
  2223                                                    
  2224         <th>
  2225          Comments
  2226         </th>
  2227                                            
  2228        </tr>
  2229                                  
  2230       </thead>
  2231                                 
  2232       <tbody>
  2233                                           
  2234        <xsl:apply -templates  
  2235         select="$s ection/n1: entry"
  2236        >
  2237                                            
  2238        </xsl:appl y-template s>
  2239                                  
  2240       </tbody>
  2241                        
  2242      </table>
  2243                       
  2244      <br>
  2245      </br>
  2246                       
  2247      <br>
  2248      </br>
  2249              
  2250     </xsl:temp late>
  2251    
  2252             
  2253     <!-- Vital s Detail S ection -->
  2254             
  2255     <xsl:templ ate 
  2256      name="vita lsDetails"
  2257     >
  2258                       
  2259      <xsl:param  
  2260       name="sect ion" 
  2261      />
  2262                       
  2263      <table>
  2264                                 
  2265       <thead>
  2266                                           
  2267        <tr>
  2268                                                    
  2269         <th>
  2270          Date
  2271         </th>
  2272                                                    
  2273         <th>
  2274          TEMP
  2275         </th>
  2276                                                    
  2277         <th>
  2278          PULSE
  2279         </th>
  2280                                                    
  2281         <th>
  2282          RESP
  2283         </th>
  2284                                                    
  2285         <th>
  2286          BP
  2287         </th>
  2288                                                    
  2289         <th>
  2290          Ht
  2291         </th>
  2292                                                    
  2293         <th>
  2294          Wt
  2295         </th>
  2296                                                    
  2297         <th>
  2298          POx
  2299         </th>
  2300                                                    
  2301         <th>
  2302          Source
  2303         </th>
  2304                                            
  2305        </tr>
  2306                                  
  2307       </thead>
  2308                                 
  2309       <tbody>
  2310                                           
  2311        <xsl:apply -templates  
  2312         select="$s ection/n1: entry"
  2313        >
  2314                                            
  2315        </xsl:appl y-template s>
  2316                                  
  2317       </tbody>
  2318                        
  2319      </table>
  2320                       
  2321      <br>
  2322      </br>
  2323                       
  2324      <br>
  2325      </br>
  2326              
  2327     </xsl:temp late>
  2328    
  2329             
  2330     <!-- entry  processin g -->
  2331             
  2332     <xsl:templ ate 
  2333      match="n1: entry"
  2334     >
  2335                       
  2336      <xsl:varia ble 
  2337       name="alle rgy-prob-R oot"
  2338                                
  2339       select="n1 :act/n1:en tryRelatio nship/n1:o bservation /n1:templa teId/@root
  2340      />
  2341                       
  2342      <xsl:varia ble 
  2343       name="med- imm-Root"
  2344                                
  2345       select="n1 :substance Administra tion/n1:te mplateId/@ root" 
  2346      />
  2347                       
  2348      <xsl:varia ble 
  2349       name="labs -Root" 
  2350       select=".. /n1:templa teId/@root
  2351      />
  2352                       
  2353      <xsl:choos e>
  2354                                 
  2355       <xsl:when 
  2356        test="$all ergy-prob- Root='2.16 .840.1.113 883. IP          '"
  2357       >
  2358                                           
  2359        <xsl:call- template 
  2360         name="alle rgyRow"
  2361        >
  2362                                                    
  2363         <xsl:with- param 
  2364          name="row"  
  2365          select="."  
  2366         />
  2367                                            
  2368        </xsl:call -template>
  2369                                  
  2370       </xsl:when >
  2371                                 
  2372       <xsl:when 
  2373        test="$all ergy-prob- Root!='2.1 6.840.1.11 3883. IP          '"
  2374       >
  2375                                           
  2376        <xsl:call- template 
  2377         name="prob lemRow"
  2378        >
  2379                                                    
  2380         <xsl:with- param 
  2381          name="row"  
  2382          select="."  
  2383         />
  2384                                            
  2385        </xsl:call -template>
  2386                                  
  2387       </xsl:when >
  2388                                 
  2389       <xsl:when 
  2390        test="n1:e ncounter"
  2391       >
  2392                                           
  2393        <xsl:call- template 
  2394         name="encR ow"
  2395        >
  2396                                                    
  2397         <xsl:with- param 
  2398          name="row"  
  2399          select="."  
  2400         />
  2401                                            
  2402        </xsl:call -template>
  2403                                  
  2404       </xsl:when >
  2405                                 
  2406       <xsl:when 
  2407        test="$med -imm-Root= '2.16.840. 1.113883.3 .88.11.83. 13'"
  2408       >
  2409                                           
  2410        <xsl:call- template 
  2411         name="immu nizationsR ow"
  2412        >
  2413                                                    
  2414         <xsl:with- param 
  2415          name="row"  
  2416          select="."  
  2417         />
  2418                                            
  2419        </xsl:call -template>
  2420                                  
  2421       </xsl:when >
  2422                                 
  2423       <xsl:when 
  2424        test="$med -imm-Root! ='2.16.840 .1.113883. 3.88.11.83 .13'"
  2425       >
  2426                                           
  2427        <xsl:call- template 
  2428         name="medR ow"
  2429        >
  2430                                                    
  2431         <xsl:with- param 
  2432          name="row"  
  2433          select="."  
  2434         />
  2435                                            
  2436        </xsl:call -template>
  2437                                  
  2438       </xsl:when >
  2439                                 
  2440       <xsl:when 
  2441        test="n1:s ubstanceAd ministrati on"
  2442       >
  2443                                           
  2444        <xsl:call- template 
  2445         name="medR ow"
  2446        >
  2447                                                    
  2448         <xsl:with- param 
  2449          name="row"  
  2450          select="."  
  2451         />
  2452                                            
  2453        </xsl:call -template>
  2454                                  
  2455       </xsl:when >
  2456                                 
  2457       <xsl:when 
  2458        test="$lab s-Root='2. 16.840.1.1 13883. IP          '"
  2459       >
  2460                                           
  2461        <xsl:call- template 
  2462         name="labs Row"
  2463        >
  2464                                                    
  2465         <xsl:with- param 
  2466          name="row"  
  2467          select="."  
  2468         />
  2469                                            
  2470        </xsl:call -template>
  2471                                  
  2472       </xsl:when >
  2473                                 
  2474       <xsl:when 
  2475        test="n1:o rganizer"
  2476       >
  2477                                           
  2478        <xsl:call- template 
  2479         name="vita lsRow"
  2480        >
  2481                                                    
  2482         <xsl:with- param 
  2483          name="row"  
  2484          select="."  
  2485         />
  2486                                            
  2487        </xsl:call -template>
  2488                                  
  2489       </xsl:when >
  2490                                 
  2491       <xsl:when 
  2492        test="n1:p rocedure"
  2493       >
  2494                                           
  2495        <xsl:call- template 
  2496         name="proc edureRow"
  2497        >
  2498                                                    
  2499         <xsl:with- param 
  2500          name="row"  
  2501          select="."  
  2502         />
  2503                                            
  2504        </xsl:call -template>
  2505                                  
  2506       </xsl:when >
  2507                                 
  2508       <xsl:other wise />
  2509                        
  2510      </xsl:choo se>
  2511              
  2512     </xsl:temp late>
  2513    
  2514    
  2515             
  2516     <!-- Encou nter row e ntry -->
  2517             
  2518     <xsl:templ ate 
  2519      name="encR ow"
  2520     >
  2521                       
  2522      <xsl:param  
  2523       name="row"  
  2524      />
  2525                       
  2526      <tr>
  2527      
  2528                                 
  2529       <!-- Encou nter Date/ Time -->
  2530                                 
  2531       <td>
  2532                                           
  2533        <xsl:choos e>
  2534                                                    
  2535         <xsl:when 
  2536          test="$row /n1:encoun ter/n1:eff ectiveTime /n1:low/@v alue"
  2537         >
  2538                                                              
  2539          <xsl:call- template 
  2540           name="form atDate"
  2541          >
  2542                                                                        
  2543           <xsl:with- param 
  2544            name="date "
  2545                                                                                 
  2546            select="$r ow/n1:enco unter/n1:e ffectiveTi me/n1:low/ @value" 
  2547           />
  2548                                                               
  2549          </xsl:call -template>
  2550                                                     
  2551         </xsl:when >
  2552                                                    
  2553         <xsl:other wise>
  2554                                                              
  2555          <xsl:call- template 
  2556           name="na" 
  2557          />
  2558                                                     
  2559         </xsl:othe rwise>
  2560                                            
  2561        </xsl:choo se>
  2562                                  
  2563       </td>
  2564      
  2565                                 
  2566       <!-- Encou nter Type  -->
  2567                                 
  2568       <td>
  2569                                           
  2570        <xsl:choos e>
  2571                                                    
  2572         <xsl:when 
  2573          test="$row /n1:encoun ter"
  2574         >
  2575                                                              
  2576          <xsl:call- template 
  2577           name="getE ncounterTy pe"
  2578          >
  2579                                                                        
  2580           <xsl:with- param 
  2581            name="enco unter" 
  2582            select="$r ow/n1:enco unter" 
  2583           />
  2584                                                               
  2585          </xsl:call -template>
  2586                                                     
  2587         </xsl:when >
  2588                                                    
  2589         <xsl:other wise>
  2590                                                              
  2591          <xsl:call- template 
  2592           name="na" 
  2593          />
  2594                                                     
  2595         </xsl:othe rwise>
  2596                                            
  2597        </xsl:choo se>
  2598                                  
  2599       </td>
  2600      
  2601                                 
  2602       <!-- Encou nter Descr iption -->
  2603      
  2604                                 
  2605       <td>
  2606                                           
  2607        <xsl:varia ble 
  2608         name="encF reeText"
  2609        >
  2610                                                    
  2611         <xsl:call- template 
  2612          name="getE ncounterFr eeText"
  2613         >
  2614                                                              
  2615          <xsl:with- param 
  2616           name="enco unter" 
  2617           select="$r ow/n1:enco unter" 
  2618          />
  2619                                                     
  2620         </xsl:call -template>
  2621                                            
  2622        </xsl:vari able>
  2623                                           
  2624        <xsl:choos e>
  2625                                                    
  2626         <xsl:when 
  2627          test="stri ng-length( $encFreeTe xt)>1"
  2628         >
  2629                                                              
  2630          <xsl:call- template 
  2631           name="flyo verTextSpa n"
  2632          >
  2633                                                                        
  2634           <xsl:with- param 
  2635            name="data
  2636            select="$e ncFreeText
  2637           />
  2638                                                               
  2639          </xsl:call -template>
  2640                                                     
  2641         </xsl:when >
  2642                                                    
  2643         <xsl:other wise>
  2644                                                              
  2645          <xsl:call- template 
  2646           name="na" 
  2647          />
  2648                                                     
  2649         </xsl:othe rwise>
  2650                                            
  2651        </xsl:choo se>
  2652                                  
  2653       </td>
  2654      
  2655                                 
  2656       <!-- Encou nter Reaso n -->
  2657                                 
  2658       <td>
  2659                                           
  2660        <xsl:varia ble 
  2661         name="encR eason"
  2662        >
  2663                                                    
  2664         <xsl:call- template 
  2665          name="getE ncounterRe ason"
  2666         >
  2667                                                              
  2668          <xsl:with- param 
  2669           name="enco unter" 
  2670           select="$r ow/n1:enco unter" 
  2671          />
  2672                                                     
  2673         </xsl:call -template>
  2674                                            
  2675        </xsl:vari able>
  2676                                           
  2677        <xsl:choos e>
  2678                                                    
  2679         <xsl:when 
  2680          test="stri ng-length( $encReason )>1"
  2681         >
  2682                                                              
  2683          <xsl:call- template 
  2684           name="flyo verSpan"
  2685          >
  2686                                                                        
  2687           <xsl:with- param 
  2688            name="data
  2689            select="$e ncReason" 
  2690           />
  2691                                                               
  2692          </xsl:call -template>
  2693                                                     
  2694         </xsl:when >
  2695                                                    
  2696         <xsl:other wise>
  2697                                                              
  2698          <xsl:call- template 
  2699           name="na" 
  2700          />
  2701                                                     
  2702         </xsl:othe rwise>
  2703                                            
  2704        </xsl:choo se>
  2705                                  
  2706       </td>
  2707      
  2708      
  2709                                 
  2710       <!-- Encou nter Arriv al -->
  2711                                 
  2712       <td>
  2713                                           
  2714        <xsl:choos e>
  2715                                                    
  2716         <xsl:when 
  2717          test="$row /n1:encoun ter/n1:par ticipant/n 1:time/n1: low/@value "
  2718         >
  2719                                                              
  2720          <xsl:call- template 
  2721           name="form atDateTime "
  2722          >
  2723                                                                        
  2724           <xsl:with- param 
  2725            name="date "
  2726                                                                                 
  2727            select="$r ow/n1:enco unter/n1:p articipant /n1:time/n 1:low/@val ue" 
  2728           />
  2729                                                               
  2730          </xsl:call -template>
  2731                                                     
  2732         </xsl:when >
  2733                                                    
  2734         <xsl:other wise>
  2735                                                              
  2736          <xsl:call- template 
  2737           name="na" 
  2738          />
  2739                                                     
  2740         </xsl:othe rwise>
  2741                                            
  2742        </xsl:choo se>
  2743                                  
  2744       </td>
  2745      
  2746      
  2747                                 
  2748       <!-- Encou nter Depar ture -->
  2749                                 
  2750       <td>
  2751                                           
  2752        <xsl:choos e>
  2753                                                    
  2754         <xsl:when 
  2755          test="$row /n1:encoun ter/n1:par ticipant/n 1:time/n1: high/@valu e"
  2756         >
  2757                                                              
  2758          <xsl:call- template 
  2759           name="form atDateTime "
  2760          >
  2761                                                                        
  2762           <xsl:with- param 
  2763            name="date "
  2764                                                                                 
  2765            select="$r ow/n1:enco unter/n1:p articipant /n1:time/n 1:high/@va lue" 
  2766           />
  2767                                                               
  2768          </xsl:call -template>
  2769                                                     
  2770         </xsl:when >
  2771                                                    
  2772         <xsl:other wise>
  2773                                                              
  2774          <xsl:call- template 
  2775           name="na" 
  2776          />
  2777                                                     
  2778         </xsl:othe rwise>
  2779                                            
  2780        </xsl:choo se>
  2781                                  
  2782       </td>
  2783      
  2784      
  2785                                 
  2786       <!-- Encou nter Provi der -->
  2787                                 
  2788       <td>
  2789                                           
  2790        <xsl:varia ble 
  2791         name="encP rovider"
  2792        >
  2793                                                    
  2794         <xsl:call- template 
  2795          name="getE ncounterPr ovider"
  2796         >
  2797                                                              
  2798          <xsl:with- param 
  2799           name="enco unter" 
  2800           select="$r ow/n1:enco unter" 
  2801          />
  2802                                                     
  2803         </xsl:call -template>
  2804                                            
  2805        </xsl:vari able>
  2806                                           
  2807        <xsl:choos e>
  2808                                                    
  2809         <xsl:when 
  2810          test="stri ng-length( $encProvid er)>1"
  2811         >
  2812                                                              
  2813          <xsl:call- template 
  2814           name="flyo verSpan"
  2815          >
  2816                                                                        
  2817           <xsl:with- param 
  2818            name="data
  2819            select="$e ncProvider
  2820           />
  2821                                                               
  2822          </xsl:call -template>
  2823                                                     
  2824         </xsl:when >
  2825                                                    
  2826         <xsl:other wise>
  2827                                                              
  2828          <xsl:call- template 
  2829           name="na" 
  2830          />
  2831                                                     
  2832         </xsl:othe rwise>
  2833                                            
  2834        </xsl:choo se>
  2835       
  2836                                  
  2837       </td>
  2838      
  2839                                 
  2840       <!-- Encou nter Sourc e -->
  2841                                 
  2842       <td>
  2843                                           
  2844        <xsl:varia ble 
  2845         name="encS ource"
  2846        >
  2847                                                    
  2848         <xsl:call- template 
  2849          name="getE ncounterSo urce"
  2850         >
  2851                                                              
  2852          <xsl:with- param 
  2853           name="enco unter" 
  2854           select="$r ow/n1:enco unter" 
  2855          />
  2856                                                     
  2857         </xsl:call -template>
  2858                                            
  2859        </xsl:vari able>
  2860                                           
  2861        <xsl:choos e>
  2862                                                    
  2863         <xsl:when 
  2864          test="stri ng-length( $encSource )>1"
  2865         >
  2866                                                              
  2867          <xsl:call- template 
  2868           name="flyo verSpan"
  2869          >
  2870                                                                        
  2871           <xsl:with- param 
  2872            name="data
  2873            select="$e ncSource" 
  2874           />
  2875                                                               
  2876          </xsl:call -template>
  2877                                                     
  2878         </xsl:when >
  2879                                                    
  2880         <xsl:other wise>
  2881                                                              
  2882          <xsl:call- template 
  2883           name="na" 
  2884          />
  2885                                                     
  2886         </xsl:othe rwise>
  2887                                            
  2888        </xsl:choo se>
  2889                                  
  2890       </td>
  2891      
  2892                        
  2893      </tr>
  2894              
  2895     </xsl:temp late>
  2896    
  2897             
  2898     <!-- Medic ation Entr y row -->
  2899             
  2900     <xsl:templ ate 
  2901      name="medR ow"
  2902     >
  2903                       
  2904      <xsl:param  
  2905       name="row"  
  2906      />
  2907                       
  2908      <tr>
  2909                                 
  2910       <!-- Name  -->
  2911                                 
  2912       <td>
  2913                                           
  2914        <xsl:call- template 
  2915         name="flyo verSpan"
  2916        >
  2917                                                    
  2918         <xsl:with- param 
  2919          name="data "
  2920         >
  2921                                                              
  2922          <xsl:call- template 
  2923           name="getM edicationN ame"
  2924          >
  2925                                                                        
  2926           <xsl:with- param 
  2927            name="subs tanceAdmin "
  2928                                                                                 
  2929            select="$r ow/n1:subs tanceAdmin istration"  
  2930           />
  2931                                                                        
  2932           <xsl:with- param 
  2933            name="row"  
  2934            select="$r ow" 
  2935           />
  2936                                                               
  2937          </xsl:call -template>
  2938                                                     
  2939         </xsl:with -param>
  2940                                            
  2941        </xsl:call -template>
  2942                                  
  2943       </td>
  2944      
  2945                                 
  2946       <!-- Brand  Name -->
  2947                                 
  2948       <!-- <td>  <div style ="overflow :hidden; w hite-space :nowrap">  <xsl:choos e> 
  2949                                          <xsl:whe n test="st ring-lengt h($row/n1: substanceA dministrat ion/n1:con sumable/n1 :manufactu redProduct /n1:manufa cturedMate rial/n1:na me)>1"> 
  2950                                          <xsl:cal l-template  name="fly overSpan">  <xsl:with -param nam e="data" s elect="$ro w/n1:subst anceAdmini stration/n 1:consumab le/n1:manu facturedPr oduct/n1:m anufacture dMaterial/ n1:name"/>  
  2951                                          </xsl:ca ll-templat e> </xsl:w hen> <xsl: otherwise>  <xsl:call -template  name="na"/
  2952                                          </xsl:ot herwise> < /xsl:choos e> </div>  </td> -->
  2953      
  2954                                 
  2955       <!-- Route  -->
  2956                                 
  2957       <!-- <td>  <div style ="overflow :hidden; w hite-space :nowrap;">  <xsl:choo se> 
  2958                                          <xsl:whe n test="st ring-lengt h($row//n1 :substance Administra tion/n1:ro uteCode/@d isplayName )=0"> 
  2959                                          <xsl:cal l-template  name="na" /> </xsl:w hen> <xsl: otherwise>  <xsl:valu e-of 
  2960                                          select=" $row/n1:su bstanceAdm inistratio n/n1:route Code/@disp layName"/>  </xsl:oth erwise> 
  2961                                          </xsl:ch oose> </di v> </td> - ->
  2962      
  2963                                 
  2964       <!-- Inter val -->
  2965                                 
  2966       <!--<td> < div style= "overflow: hidden; wh ite-space: nowrap;">  <xsl:choos e> -->
  2967       <!-- Test  if Interva l value is  populated  -->
  2968       <!-- <xsl: when test= "string-le ngth($row/ n1:substan ceAdminist ration/n1: effectiveT ime/n1:per iod/@value )=0"> -->
  2969       <!-- Fille r '-' if I nterval nu ll -->
  2970       <!-- <xsl: call-templ ate name=" na"/> </xs l:when> <x sl:otherwi se> <xsl:v alue-of 
  2971                                          select=" $row/n1:su bstanceAdm inistratio n/n1:effec tiveTime/n 1:period/@ value"/> 
  2972                                          </xsl:ot herwise> < /xsl:choos e> </div>  </td> -->
  2973      
  2974                                 
  2975       <!-- Statu s -->
  2976                                 
  2977       <td>
  2978                                           
  2979        <xsl:call- template 
  2980         name="medS tatus"
  2981        >
  2982                                                    
  2983         <xsl:with- param 
  2984          name="subs tanceAdmin "
  2985                                                             
  2986          select="$r ow/n1:subs tanceAdmin istration"  
  2987         />
  2988                                            
  2989        </xsl:call -template>
  2990                                  
  2991       </td>
  2992      
  2993                                 
  2994       <!-- Quant ity -->
  2995                                 
  2996       <td>
  2997                                           
  2998        <xsl:call- template 
  2999         name="medQ uantity"
  3000        >
  3001                                                    
  3002         <xsl:with- param 
  3003          name="subs tanceAdmin "
  3004                                                             
  3005          select="$r ow/n1:subs tanceAdmin istration"  
  3006         />
  3007                                            
  3008        </xsl:call -template>
  3009                                  
  3010       </td>
  3011      
  3012                                 
  3013       <!-- Order  Expiratio n Date/Tim e -->
  3014                                 
  3015       <td>
  3016                                           
  3017        <xsl:call- template 
  3018         name="medE xpiretime"
  3019        >
  3020                                                    
  3021         <xsl:with- param 
  3022          name="subs tanceAdmin "
  3023                                                             
  3024          select="$r ow/n1:subs tanceAdmin istration"  
  3025         />
  3026                                            
  3027        </xsl:call -template>
  3028                                  
  3029       </td>
  3030      
  3031                                 
  3032       <!-- Provi der -->
  3033                                 
  3034       <td>
  3035                                           
  3036        <xsl:varia ble 
  3037         name="medP rovider"
  3038        >
  3039                                                    
  3040         <xsl:call- template 
  3041          name="getM edProvider "
  3042         >
  3043                                                              
  3044          <xsl:with- param 
  3045           name="subs tanceAdmin "
  3046                                                                       
  3047           select="$r ow/n1:subs tanceAdmin istration"  
  3048          />
  3049                                                     
  3050         </xsl:call -template>
  3051                                            
  3052        </xsl:vari able>
  3053                                           
  3054        <xsl:choos e>
  3055                                                    
  3056         <xsl:when 
  3057          test="stri ng-length( $medProvid er)>1"
  3058         >
  3059                                                              
  3060          <xsl:call- template 
  3061           name="flyo verSpan"
  3062          >
  3063                                                                        
  3064           <xsl:with- param 
  3065            name="data
  3066            select="$m edProvider
  3067           />
  3068                                                               
  3069          </xsl:call -template>
  3070                                                     
  3071         </xsl:when >
  3072                                                    
  3073         <xsl:other wise>
  3074                                                              
  3075          <xsl:call- template 
  3076           name="na" 
  3077          />
  3078                                                     
  3079         </xsl:othe rwise>
  3080                                            
  3081        </xsl:choo se>
  3082                                  
  3083       </td>
  3084      
  3085                                 
  3086       <!-- Presc ription ID  (Nbr) -->
  3087                                 
  3088       <td>
  3089                                           
  3090        <xsl:varia ble 
  3091         name="rxNu m"
  3092        >
  3093                                                    
  3094         <xsl:call- template 
  3095          name="getR xNumString "
  3096         >
  3097                                                              
  3098          <xsl:with- param 
  3099           name="subs tanceAdmin "
  3100                                                                       
  3101           select="$r ow/n1:subs tanceAdmin istration"  
  3102          />
  3103                                                     
  3104         </xsl:call -template>
  3105                                            
  3106        </xsl:vari able>
  3107                                           
  3108        <xsl:choos e>
  3109                                                    
  3110         <xsl:when 
  3111          test="stri ng-length( $rxNum)>1"
  3112         >
  3113                                                              
  3114          <xsl:value -of 
  3115           select="$r xNum" 
  3116          />
  3117                                                     
  3118         </xsl:when >
  3119                                                    
  3120         <xsl:other wise>
  3121                                                              
  3122          <xsl:call- template 
  3123           name="na" 
  3124          />
  3125                                                     
  3126         </xsl:othe rwise>
  3127                                            
  3128        </xsl:choo se>
  3129                                  
  3130       </td>
  3131      
  3132                                 
  3133       <!-- dispe nse time - ->
  3134                                 
  3135       <td>
  3136                                           
  3137        <xsl:call- template 
  3138         name="medB egintime"
  3139        >
  3140                                                    
  3141         <xsl:with- param 
  3142          name="row"  
  3143          select="$r ow" 
  3144         />
  3145                                            
  3146        </xsl:call -template>
  3147                                  
  3148       </td>
  3149      
  3150                                 
  3151       <!-- Sig - ->
  3152                                 
  3153       <td>
  3154                                           
  3155        <xsl:varia ble 
  3156         name="sig"
  3157        >
  3158                                                    
  3159         <xsl:call- template 
  3160          name="getS ig"
  3161         >
  3162                                                              
  3163          <xsl:with- param 
  3164           name="subs tanceAdmin "
  3165                                                                       
  3166           select="$r ow/n1:subs tanceAdmin istration"  
  3167          />
  3168                                                     
  3169         </xsl:call -template>
  3170                                            
  3171        </xsl:vari able>
  3172                                           
  3173        <xsl:choos e>
  3174                                                    
  3175         <xsl:when 
  3176          test="stri ng-length( $sig)>1"
  3177         >
  3178                                                              
  3179          <xsl:call- template 
  3180           name="flyo verSpan"
  3181          >
  3182                                                                        
  3183           <xsl:with- param 
  3184            name="data
  3185            select="$s ig" 
  3186           />
  3187                                                               
  3188          </xsl:call -template>
  3189                                                     
  3190         </xsl:when >
  3191                                                    
  3192         <xsl:other wise>
  3193                                                              
  3194          <xsl:call- template 
  3195           name="na" 
  3196          />
  3197                                                     
  3198         </xsl:othe rwise>
  3199                                            
  3200        </xsl:choo se>
  3201                                  
  3202       </td>
  3203      
  3204                                 
  3205       <!-- sourc e -->
  3206                                 
  3207       <td>
  3208                                           
  3209        <xsl:call- template 
  3210         name="flyo verSpan"
  3211        >
  3212                                                    
  3213         <xsl:with- param 
  3214          name="data "
  3215                                                             
  3216          select="n1 :substance Administra tion/n1:au thor/n1:as signedAuth or/n1:repr esentedOrg anization/ n1:name" 
  3217         />
  3218                                            
  3219        </xsl:call -template>
  3220                                  
  3221       </td>
  3222                        
  3223      </tr>
  3224              
  3225     </xsl:temp late>
  3226    
  3227             
  3228     <!-- Probl em entry r ow -->
  3229             
  3230     <xsl:templ ate 
  3231      name="prob lemRow"
  3232     >
  3233                       
  3234      <xsl:param  
  3235       name="row"  
  3236      />
  3237                       
  3238      <xsl:varia ble 
  3239       name="rowD ata"
  3240                                
  3241       select="$r ow/n1:act/ n1:entryRe lationship /n1:observ ation" 
  3242      />
  3243                       
  3244      <xsl:varia ble 
  3245       name="ref"
  3246                                
  3247       select="$r ow/n1:act/ n1:entryRe lationship /n1:observ ation/n1:t ext/n1:ref erence" 
  3248      />
  3249                       
  3250      <tr>
  3251      
  3252                                 
  3253       <!-- name  -->
  3254                                 
  3255       <td>
  3256                                           
  3257        <xsl:call- template 
  3258         name="prob Name"
  3259        >
  3260                                                    
  3261         <xsl:with- param 
  3262          name="ref"  
  3263          select="$r ef" 
  3264         />
  3265                                                    
  3266         <xsl:with- param 
  3267          name="rowD ata" 
  3268          select="$r owData" 
  3269         />
  3270                                            
  3271        </xsl:call -template>
  3272                                  
  3273       </td>
  3274      
  3275                                 
  3276       <!-- statu s -->
  3277                                 
  3278       <td>
  3279                                           
  3280        <xsl:call- template 
  3281         name="prob Status"
  3282        >
  3283                                                    
  3284         <xsl:with- param 
  3285          name="row"  
  3286          select="$r ow" 
  3287         />
  3288                                            
  3289        </xsl:call -template>
  3290                                  
  3291       </td>
  3292      
  3293                                 
  3294       <!-- Probl em Code -- >
  3295                                 
  3296       <td>
  3297                                           
  3298        <xsl:call- template 
  3299         name="getP roblemCode "
  3300        >
  3301                                                    
  3302         <xsl:with- param 
  3303          name="rowD ata" 
  3304          select="$r owData" 
  3305         />
  3306                                            
  3307        </xsl:call -template>
  3308                                  
  3309       </td>
  3310      
  3311                                 
  3312       <!-- probl em effecti ve date -- >
  3313                                 
  3314       <td>
  3315                                           
  3316        <xsl:call- template 
  3317         name="prob Date"
  3318        >
  3319                                                    
  3320         <xsl:with- param 
  3321          name="row"  
  3322          select="$r ow" 
  3323         />
  3324                                            
  3325        </xsl:call -template>
  3326       
  3327                                  
  3328       </td>
  3329      
  3330                                 
  3331       <!-- provi der -->
  3332                                 
  3333       <td>
  3334                                           
  3335        <xsl:varia ble 
  3336         name="prov ider" 
  3337        />
  3338                                           
  3339        <xsl:call- template 
  3340         name="getP roblemProv ider"
  3341        >
  3342                                                    
  3343         <xsl:with- param 
  3344          name="perf ormer" 
  3345          select="$r ow/n1:act/ n1:perform er" 
  3346         />
  3347                                            
  3348        </xsl:call -template>
  3349                                           
  3350        <xsl:if 
  3351         test="stri ng-length( $provider) >2"
  3352        >
  3353                                                    
  3354         <xsl:call- template 
  3355          name="flyo verSpan"
  3356         >
  3357                                                              
  3358          <xsl:with- param 
  3359           name="data
  3360           select="$p rovider" 
  3361          />
  3362                                                     
  3363         </xsl:call -template>
  3364                                            
  3365        </xsl:if>
  3366                                  
  3367       </td>
  3368      
  3369                                 
  3370       <!-- sourc e -->
  3371                                 
  3372       <td>
  3373                                           
  3374        <xsl:varia ble 
  3375         name="sour ce"
  3376        >
  3377                                                    
  3378         <xsl:call- template 
  3379          name="getP roblemSour ce"
  3380         >
  3381                                                              
  3382          <xsl:with- param 
  3383           name="row"  
  3384           select="$r ow" 
  3385          />
  3386                                                     
  3387         </xsl:call -template>
  3388                                            
  3389        </xsl:vari able>
  3390                                           
  3391        <xsl:choos e>
  3392                                                    
  3393         <xsl:when 
  3394          test="stri ng-length( $source)>1 "
  3395         >
  3396                                                              
  3397          <xsl:call- template 
  3398           name="flyo verSpan"
  3399          >
  3400                                                                        
  3401           <xsl:with- param 
  3402            name="data
  3403            select="$s ource" 
  3404           />
  3405                                                               
  3406          </xsl:call -template>
  3407                                                     
  3408         </xsl:when >
  3409                                                    
  3410         <xsl:other wise>
  3411                                                              
  3412          <xsl:call- template 
  3413           name="na" 
  3414          />
  3415                                                     
  3416         </xsl:othe rwise>
  3417                                            
  3418        </xsl:choo se>
  3419                                  
  3420       </td>
  3421                        
  3422      </tr>
  3423              
  3424     </xsl:temp late>
  3425    
  3426             
  3427     <!-- Aller gy entry r ow -->
  3428             
  3429     <xsl:templ ate 
  3430      name="alle rgyRow"
  3431     >
  3432                       
  3433      <xsl:param  
  3434       name="row"  
  3435      />
  3436                       
  3437      <xsl:varia ble 
  3438       name="obse rvation"
  3439                                
  3440       select="$r ow/n1:act/ n1:entryRe lationship /n1:observ ation" 
  3441      />
  3442                       
  3443      <xsl:varia ble 
  3444       name="eR" 
  3445       select="$r ow/n1:act/ n1:entryRe lationship
  3446      />
  3447                       
  3448      <tr>
  3449      
  3450                                 
  3451       <!--Allerg ens -->
  3452                                 
  3453       <td>
  3454                                           
  3455        <xsl:varia ble 
  3456         name="alle rgen"
  3457        >
  3458                                                    
  3459         <xsl:call- template 
  3460          name="getA llergen"
  3461         >
  3462                                                              
  3463          <xsl:with- param 
  3464           name="obse rvation" 
  3465           select="$o bservation
  3466          />
  3467                                                     
  3468         </xsl:call -template>
  3469                                            
  3470        </xsl:vari able>
  3471                                           
  3472        <xsl:choos e>
  3473                                                    
  3474         <xsl:when 
  3475          test="stri ng-length( $allergen) >1"
  3476         >
  3477                                                              
  3478          <xsl:call- template 
  3479           name="flyo verSpan"
  3480          >
  3481                                                                        
  3482           <xsl:with- param 
  3483            name="data
  3484            select="$a llergen" 
  3485           />
  3486                                                               
  3487          </xsl:call -template>
  3488                                                     
  3489         </xsl:when >
  3490                                                    
  3491         <xsl:other wise>
  3492                                                              
  3493          <xsl:call- template 
  3494           name="na" 
  3495          />
  3496                                                     
  3497         </xsl:othe rwise>
  3498                                            
  3499        </xsl:choo se>
  3500                                  
  3501       </td>
  3502      
  3503                                 
  3504       <!--Verifi cation Dat e -->
  3505                                 
  3506       <td>
  3507                                           
  3508        <xsl:choos e>
  3509                                                    
  3510         <xsl:when
  3511                                                             
  3512          test="stri ng-length( $observati on/n1:effe ctiveTime/ n1:low/@va lue)=0"
  3513         >
  3514                                                              
  3515          <xsl:call- template 
  3516           name="na" 
  3517          />
  3518                                                     
  3519         </xsl:when >
  3520                                                    
  3521         <xsl:when 
  3522          test="$obs ervation/n 1:effectiv eTime/n1:l ow/@value"
  3523         >
  3524                                                              
  3525          <xsl:call- template 
  3526           name="form atDate"
  3527          >
  3528                                                                        
  3529           <xsl:with- param 
  3530            name="date "
  3531                                                                                 
  3532            select="$o bservation /n1:effect iveTime/n1 :low/@valu e" 
  3533           />
  3534                                                               
  3535          </xsl:call -template>
  3536                                                     
  3537         </xsl:when >
  3538                                            
  3539        </xsl:choo se>
  3540                                  
  3541       </td>
  3542      
  3543                                 
  3544       <!--Event  Type -->
  3545                                 
  3546       <td>
  3547                                           
  3548        <xsl:varia ble 
  3549         name="alle rgenType"
  3550        >
  3551                                                    
  3552         <xsl:call- template 
  3553          name="getE ventType"
  3554         >
  3555                                                              
  3556          <xsl:with- param 
  3557           name="obs"  
  3558           select="$o bservation
  3559          />
  3560                                                     
  3561         </xsl:call -template>
  3562                                            
  3563        </xsl:vari able>
  3564                                           
  3565        <xsl:choos e>
  3566                                                    
  3567         <xsl:when 
  3568          test="stri ng-length( $allergenT ype)>1"
  3569         >
  3570                                                              
  3571          <xsl:call- template 
  3572           name="flyo verSpan"
  3573          >
  3574                                                                        
  3575           <xsl:with- param 
  3576            name="data
  3577            select="$a llergenTyp e" 
  3578           />
  3579                                                               
  3580          </xsl:call -template>
  3581                                                     
  3582         </xsl:when >
  3583                                                    
  3584         <xsl:other wise>
  3585                                                              
  3586          <xsl:call- template 
  3587           name="na" 
  3588          />
  3589                                                     
  3590         </xsl:othe rwise>
  3591                                            
  3592        </xsl:choo se>
  3593                                  
  3594       </td>
  3595      
  3596                                 
  3597       <!--Allerg en Free-Te xt -->
  3598       <!-- <td s tyle="over flow:hidde n; white-s pace:nowra p; width:1 00px;"> <x sl:variabl
  3599                                          name="al lergenText "> <xsl:ca ll-templat e name="ge tAllergenT ext"> <xsl :with-para
  3600                                          name="ob servation"  select="$ observatio n" /> </xs l:call-tem plate> </x sl:variabl e> 
  3601                                          <xsl:cho ose> <xsl: when test= "string-le ngth($alle rgenText)> 1"> <xsl:c all-templa te 
  3602                                          name="fl yoverSpan" > <xsl:wit h-param na me="data"  select="$a llergenTex t"/> 
  3603                                          </xsl:ca ll-templat e> </xsl:w hen> <xsl: otherwise>  <xsl:call -template  name="na"/
  3604                                          </xsl:ot herwise> < /xsl:choos e> </td> - ->
  3605      
  3606                                 
  3607       <!--Produc t Coded -- >
  3608       <!-- <td s tyle="over flow:hidde n; white-s pace:nowra p; width:1 00px;"> <x sl:call-te mplate 
  3609                                          name="na "/> </td>  -->
  3610      
  3611                                 
  3612       <!--Reacti on -->
  3613                                 
  3614       <td>
  3615                                           
  3616        <xsl:varia ble 
  3617         name="resu lts"
  3618        >
  3619                                                    
  3620         <xsl:for-e ach 
  3621          select="$o bservation /n1:entryR elationshi p[@typeCod e='MFST']"
  3622         >
  3623                                                              
  3624          <xsl:varia ble 
  3625           name="resu lt"
  3626          >
  3627                                                                        
  3628           <xsl:call- template 
  3629            name="getR eactionVal ue"
  3630           >
  3631                                                                                  
  3632            <xsl:with- param 
  3633             name="reac tion"
  3634                                                                                           
  3635             select="n1 :observati on/n1:text /n1:refere nce/@value
  3636            />
  3637                                                                         
  3638           </xsl:call -template>
  3639                                                               
  3640          </xsl:vari able>
  3641                                                              
  3642          <xsl:choos e>
  3643                                                                        
  3644           <xsl:when 
  3645            test="$res ult"
  3646           >
  3647                                                                                  
  3648            <xsl:value -of 
  3649             select="$r esult" 
  3650            />
  3651                                                                         
  3652           </xsl:when >
  3653                                                               
  3654          </xsl:choo se>
  3655                                                     
  3656         </xsl:for- each>
  3657                                            
  3658        </xsl:vari able>
  3659                                           
  3660        <xsl:choos e>
  3661                                                    
  3662         <xsl:when 
  3663          test="$res ults"
  3664         >
  3665                                                              
  3666          <xsl:call- template 
  3667           name="flyo verSpan"
  3668          >
  3669                                                                        
  3670           <xsl:with- param 
  3671            name="data
  3672            select="$r esults" 
  3673           />
  3674                                                               
  3675          </xsl:call -template>
  3676                                                     
  3677         </xsl:when >
  3678                                            
  3679        </xsl:choo se>
  3680                                  
  3681       </td>
  3682      
  3683                                 
  3684       <!--Reacti on Free-Te xt -->
  3685                                 
  3686       <!--<td st yle="overf low:hidden ; white-sp ace:nowrap ; width:10 0px;"> <xs l:variable  
  3687                                          name="re actionText "> <xsl:ca ll-templat e name="ge tReactionS tring"> <x sl:with-pa ram 
  3688                                          name="ob servation"  select="$ observatio n"/> </xsl :call-temp late> </xs l:variable
  3689                                          <xsl:cho ose> <xsl: when test= "string-le ngth($reac tionText)> 1"> <xsl:v alue-of 
  3690                                          select=" $reactionT ext"/> </x sl:when> < xsl:otherw ise> <xsl: call-templ ate name=" na"/> 
  3691                                          </xsl:ot herwise> < /xsl:choos e> </td> - ->
  3692      
  3693                                 
  3694       <!--Reacti on Coded - ->
  3695       <!-- <td s tyle="over flow:hidde n; white-s pace:nowra p; width:1 00px;"> <x sl:call-te mplate 
  3696                                          name="ge tReactionC oded"> <xs l:with-par am name="e R" select= "$eR"/> </ xsl:call-t emplate> 
  3697                                          </td> -- >
  3698      
  3699                                 
  3700       <!--Severi ty -->
  3701                                 
  3702       <td>
  3703                                           
  3704        <xsl:varia ble 
  3705         name="seve rity"
  3706        >
  3707                                                    
  3708         <xsl:call- template 
  3709          name="getS everity"
  3710         >
  3711                                                              
  3712          <xsl:with- param 
  3713           name="obse rvation" 
  3714           select="$o bservation
  3715          />
  3716                                                     
  3717         </xsl:call -template>
  3718                                            
  3719        </xsl:vari able>
  3720                                           
  3721        <xsl:choos e>
  3722                                                    
  3723         <xsl:when 
  3724          test="stri ng-length( $severity) >1"
  3725         >
  3726                                                              
  3727          <xsl:value -of 
  3728           select="$s everity" 
  3729          />
  3730                                                     
  3731         </xsl:when >
  3732                                                    
  3733         <xsl:other wise>
  3734                                                              
  3735          <xsl:call- template 
  3736           name="na" 
  3737          />
  3738                                                     
  3739         </xsl:othe rwise>
  3740                                            
  3741        </xsl:choo se>
  3742                                  
  3743       </td>
  3744      
  3745                                 
  3746       <!--Severi ty Free-Te xt -->
  3747       <!-- <td s tyle="over flow:hidde n; white-s pace:nowra p; width:1 00px;"> <x sl:call-te mplate 
  3748                                          name="na "/> </td>  -->
  3749       <!--Severi ty Coded - ->
  3750       <!-- <td s tyle="over flow:hidde n; white-s pace:nowra p; width:1 00px;"> <x sl:call-te mplate 
  3751                                          name="na "/> </td>  -->
  3752      
  3753                                 
  3754       <!--source  -->
  3755                                 
  3756       <td>
  3757                                           
  3758        <xsl:varia ble 
  3759         name="sour ce"
  3760        >
  3761                                                    
  3762         <xsl:call- template 
  3763          name="getA llergySour ce"
  3764         >
  3765                                                              
  3766          <xsl:with- param 
  3767           name="row"  
  3768           select="$r ow" 
  3769          />
  3770                                                     
  3771         </xsl:call -template>
  3772                                            
  3773        </xsl:vari able>
  3774                                           
  3775        <xsl:choos e>
  3776                                                    
  3777         <xsl:when 
  3778          test="stri ng-length( $source)>1 "
  3779         >
  3780                                                              
  3781          <xsl:call- template 
  3782           name="flyo verSpan"
  3783          >
  3784                                                                        
  3785           <xsl:with- param 
  3786            name="data
  3787            select="$s ource" 
  3788           />
  3789                                                               
  3790          </xsl:call -template>
  3791                                                     
  3792         </xsl:when >
  3793                                                    
  3794         <xsl:other wise>
  3795                                                              
  3796          <xsl:call- template 
  3797           name="na" 
  3798          />
  3799                                                     
  3800         </xsl:othe rwise>
  3801                                            
  3802        </xsl:choo se>
  3803                                  
  3804       </td>
  3805                        
  3806      </tr>
  3807     
  3808              
  3809     </xsl:temp late>
  3810    
  3811             
  3812     <!-- Proce dures row  entry -->
  3813             
  3814     <xsl:templ ate 
  3815      name="proc edureRow"
  3816     >
  3817                       
  3818      <xsl:param  
  3819       name="row"  
  3820      />
  3821                       
  3822      <tr>
  3823      
  3824                                 
  3825       <!-- Proce dure Date/ Time -->
  3826                                 
  3827       <td>
  3828                                           
  3829        <xsl:choos e>
  3830                                                    
  3831         <xsl:when 
  3832          test="$row /n1:proced ure/n1:eff ectiveTime /@value"
  3833         >
  3834                                                              
  3835          <xsl:call- template 
  3836           name="form atDate"
  3837          >
  3838                                                                        
  3839           <xsl:with- param 
  3840            name="date "
  3841                                                                                 
  3842            select="$r ow/n1:proc edure/n1:e ffectiveTi me/@value"  
  3843           />
  3844                                                               
  3845          </xsl:call -template>
  3846                                                     
  3847         </xsl:when >
  3848                                                    
  3849         <xsl:other wise>
  3850                                                              
  3851          <xsl:call- template 
  3852           name="form atDate"
  3853          >
  3854                                                                        
  3855           <xsl:with- param 
  3856            name="date "
  3857                                                                                 
  3858            select="$r ow/n1:proc edure/n1:e ffectiveTi me/n1:low/ @value" 
  3859           />
  3860                                                               
  3861          </xsl:call -template>
  3862                                                     
  3863         </xsl:othe rwise>
  3864                                            
  3865        </xsl:choo se>
  3866                                  
  3867       </td>
  3868      
  3869                                 
  3870       <!-- Proce dure Type  -->
  3871                                 
  3872       <td>
  3873                                           
  3874        <xsl:varia ble 
  3875         name="type "
  3876        >
  3877                                                    
  3878         <xsl:call- template 
  3879          name="getP rocedureTy pe"
  3880         >
  3881                                                              
  3882          <xsl:with- param 
  3883           name="proc edure" 
  3884           select="$r ow/n1:proc edure" 
  3885          />
  3886                                                     
  3887         </xsl:call -template>
  3888                                            
  3889        </xsl:vari able>
  3890                                           
  3891        <xsl:choos e>
  3892                                                    
  3893         <xsl:when 
  3894          test="stri ng-length( $type)>1"
  3895         >
  3896                                                              
  3897          <xsl:call- template 
  3898           name="flyo verSpan"
  3899          >
  3900                                                                        
  3901           <xsl:with- param 
  3902            name="data
  3903            select="$t ype" 
  3904           />
  3905                                                               
  3906          </xsl:call -template>
  3907                                                     
  3908         </xsl:when >
  3909                                                    
  3910         <xsl:other wise>
  3911                                                              
  3912          <xsl:call- template 
  3913           name="na" 
  3914          />
  3915                                                     
  3916         </xsl:othe rwise>
  3917                                            
  3918        </xsl:choo se>
  3919                                  
  3920       </td>
  3921      
  3922      
  3923                                 
  3924       <!-- Proce dure Quali fier -->
  3925                                 
  3926       <td>
  3927                                           
  3928        <xsl:for-e ach 
  3929         select="$r ow/n1:proc edure/n1:c ode/n1:qua lifier"
  3930        >
  3931                                                    
  3932         <xsl:varia ble 
  3933          name="qual ifier"
  3934         >
  3935                                                              
  3936          <xsl:call- template 
  3937           name="getP rocedureQu alifier"
  3938          >
  3939                                                                        
  3940           <xsl:with- param 
  3941            name="proc edure" 
  3942            select="."  
  3943           />
  3944                                                               
  3945          </xsl:call -template>
  3946                                                     
  3947         </xsl:vari able>
  3948                                                    
  3949         <xsl:choos e>
  3950                                                              
  3951          <xsl:when 
  3952           test="stri ng-length( $qualifier )>1"
  3953          >
  3954                                                                        
  3955           <xsl:call- template 
  3956            name="flyo verSpan"
  3957           >
  3958                                                                                  
  3959            <xsl:with- param 
  3960             name="data
  3961             select="$q ualifier" 
  3962            />
  3963                                                                         
  3964           </xsl:call -template>
  3965                                                               
  3966          </xsl:when >
  3967                                                              
  3968          <xsl:other wise>
  3969                                                                        
  3970           <xsl:call- template 
  3971            name="na" 
  3972           />
  3973                                                               
  3974          </xsl:othe rwise>
  3975                                                     
  3976         </xsl:choo se>
  3977                                                    
  3978         <br>
  3979         </br>
  3980                                            
  3981        </xsl:for- each>
  3982       
  3983                                  
  3984       </td>
  3985      
  3986      
  3987      
  3988                                 
  3989       <!-- Proce dure Free  Text Type  -->
  3990      
  3991                                 
  3992       <td>
  3993                                           
  3994        <xsl:varia ble 
  3995         name="proc FreeText"
  3996        >
  3997                                                    
  3998         <xsl:call- template 
  3999          name="getP rocedureFr eeText"
  4000         >
  4001                                                              
  4002          <xsl:with- param 
  4003           name="proc edure" 
  4004           select="$r ow/n1:proc edure" 
  4005          />
  4006                                                     
  4007         </xsl:call -template>
  4008                                            
  4009        </xsl:vari able>
  4010                                           
  4011        <xsl:choos e>
  4012                                                    
  4013         <xsl:when 
  4014          test="stri ng-length( $procFreeT ext)>1"
  4015         >
  4016                                                              
  4017          <xsl:call- template 
  4018           name="flyo verTextSpa n"
  4019          >
  4020                                                                        
  4021           <xsl:with- param 
  4022            name="data
  4023            select="$p rocFreeTex t" 
  4024           />
  4025                                                               
  4026          </xsl:call -template>
  4027                                                     
  4028         </xsl:when >
  4029                                                    
  4030         <xsl:other wise>
  4031                                                              
  4032          <xsl:call- template 
  4033           name="na" 
  4034          />
  4035                                                     
  4036         </xsl:othe rwise>
  4037                                            
  4038        </xsl:choo se>
  4039                                  
  4040       </td>
  4041      
  4042                                 
  4043       <!-- Proce dure Provi der -->
  4044                                 
  4045       <td>
  4046                                           
  4047        <xsl:varia ble 
  4048         name="proc Provider"
  4049        >
  4050                                                    
  4051         <xsl:call- template 
  4052          name="getP rocedurePr ovider"
  4053         >
  4054                                                              
  4055          <xsl:with- param 
  4056           name="proc edure" 
  4057           select="$r ow/n1:proc edure" 
  4058          />
  4059                                                     
  4060         </xsl:call -template>
  4061                                            
  4062        </xsl:vari able>
  4063                                           
  4064        <xsl:choos e>
  4065                                                    
  4066         <xsl:when 
  4067          test="stri ng-length( $procProvi der)>1"
  4068         >
  4069                                                              
  4070          <xsl:call- template 
  4071           name="flyo verSpan"
  4072          >
  4073                                                                        
  4074           <xsl:with- param 
  4075            name="data
  4076            select="$p rocProvide r" 
  4077           />
  4078                                                               
  4079          </xsl:call -template>
  4080                                                     
  4081         </xsl:when >
  4082                                                    
  4083         <xsl:other wise>
  4084                                                              
  4085          <xsl:call- template 
  4086           name="na" 
  4087          />
  4088                                                     
  4089         </xsl:othe rwise>
  4090                                            
  4091        </xsl:choo se>
  4092                                  
  4093       </td>
  4094      
  4095                                 
  4096       <!-- Proce dure Sourc e -->
  4097                                 
  4098       <td>
  4099                                           
  4100        <xsl:varia ble 
  4101         name="proc Source"
  4102        >
  4103                                                    
  4104         <xsl:call- template 
  4105          name="getP rocedureSo urce"
  4106         >
  4107                                                              
  4108          <xsl:with- param 
  4109           name="proc edure" 
  4110           select="$r ow/n1:proc edure" 
  4111          />
  4112                                                     
  4113         </xsl:call -template>
  4114                                            
  4115        </xsl:vari able>
  4116                                           
  4117        <xsl:choos e>
  4118                                                    
  4119         <xsl:when 
  4120          test="stri ng-length( $procSourc e)>1"
  4121         >
  4122                                                              
  4123          <xsl:call- template 
  4124           name="flyo verSpan"
  4125          >
  4126                                                                        
  4127           <xsl:with- param 
  4128            name="data
  4129            select="$p rocSource"  
  4130           />
  4131                                                               
  4132          </xsl:call -template>
  4133                                                     
  4134         </xsl:when >
  4135                                                    
  4136         <xsl:other wise>
  4137                                                              
  4138          <xsl:call- template 
  4139           name="na" 
  4140          />
  4141                                                     
  4142         </xsl:othe rwise>
  4143                                            
  4144        </xsl:choo se>
  4145                                  
  4146       </td>
  4147                        
  4148      </tr>
  4149              
  4150     </xsl:temp late>
  4151    
  4152             
  4153     <!-- labs  entry row  -->
  4154             
  4155     <xsl:templ ate 
  4156      name="labs Row"
  4157     >
  4158                       
  4159      <xsl:param  
  4160       name="row"  
  4161      />
  4162     
  4163                       
  4164      <xsl:choos e>
  4165                                 
  4166       <xsl:when 
  4167        test="stri ng-length( $row/n1:or ganizer)!= 0"
  4168       >
  4169                                           
  4170        <tr>
  4171                                                    
  4172         <td>
  4173                                                              
  4174          <xsl:choos e>
  4175                                                                        
  4176           <xsl:when
  4177                                                                                 
  4178            test="stri ng-length( $row/n1:or ganizer/n1 :effective Time/@valu e)>0"
  4179           >
  4180                                                                                  
  4181            <xsl:call- template 
  4182             name="form atDate"
  4183            >
  4184                                                                                            
  4185             <xsl:with- param 
  4186              name="date "
  4187                                                                                                    
  4188              select="$r ow/n1:orga nizer/n1:e ffectiveTi me/@value"  
  4189             />
  4190                                                                                   
  4191            </xsl:call -template>
  4192                                                                         
  4193           </xsl:when >
  4194                                                                        
  4195           <xsl:when
  4196                                                                                 
  4197            test="stri ng-length( $row/n1:or ganizer/n1 :effective Time/n1:lo w/@value)> 0"
  4198           >
  4199                                                                                  
  4200            <xsl:call- template 
  4201             name="form atDate"
  4202            >
  4203                                                                                            
  4204             <xsl:with- param 
  4205              name="date "
  4206                                                                                                    
  4207              select="$r ow/n1:orga nizer/n1:e ffectiveTi me//n1:low /@value" 
  4208             />
  4209                                                                                   
  4210            </xsl:call -template>
  4211                                                                         
  4212           </xsl:when >
  4213                                                                        
  4214           <xsl:when
  4215                                                                                 
  4216            test="stri ng-length( $row/n1:or ganizer/n1 :component /n1:proced ure/n1:eff ectiveTime /@value)>0 "
  4217           >
  4218                                                                                  
  4219            <xsl:call- template 
  4220             name="form atDate"
  4221            >
  4222                                                                                            
  4223             <xsl:with- param 
  4224              name="date "
  4225                                                                                                    
  4226              select="$r ow/n1:orga nizer/n1:c omponent/n 1:procedur e/n1:effec tiveTime/@ value" 
  4227             />
  4228                                                                                   
  4229            </xsl:call -template>
  4230                                                                         
  4231           </xsl:when >
  4232                                                                        
  4233           <xsl:other wise>
  4234                                                                                  
  4235            <xsl:text>
  4236              Not Avail able 
  4237            </xsl:text >
  4238                                                                         
  4239           </xsl:othe rwise>
  4240                                                               
  4241          </xsl:choo se>
  4242                                                     
  4243         </td>
  4244                                                    
  4245         <td>
  4246                                                              
  4247          <xsl:choos e>
  4248                                                                        
  4249           <xsl:when 
  4250            test="stri ng-length( $row/n1:or ganizer/n1 :code/@dis playName)"
  4251           >
  4252                                                                                  
  4253            <xsl:value -of 
  4254             select="$r ow/n1:orga nizer/n1:c ode/@displ ayName" 
  4255            />
  4256                                                                         
  4257           </xsl:when >
  4258                                                                        
  4259           <xsl:when
  4260                                                                                 
  4261            test="stri ng-length( $row/n1:or ganizer/n1 :code/n1:o riginalTex t)"
  4262           >
  4263                                                                                  
  4264            <xsl:value -of 
  4265             select="$r ow/n1:orga nizer/n1:c ode/n1:ori ginalText"  
  4266            />
  4267                                                                         
  4268           </xsl:when >
  4269                                                               
  4270          </xsl:choo se>
  4271         
  4272                                                     
  4273         </td>
  4274                                                    
  4275         <!-- Sourc e -->
  4276                                                    
  4277         <td>
  4278                                                              
  4279          <xsl:choos e>
  4280                                                                        
  4281           <xsl:when
  4282                                                                                 
  4283            test="$row /n1:organi zer/n1:per former/n1: assignedEn tity/n1:re presentedO rganizatio n/n1:name"
  4284           >
  4285                                                                                  
  4286            <xsl:value -of
  4287                                                                                           
  4288             select="$r ow/n1:orga nizer/n1:p erformer/n 1:assigned Entity/n1: represente dOrganizat ion/n1:nam e" 
  4289            />
  4290                                                                         
  4291           </xsl:when >
  4292                                                                        
  4293           <xsl:when
  4294                                                                                 
  4295            test="$row /n1:organi zer/n1:aut hor/n1:ass ignedAutho r/n1:repre sentedOrga nization/n 1:name"
  4296           >
  4297                                                                                  
  4298            <xsl:value -of
  4299                                                                                           
  4300             select="$r ow/n1:orga nizer/n1:a uthor/n1:a ssignedAut hor/n1:rep resentedOr ganization /n1:name" 
  4301            />
  4302                                                                         
  4303           </xsl:when >
  4304                                                               
  4305          </xsl:choo se>
  4306                                                     
  4307         </td>
  4308                                                    
  4309         <td>
  4310                                                              
  4311          <xsl:text>
  4312           --
  4313          </xsl:text >
  4314                                                     
  4315         </td>
  4316                                                    
  4317         <td>
  4318                                                              
  4319          <xsl:text>
  4320           --
  4321          </xsl:text >
  4322                                                     
  4323         </td>
  4324                                                    
  4325         <td>
  4326                                                              
  4327          <xsl:text>
  4328           --
  4329          </xsl:text >
  4330                                                     
  4331         </td>
  4332                                                    
  4333         <!-- Statu s -->
  4334                                                    
  4335         <td>
  4336                                                              
  4337          <xsl:value -of 
  4338           select="$r ow/n1:orga nizer/n1:s tatusCode/ @code" 
  4339          />
  4340                                                     
  4341         </td>
  4342                                                    
  4343         <td>
  4344                                                              
  4345          <xsl:text>
  4346           --
  4347          </xsl:text >
  4348                                                     
  4349         </td>
  4350        
  4351        
  4352                                            
  4353        </tr>
  4354       
  4355                                           
  4356        <xsl:for-e ach 
  4357         select="$r ow/n1:orga nizer/n1:c omponent"
  4358        >
  4359                                                    
  4360         <tr>
  4361                                                              
  4362          <!-- Date  -->
  4363                                                              
  4364          <td>
  4365                                                                        
  4366           <xsl:text>
  4367            --
  4368           </xsl:text >
  4369                                                               
  4370          </td>
  4371                                                              
  4372          <!-- Test  -->
  4373                                                              
  4374          <td>
  4375                                                                        
  4376           <xsl:choos e>
  4377                                                                                  
  4378            <xsl:when
  4379                                                                                           
  4380             test="stri ng-length( n1:observa tion/n1:co de/@displa yName)!=0"
  4381            >
  4382                                                                                            
  4383             <xsl:value -of 
  4384              select="n1 :observati on/n1:code /@displayN ame" 
  4385             />
  4386                                                                                   
  4387            </xsl:when >
  4388                                                                                  
  4389            <xsl:when
  4390                                                                                           
  4391             test="stri ng-length( n1:observa tion/n1:co de/n1:orig inalText)! =0"
  4392            >
  4393                                                                                            
  4394             <xsl:value -of 
  4395              select="n1 :observati on/n1:code /n1:origin alText" 
  4396             />
  4397                                                                                   
  4398            </xsl:when >
  4399                                                                                  
  4400            <xsl:other wise>
  4401                                                                                            
  4402             <xsl:varia ble 
  4403              name="labR eference"
  4404                                                                                                    
  4405              select="n1 :observati on/n1:text /n1:refere nce/@value
  4406             />
  4407                                                                                            
  4408             <xsl:value -of
  4409                                                                                                    
  4410              select=".. /n1:text/n 1:table/n1 :tbody/n1: tr/n1:td/n 1:content[ @ID=$labRe ference]" 
  4411             />
  4412                                                                                   
  4413            </xsl:othe rwise>
  4414                                                                         
  4415           </xsl:choo se>
  4416                                                               
  4417          </td>
  4418         
  4419                                                              
  4420          <!-- Sourc e -->
  4421                                                              
  4422          <td>
  4423                                                                        
  4424           <xsl:text>
  4425            --
  4426           </xsl:text >
  4427                                                               
  4428          </td>
  4429         
  4430         
  4431                                                              
  4432          <!-- Resul t - Unit - ->
  4433                                                              
  4434          <td>
  4435                                                                        
  4436           <xsl:choos e>
  4437                                                                                  
  4438            <xsl:when 
  4439             test="stri ng-length( n1:observa tion/n1:va lue/@value )!=0"
  4440            >
  4441                                                                                            
  4442             <xsl:value -of 
  4443              select="n1 :observati on/n1:valu e/@value" 
  4444             />
  4445                                                                                            
  4446             <xsl:if 
  4447              test="n1:o bservation /n1:value/ @unit"
  4448             >
  4449                                                                                                     
  4450              <xsl:text>
  4451                
  4452              </xsl:text >
  4453                                                                                                     
  4454              <xsl:value -of 
  4455               select="n1 :observati on/n1:valu e/@unit" 
  4456              />
  4457                                                                                             
  4458             </xsl:if>
  4459                                                                                   
  4460            </xsl:when >
  4461                                                                                  
  4462            <xsl:other wise>
  4463                                                                                            
  4464             <xsl:choos e>
  4465                                                                                                     
  4466              <xsl:when
  4467                                                                                                              
  4468               test="stri ng-length( n1:observa tion/n1:va lue/n1:hig h/@value)! =0"
  4469              >
  4470                                                                                                               
  4471               <xsl:value -of 
  4472                select="n1 :observati on/n1:valu e/n1:high/ @value" 
  4473               />
  4474                                                                                                               
  4475               <xsl:if 
  4476                test="n1:o bservation /n1:value/ n1:high/@u nit"
  4477               >
  4478                                                                                                                         
  4479                <xsl:text>
  4480                  
  4481                </xsl:text >
  4482                                                                                                                         
  4483                <xsl:value -of 
  4484                 select="n1 :observati on/n1:valu e/n1:high/ @unit" 
  4485                />
  4486                                                                                                                
  4487               </xsl:if>
  4488                                                                                                      
  4489              </xsl:when >
  4490                                                                                                     
  4491              <xsl:other wise>
  4492                                                                                                               
  4493               <xsl:choos e>
  4494                                                                                                                         
  4495                <xsl:when
  4496                                                                                                                                  
  4497                 test="stri ng-length( n1:observa tion/n1:va lue/n1:low /@value)!= 0"
  4498                >
  4499                                                                                                                                   
  4500                 <xsl:value -of 
  4501                  select="n1 :observati on/n1:valu e/n1:low/@ value" 
  4502                 />
  4503                                                                                                                                   
  4504                 <xsl:if 
  4505                  test="n1:o bservation /n1:value/ n1:low/@un it"
  4506                 >
  4507                                                                                                                                             
  4508                  <xsl:text>
  4509                    
  4510                  </xsl:text >
  4511                                                                                                                                             
  4512                  <xsl:value -of 
  4513                   select="n1 :observati on/n1:valu e/n1:low/@ unit" 
  4514                  />
  4515                                                                                                                                    
  4516                 </xsl:if>
  4517                                                                                                                          
  4518                </xsl:when >
  4519                                                                                                                         
  4520                <xsl:other wise>
  4521                                                                                                                                   
  4522                 <xsl:choos e>
  4523                                                                                                                                             
  4524                  <xsl:when 
  4525                   test="stri ng-length( n1:observa tion/n1:va lue)!=0"
  4526                  >
  4527                                                                                                                                                      
  4528                   <xsl:value -of 
  4529                    select="n1 :observati on/n1:valu e" 
  4530                   />
  4531                                                                                                                                              
  4532                  </xsl:when >
  4533                                                                                                                                             
  4534                  <xsl:other wise>
  4535                                                                                                                                                      
  4536                   <xsl:text>
  4537                    --
  4538                   </xsl:text >
  4539                                                                                                                                              
  4540                  </xsl:othe rwise>
  4541                                                                                                                                    
  4542                 </xsl:choo se>
  4543                                                                                                                          
  4544                </xsl:othe rwise>
  4545                                                                                                                
  4546               </xsl:choo se>
  4547                                                                                                      
  4548              </xsl:othe rwise>
  4549                                                                                             
  4550             </xsl:choo se>
  4551                                                                                   
  4552            </xsl:othe rwise>
  4553                                                                         
  4554           </xsl:choo se>
  4555                                                               
  4556          </td>
  4557                                                              
  4558          <!-- Inter pretation  -->
  4559                                                              
  4560          <td>
  4561                                                                        
  4562           <xsl:varia ble 
  4563            name="inte rpRef1"
  4564                                                                                 
  4565            select="n1 :observati on/n1:inte rpretation Code/n1:or iginalText /n1:refere nce/@value
  4566           />
  4567                                                                        
  4568           <xsl:varia ble 
  4569            name="inte rpRef2"
  4570                                                                                 
  4571            select="$r ow/../n1:t ext/n1:tab le/n1:tbod y/n1:tr/n1 :td/n1:con tent[@ID=s ubstring-a fter($inte rpRef1,'#' )]" 
  4572           />
  4573          
  4574                                                                        
  4575           <xsl:value -of
  4576                                                                                 
  4577            select="n1 :observati on/n1:inte rpretation Code/n1:or iginalText
  4578           />
  4579                                                                        
  4580           <xsl:if
  4581                                                                                 
  4582            test="stri ng-length( n1:observa tion/n1:in terpretati onCode/n1: originalTe xt)=0"
  4583           >
  4584                                                                                  
  4585            <xsl:value -of
  4586                                                                                           
  4587             select="n1 :observati on/n1:inte rpretation Code/@disp layName" 
  4588            />
  4589                                                                                  
  4590            <xsl:if
  4591                                                                                           
  4592             test="stri ng-length( n1:observa tion/n1:in terpretati onCode/@di splayName) =0"
  4593            >
  4594                                                                                            
  4595             <xsl:text>
  4596              --
  4597             </xsl:text >
  4598                                                                                   
  4599            </xsl:if>
  4600                                                                         
  4601           </xsl:if>
  4602                                                                        
  4603           <xsl:if 
  4604            test="stri ng-length( $interpRef 2)"
  4605           >
  4606                                                                                  
  4607            <xsl:value -of 
  4608             select="$i nterpRef2"  
  4609            />
  4610                                                                         
  4611           </xsl:if>
  4612                                                               
  4613          </td>
  4614                                                              
  4615          <!-- Ref R ange -->
  4616                                                              
  4617          <td>
  4618                                                                        
  4619           <xsl:call- template 
  4620            name="flyo verSpan"
  4621           >
  4622                                                                                  
  4623            <xsl:with- param 
  4624             name="data "
  4625                                                                                           
  4626             select="n1 :observati on/n1:refe renceRange /n1:observ ationRange /n1:text" 
  4627            />
  4628                                                                         
  4629           </xsl:call -template>
  4630                                                                        
  4631           <xsl:if
  4632                                                                                 
  4633            test="stri ng-length( n1:observa tion/n1:re ferenceRan ge/n1:obse rvationRan ge/n1:text )=0"
  4634           >
  4635                                                                                  
  4636            <xsl:text>
  4637             --
  4638            </xsl:text >
  4639                                                                         
  4640           </xsl:if>
  4641                                                               
  4642          </td>
  4643                                                              
  4644          <!-- Statu s -->
  4645                                                              
  4646          <td>
  4647                                                                        
  4648           <xsl:value -of 
  4649            select="n1 :observati on/n1:stat usCode/@co de" 
  4650           />
  4651                                                               
  4652          </td>
  4653                                                              
  4654          <!-- Comme nt -->
  4655                                                              
  4656          <td>
  4657                                                                        
  4658           <xsl:varia ble 
  4659            name="labC ommentRef"
  4660                                                                                 
  4661            select="n1 :observati on/n1:entr yRelations hip/n1:act /n1:text/n 1:referenc e/@value" 
  4662           />
  4663                                                                        
  4664           <xsl:choos e>
  4665                                                                                  
  4666            <xsl:when 
  4667             test="$row /../n1:tex t/n1:conte nt[@ID=$la bCommentRe f]"
  4668            >
  4669                                                                                            
  4670             <xsl:call- template 
  4671              name="flyo verTextSpa n"
  4672             >
  4673                                                                                                     
  4674              <xsl:with- param 
  4675               name="data "
  4676                                                                                                              
  4677               select="$r ow/../n1:t ext/n1:con tent[@ID=$ labComment Ref]" 
  4678              />
  4679                                                                                             
  4680             </xsl:call -template>
  4681                                                                                   
  4682            </xsl:when >
  4683                                                                                  
  4684            <xsl:when
  4685                                                                                           
  4686             test="$row /../n1:tex t/n1:conte nt[@ID=sub string($la bCommentRe f,2)]"
  4687            >
  4688                                                                                            
  4689             <xsl:call- template 
  4690              name="flyo verTextSpa n"
  4691             >
  4692                                                                                                     
  4693              <xsl:with- param 
  4694               name="data "
  4695                                                                                                              
  4696               select="$r ow/../n1:t ext/n1:con tent[@ID=s ubstring($ labComment Ref,2)]" 
  4697              />
  4698                                                                                             
  4699             </xsl:call -template>
  4700                                                                                   
  4701            </xsl:when >
  4702                                                                         
  4703           </xsl:choo se>
  4704          
  4705          
  4706          
  4707                                                               
  4708          </td>
  4709                                                     
  4710         </tr>
  4711                                            
  4712        </xsl:for- each>
  4713       
  4714                                  
  4715       </xsl:when >
  4716                                 
  4717       <xsl:other wise>
  4718                                           
  4719        <xsl:choos e>
  4720                                                    
  4721         <xsl:when
  4722                                                             
  4723          test="stri ng-length( $row/n1:ob servation/ n1:code/@d isplayName )!=0 or $r ow/n1:obse rvation/n1 :text/n1:r eference/@ value"
  4724         >
  4725                                                              
  4726          <tr>
  4727                                                                        
  4728           <!-- Date  -->
  4729                                                                        
  4730           <td>
  4731                                                                                  
  4732            <xsl:choos e>
  4733                                                                                            
  4734             <xsl:when
  4735                                                                                                    
  4736              test="stri ng-length( $row/n1:ob servation/ n1:effecti veTime/@va lue)=0"
  4737             >
  4738                                                                                                     
  4739              <xsl:text>
  4740                Not Avail able 
  4741              </xsl:text >
  4742                                                                                             
  4743             </xsl:when >
  4744                                                                                            
  4745             <xsl:other wise>
  4746                                                                                                     
  4747              <xsl:call- template 
  4748               name="form atDate"
  4749              >
  4750                                                                                                               
  4751               <xsl:with- param 
  4752                name="date "
  4753                                                                                                                        
  4754                select="$r ow/n1:obse rvation/n1 :effective Time/@valu e" 
  4755               />
  4756                                                                                                      
  4757              </xsl:call -template>
  4758                                                                                             
  4759             </xsl:othe rwise>
  4760                                                                                   
  4761            </xsl:choo se>
  4762                                                                         
  4763           </td>
  4764                                                                        
  4765           <!-- Test  -->
  4766                                                                        
  4767           <td>
  4768                                                                                  
  4769            <xsl:choos e>
  4770                                                                                            
  4771             <xsl:when
  4772                                                                                                    
  4773              test="stri ng-length( $row/n1:ob servation/ n1:code/@d isplayName )!=0"
  4774             >
  4775                                                                                                     
  4776              <xsl:value -of 
  4777               select="$r ow/n1:obse rvation/n1 :code/@dis playName" 
  4778              />
  4779                                                                                             
  4780             </xsl:when >
  4781                                                                                            
  4782             <xsl:other wise>
  4783                                                                                                     
  4784              <xsl:varia ble 
  4785               name="labR eference"
  4786                                                                                                              
  4787               select="$r ow/n1:obse rvation/n1 :text/n1:r eference/@ value" 
  4788              />
  4789                                                                                                     
  4790              <!-- <xsl: value-of s elect="../ n1:text/n1 :table/n1: tbody/n1:t r/n1:td/n1 :content[@ ID=$labRef erence]"/>  -->
  4791                                                                                                     
  4792              <xsl:value -of 
  4793               select="$r ow/n1:obse rvation/n1 :code/n1:o riginalTex t" 
  4794              />
  4795                                                                                             
  4796             </xsl:othe rwise>
  4797                                                                                   
  4798            </xsl:choo se>
  4799                                                                         
  4800           </td>
  4801          
  4802          
  4803                                                                        
  4804           <!-- Sourc e -->
  4805                                                                        
  4806           <td>
  4807                                                                                  
  4808            <xsl:value -of
  4809                                                                                           
  4810             select="$r ow/n1:obse rvation/n1 :author/n1 :assignedA uthor/n1:r epresented Organizati on/n1:name
  4811            />
  4812                                                                                  
  4813            <xsl:if
  4814                                                                                           
  4815             test="stri ng-length( $row/n1:ob servation/ n1:author/ n1:assigne dAuthor/n1 :represent edOrganiza tion/n1:na me)=0"
  4816            >
  4817                                                                                            
  4818             <xsl:text>
  4819              --
  4820             </xsl:text >
  4821                                                                                   
  4822            </xsl:if>
  4823                                                                         
  4824           </td>
  4825          
  4826                                                                        
  4827           <!-- Resul t - Unit - ->
  4828                                                                        
  4829           <td>
  4830                                                                                  
  4831            <xsl:choos e>
  4832                                                                                            
  4833             <xsl:when
  4834                                                                                                    
  4835              test="stri ng-length( $row/n1:ob servation/ n1:value/@ value)!=0"
  4836             >
  4837                                                                                                     
  4838              <xsl:value -of 
  4839               select="$r ow/n1:obse rvation/n1 :value/@va lue" 
  4840              />
  4841                                                                                                     
  4842              <xsl:if 
  4843               test="$row /n1:observ ation/n1:v alue/@unit "
  4844              >
  4845                                                                                                               
  4846               <xsl:text>
  4847                 
  4848               </xsl:text >
  4849                                                                                                               
  4850               <xsl:value -of 
  4851                select="$r ow/n1:obse rvation/n1 :value/@un it" 
  4852               />
  4853                                                                                                      
  4854              </xsl:if>
  4855                                                                                             
  4856             </xsl:when >
  4857                                                                                            
  4858             <xsl:other wise>
  4859                                                                                                     
  4860              <xsl:choos e>
  4861                                                                                                               
  4862               <xsl:when
  4863                                                                                                                        
  4864                test="stri ng-length( $row/n1:ob servation/ n1:value/n 1:high/@va lue)!=0"
  4865               >
  4866                                                                                                                         
  4867                <xsl:value -of 
  4868                 select="$r ow/n1:obse rvation/n1 :value/n1: high/@valu e" 
  4869                />
  4870                                                                                                                         
  4871                <xsl:if 
  4872                 test="$row /n1:observ ation/n1:v alue/n1:hi gh/@unit"
  4873                >
  4874                                                                                                                                   
  4875                 <xsl:text>
  4876                   
  4877                 </xsl:text >
  4878                                                                                                                                   
  4879                 <xsl:value -of 
  4880                  select="$r ow/n1:obse rvation/n1 :value/n1: high/@unit
  4881                 />
  4882                                                                                                                          
  4883                </xsl:if>
  4884                                                                                                                
  4885               </xsl:when >
  4886                                                                                                               
  4887               <xsl:other wise>
  4888                                                                                                                         
  4889                <xsl:choos e>
  4890                                                                                                                                   
  4891                 <xsl:when
  4892                                                                                                                                            
  4893                  test="stri ng-length( $row/n1:ob servation/ n1:value/n 1:low/@val ue)!=0"
  4894                 >
  4895                                                                                                                                             
  4896                  <xsl:value -of 
  4897                   select="$r ow/n1:obse rvation/n1 :value/n1: low/@value
  4898                  />
  4899                                                                                                                                             
  4900                  <xsl:if 
  4901                   test="$row /n1:observ ation/n1:v alue/n1:lo w/@unit"
  4902                  >
  4903                                                                                                                                                      
  4904                   <xsl:text>
  4905                     
  4906                   </xsl:text >
  4907                                                                                                                                                      
  4908                   <xsl:value -of 
  4909                    select="$r ow/n1:obse rvation/n1 :value/n1: low/@unit"  
  4910                   />
  4911                                                                                                                                              
  4912                  </xsl:if>
  4913                                                                                                                                    
  4914                 </xsl:when >
  4915                                                                                                                                   
  4916                 <xsl:other wise>
  4917                                                                                                                                             
  4918                  <xsl:choos e>
  4919                                                                                                                                                      
  4920                   <xsl:when
  4921                                                                                                                                                               
  4922                    test="stri ng-length( $row/n1:ob servation/ n1:value)! =0"
  4923                   >
  4924                                                                                                                                                                
  4925                    <xsl:value -of 
  4926                     select="$r ow/n1:obse rvation/n1 :value" 
  4927                    />
  4928                                                                                                                                                       
  4929                   </xsl:when >
  4930                                                                                                                                                      
  4931                   <xsl:other wise>
  4932                                                                                                                                                                
  4933                    <xsl:text>
  4934                     --
  4935                    </xsl:text >
  4936                                                                                                                                                       
  4937                   </xsl:othe rwise>
  4938                                                                                                                                              
  4939                  </xsl:choo se>
  4940                                                                                                                                    
  4941                 </xsl:othe rwise>
  4942                                                                                                                          
  4943                </xsl:choo se>
  4944                                                                                                                
  4945               </xsl:othe rwise>
  4946                                                                                                      
  4947              </xsl:choo se>
  4948                                                                                             
  4949             </xsl:othe rwise>
  4950                                                                                   
  4951            </xsl:choo se>
  4952                                                                         
  4953           </td>
  4954                                                                        
  4955           <!-- Inter pretation  -->
  4956                                                                        
  4957           <td>
  4958                                                                                  
  4959            <xsl:value -of
  4960                                                                                           
  4961             select="$r ow/n1:obse rvation/n1 :interpret ationCode/ n1:origina lText" 
  4962            />
  4963                                                                                  
  4964            <xsl:if
  4965                                                                                           
  4966             test="stri ng-length( $row/n1:ob servation/ n1:interpr etationCod e/n1:origi nalText)=0 "
  4967            >
  4968                                                                                            
  4969             <xsl:value -of
  4970                                                                                                    
  4971              select="$r ow/n1:obse rvation/n1 :interpret ationCode/ @displayNa me" 
  4972             />
  4973                                                                                            
  4974             <xsl:if
  4975                                                                                                    
  4976              test="stri ng-length( $row/n1:ob servation/ n1:interpr etationCod e/@display Name)=0"
  4977             >
  4978                                                                                                     
  4979              <xsl:text>
  4980               --
  4981              </xsl:text >
  4982                                                                                             
  4983             </xsl:if>
  4984                                                                                   
  4985            </xsl:if>
  4986           
  4987                                                                         
  4988           </td>
  4989                                                                        
  4990           <!-- Ref R ange -->
  4991                                                                        
  4992           <td>
  4993                                                                                  
  4994            <xsl:call- template 
  4995             name="flyo verSpan"
  4996            >
  4997                                                                                            
  4998             <xsl:with- param 
  4999              name="data "
  5000                                                                                                    
  5001              select="$r ow/n1:obse rvation/n1 :reference Range/n1:o bservation Range/n1:t ext" 
  5002             />
  5003                                                                                   
  5004            </xsl:call -template>
  5005                                                                                  
  5006            <xsl:if
  5007                                                                                           
  5008             test="stri ng-length( $row/n1:ob servation/ n1:referen ceRange/n1 :observati onRange/n1 :text)=0"
  5009            >
  5010                                                                                            
  5011             <xsl:text>
  5012              --
  5013             </xsl:text >
  5014                                                                                   
  5015            </xsl:if>
  5016                                                                         
  5017           </td>
  5018                                                                        
  5019           <!-- Statu s -->
  5020                                                                        
  5021           <td>
  5022                                                                                  
  5023            <xsl:value -of 
  5024             select="$r ow/n1:obse rvation/n1 :statusCod e/@code" 
  5025            />
  5026                                                                         
  5027           </td>
  5028                                                                        
  5029           <td>
  5030                                                                                  
  5031            <xsl:text>
  5032             --
  5033            </xsl:text >
  5034                                                                         
  5035           </td>
  5036          
  5037                                                               
  5038          </tr>
  5039                                                     
  5040         </xsl:when >
  5041                                            
  5042        </xsl:choo se>
  5043                                  
  5044       </xsl:othe rwise>
  5045                        
  5046      </xsl:choo se>
  5047              
  5048     </xsl:temp late>
  5049             
  5050     <!-- immun ization en try row -B ackup of o riginal te mplate - A nand 07/01 /11 
  5051                      <xsl :template  name="immu nizationsR ow"> <xsl: param name ="row"/> < xsl:variab le 
  5052                      name ="rowData"  select="$ row/n1:sub stanceAdmi nistration /n1:consum able/n1:ma nufactured Product/n1 :manufactu redMateria l"/> 
  5053                      <xsl :variable  name="rowS ubj" selec t="$row/n1 :substance Administra tion/n1:en tryRelatio nship[@typ eCode='SUB J']/n1:obs ervation"/
  5054                      <xsl :variable  name="rowC ause" sele ct="$row/n 1:substanc eAdministr ation/n1:e ntryRelati onship[@ty peCode='CA US']/n1:ob servation" /> 
  5055                      <tr>  <td> <div  style="ov erflow:hid den; white -space:now rap; width :360px;"> 
  5056                      <xsl :variable  name="immR eference"  select="$r owData/n1: code/n1:or iginalText /n1:refere nce/@value "/> 
  5057                      <xsl :choose> < xsl:when t est="../n1 :text/n1:c ontent[@ID =starts-wi th($immRef erence,'#' )]"> 
  5058                      <xsl :value-of  select=".. /n1:text/n 1:content[ @ID=starts -with($imm Reference, '#')]"/> 
  5059                      <xsl :call-temp late name= "flyoverSp an"> <xsl: with-param  name="dat a" select= "../n1:tex t/n1:conte nt[@ID=sub string($im mReference ,2)]"/> 
  5060                      </xs l:call-tem plate> </x sl:when> < xsl:when t est="../n1 :text/n1:c ontent[@ID =$immRefer ence]"> 
  5061                      <xsl :value-of  select=".. /n1:text/n 1:content[ @ID=$immRe ference]"/ > <xsl:cal l-template  
  5062                      name ="flyoverS pan"> <xsl :with-para m name="da ta" select ="../n1:te xt/n1:cont ent[@ID=$i mmReferenc e]"/> 
  5063                      </xs l:call-tem plate> </x sl:when> < /xsl:choos e> <xsl:va lue-of sel ect="../n1 :text/n1:t able/n1:tb ody/n1:tr/ n1:td/n1:c ontent[@ID =$immRefer ence]"/> 
  5064                      </di v> </td> s eries <td>  <div styl e="overflo w:hidden;  white-spac e:nowrap; 
  5065                      widt h:60px;">  <xsl:call- template n ame="flyov erSpan"> < xsl:with-p aram name= "data" 
  5066                      sele ct="$rowSu bj/n1:valu e"/> </xsl :call-temp late> </di v> </td> - ->
  5067             
  5068     <!-- immun ization en try row -- >
  5069             
  5070     <!-- Repla ced origin al immuniz ationsRow  Template -  Anand 07/ 01/11 -->
  5071             
  5072     <xsl:templ ate 
  5073      name="immu nizationsR ow"
  5074     >
  5075                       
  5076      <xsl:param  
  5077       name="row"  
  5078      />
  5079                       
  5080      <xsl:varia ble 
  5081       name="rowD ata"
  5082                                
  5083       select="$r ow/n1:subs tanceAdmin istration/ n1:consuma ble/n1:man ufacturedP roduct/n1: manufactur edMaterial
  5084      />
  5085                       
  5086      <xsl:varia ble 
  5087       name="rowS ubj"
  5088                                
  5089       select="$r ow/n1:subs tanceAdmin istration/ n1:entryRe lationship [@typeCode ='SUBJ']/n 1:observat ion" 
  5090      />
  5091                       
  5092      <xsl:varia ble 
  5093       name="rowC ause"
  5094                                
  5095       select="$r ow/n1:subs tanceAdmin istration/ n1:entryRe lationship [@typeCode ='CAUS']/n 1:observat ion" 
  5096      />
  5097                       
  5098      <tr>
  5099                                 
  5100       <!-- name  -->
  5101                                 
  5102       <td>
  5103                                           
  5104        <xsl:varia ble 
  5105         name="immu nization"
  5106        >
  5107                                                    
  5108         <xsl:call- template 
  5109          name="getI mmunizatio n"
  5110         >
  5111                                                              
  5112          <xsl:with- param 
  5113           name="manu facturedMa terial" 
  5114           select="$r owData" 
  5115          />
  5116                                                     
  5117         </xsl:call -template>
  5118                                            
  5119        </xsl:vari able>
  5120                                           
  5121        <xsl:choos e>
  5122                                                    
  5123         <xsl:when 
  5124          test="stri ng-length( $immunizat ion)>1"
  5125         >
  5126                                                              
  5127          <xsl:call- template 
  5128           name="flyo verSpan"
  5129          >
  5130                                                                        
  5131           <xsl:with- param 
  5132            name="data
  5133            select="$i mmunizatio n" 
  5134           />
  5135                                                               
  5136          </xsl:call -template>
  5137                                                     
  5138         </xsl:when >
  5139                                                    
  5140         <xsl:other wise>
  5141                                                              
  5142          <xsl:call- template 
  5143           name="na" 
  5144          />
  5145                                                     
  5146         </xsl:othe rwise>
  5147                                            
  5148        </xsl:choo se>
  5149                                  
  5150       </td>
  5151                                 
  5152       <!-- serie s -->
  5153                                 
  5154       <td>
  5155                                           
  5156        <xsl:varia ble 
  5157         name="immu nizationSe ries"
  5158        >
  5159                                                    
  5160         <xsl:call- template 
  5161          name="getI mmunizatio nSeries"
  5162         >
  5163                                                              
  5164          <xsl:with- param 
  5165           name="manu facturedMa terial" 
  5166           select="$r owData" 
  5167          />
  5168                                                     
  5169         </xsl:call -template>
  5170                                            
  5171        </xsl:vari able>
  5172                                           
  5173        <xsl:choos e>
  5174                                                    
  5175         <xsl:when 
  5176          test="stri ng-length( $immunizat ionSeries) >1"
  5177         >
  5178                                                              
  5179          <xsl:call- template 
  5180           name="flyo verSpan"
  5181          >
  5182                                                                        
  5183           <xsl:with- param 
  5184            name="data
  5185            select="$i mmunizatio nSeries" 
  5186           />
  5187                                                               
  5188          </xsl:call -template>
  5189                                                     
  5190         </xsl:when >
  5191                                                    
  5192         <xsl:other wise>
  5193                                                              
  5194          <xsl:call- template 
  5195           name="na" 
  5196          />
  5197                                                     
  5198         </xsl:othe rwise>
  5199                                            
  5200        </xsl:choo se>
  5201                                  
  5202       </td>
  5203                                 
  5204       <!-- effec tive date  -->
  5205                                 
  5206       <td>
  5207                                           
  5208        <xsl:choos e>
  5209                                                    
  5210         <xsl:when
  5211                                                             
  5212          test="stri ng-length( $row/n1:su bstanceAdm inistratio n/n1:effec tiveTime/@ value)=0"
  5213         >
  5214                                                              
  5215          <xsl:text>
  5216           -- Not Ava ilable --
  5217          </xsl:text >
  5218                                                     
  5219         </xsl:when >
  5220                                                    
  5221         <xsl:other wise>
  5222                                                              
  5223          <xsl:call- template 
  5224           name="form atDate"
  5225          >
  5226                                                                        
  5227           <xsl:with- param 
  5228            name="date "
  5229                                                                                 
  5230            select="$r ow/n1:subs tanceAdmin istration/ n1:effecti veTime/@va lue" 
  5231           />
  5232                                                               
  5233          </xsl:call -template>
  5234                                                     
  5235         </xsl:othe rwise>
  5236                                            
  5237        </xsl:choo se>
  5238                                  
  5239       </td>
  5240                                 
  5241       <!-- react ion -->
  5242                                 
  5243       <td>
  5244                                           
  5245        <xsl:value -of 
  5246         select="ro wCause/n1: id//@exten sion" 
  5247        />
  5248                                           
  5249        <xsl:varia ble 
  5250         name="reac tionRefere nce" 
  5251         select="$r owCause/n1 :id/@exten sion" 
  5252        />
  5253                                           
  5254        <xsl:varia ble 
  5255         name="reac tion"
  5256                                                   
  5257         select=".. /n1:text/n 1:content[ @ID=$react ionReferen ce]" 
  5258        />
  5259                                           
  5260        <xsl:call- template 
  5261         name="flyo verSpan"
  5262        >
  5263                                                    
  5264         <xsl:with- param 
  5265          name="data
  5266          select="$r eaction" 
  5267         />
  5268                                            
  5269        </xsl:call -template>
  5270                                  
  5271       </td>
  5272                                 
  5273       <!-- comme nts -->
  5274                                 
  5275       <td>
  5276                                           
  5277        <xsl:varia ble 
  5278         name="comm entReferen ce"
  5279                                                   
  5280         select="$r ow/n1:subs tanceAdmin istration/ n1:text/n1 :reference /@value" 
  5281        />
  5282       
  5283                                           
  5284        <xsl:choos e>
  5285                                                    
  5286         <xsl:when 
  5287          test="../n 1:text/n1: content[@I D=$comment Reference] "
  5288         >
  5289                                                              
  5290          <xsl:call- template 
  5291           name="flyo verSpan"
  5292          >
  5293                                                                        
  5294           <xsl:with- param 
  5295            name="data "
  5296                                                                                 
  5297            select=".. /n1:text/n 1:content[ @ID=$comme ntReferenc e]" 
  5298           />
  5299                                                               
  5300          </xsl:call -template>
  5301                                                     
  5302         </xsl:when >
  5303                                                    
  5304         <xsl:when
  5305                                                             
  5306          test="../n 1:text/n1: content[@I D=substrin g($comment Reference, 2)]"
  5307         >
  5308                                                              
  5309          <xsl:call- template 
  5310           name="flyo verSpan"
  5311          >
  5312                                                                        
  5313           <xsl:with- param 
  5314            name="data "
  5315                                                                                 
  5316            select=".. /n1:text/n 1:content[ @ID=substr ing($comme ntReferenc e,2)]" 
  5317           />
  5318                                                               
  5319          </xsl:call -template>
  5320                                                     
  5321         </xsl:when >
  5322                                            
  5323        </xsl:choo se>
  5324                                  
  5325       </td>
  5326                        
  5327      </tr>
  5328              
  5329     </xsl:temp late>
  5330    
  5331             
  5332     <!-- vital s entry ro w -->
  5333             
  5334     <xsl:templ ate 
  5335      name="vita lsRow"
  5336     >
  5337                       
  5338      <xsl:param  
  5339       name="row"  
  5340      />
  5341                       
  5342      <xsl:varia ble 
  5343       name="rowD ata"
  5344                                
  5345       select="$r ow/n1:orga nizer/n1:c omponent/n 1:observat ion" 
  5346      />
  5347                       
  5348      <xsl:varia ble 
  5349       name="heig ht"
  5350                                
  5351       select="$r ow/n1:orga nizer/n1:c omponent/n 1:observat ion/n1:cod e[@code='8 302-2']/..
  5352      />
  5353                       
  5354      <xsl:varia ble 
  5355       name="weig ht"
  5356                                
  5357       select="$r ow/n1:orga nizer/n1:c omponent/n 1:observat ion/n1:cod e[@code='2 9463-7']/. ." 
  5358      />
  5359                       
  5360      <xsl:varia ble 
  5361       name="weig ht1"
  5362                                
  5363       select="$r ow/n1:orga nizer/n1:c omponent/n 1:observat ion/n1:cod e[@code='3 141-9']/..
  5364      />
  5365                       
  5366      <xsl:varia ble 
  5367       name="syst olic"
  5368                                
  5369       select="$r ow/n1:orga nizer/n1:c omponent/n 1:observat ion/n1:cod e[@code='8 480-6']/..
  5370      />
  5371                       
  5372      <xsl:varia ble 
  5373       name="dias tolic"
  5374                                
  5375       select="$r ow/n1:orga nizer/n1:c omponent/n 1:observat ion/n1:cod e[@code='8 462-4']/..
  5376      />
  5377                       
  5378      <xsl:varia ble 
  5379       name="temp "
  5380                                
  5381       select="$r ow/n1:orga nizer/n1:c omponent/n 1:observat ion/n1:cod e[@code='8 310-5']/..
  5382      />
  5383                       
  5384      <xsl:varia ble 
  5385       name="puls e"
  5386                                
  5387       select="$r ow/n1:orga nizer/n1:c omponent/n 1:observat ion/n1:cod e[@code='8 867-4']/..
  5388      />
  5389                       
  5390      <xsl:varia ble 
  5391       name="resp "
  5392                                
  5393       select="$r ow/n1:orga nizer/n1:c omponent/n 1:observat ion/n1:cod e[@code='9 279-1']/..
  5394      />
  5395                       
  5396      <xsl:varia ble 
  5397       name="pox"
  5398                                
  5399       select="$r ow/n1:orga nizer/n1:c omponent/n 1:observat ion/n1:cod e[@code='2 710-2']/..
  5400      />
  5401                       
  5402      <tr>
  5403                                 
  5404       <!-- obser vation tex t -->
  5405                                 
  5406       <!-- probl em effecti ve date -- >
  5407                                 
  5408       <td>
  5409                                           
  5410        <xsl:choos e>
  5411                                                    
  5412         <xsl:when 
  5413          test="stri ng-length( $rowData/n 1:effectiv eTime/@val ue)=0"
  5414         >
  5415                                                              
  5416          <xsl:text>
  5417           -- Not Ava ilable --
  5418          </xsl:text >
  5419                                                     
  5420         </xsl:when >
  5421                                                    
  5422         <xsl:other wise>
  5423                                                              
  5424          <xsl:call- template 
  5425           name="form atDate"
  5426          >
  5427                                                                        
  5428           <xsl:with- param 
  5429            name="date "
  5430                                                                                 
  5431            select="$r owData/n1: effectiveT ime/@value
  5432           />
  5433                                                               
  5434          </xsl:call -template>
  5435                                                     
  5436         </xsl:othe rwise>
  5437                                            
  5438        </xsl:choo se>
  5439                                  
  5440       </td>
  5441                                 
  5442       <!-- temp  -->
  5443                                 
  5444       <td>
  5445                                           
  5446        <xsl:value -of 
  5447         select="$t emp/n1:val ue/@value"  
  5448        />
  5449                                           
  5450        <xsl:value -of 
  5451         select="$t emp/n1:val ue/@unit" 
  5452        />
  5453                                  
  5454       </td>
  5455                                 
  5456       <!-- pulse  -->
  5457                                 
  5458       <td>
  5459                                           
  5460        <xsl:value -of 
  5461         select="$p ulse/n1:va lue/@value
  5462        />
  5463                                  
  5464       </td>
  5465                                 
  5466       <!-- resp  -->
  5467                                 
  5468       <td>
  5469                                           
  5470        <xsl:value -of 
  5471         select="$r esp/n1:val ue/@value"  
  5472        />
  5473                                  
  5474       </td>
  5475                                 
  5476       <!-- BP sy stolic / d iastolic - ->
  5477                                 
  5478       <td>
  5479                                           
  5480        <xsl:value -of 
  5481         select="$s ystolic/n1 :value/@va lue" 
  5482        />
  5483                                           /
  5484                                           
  5485        <xsl:value -of 
  5486         select="$d iastolic/n 1:value/@v alue" 
  5487        />
  5488                                  
  5489       </td>
  5490                                 
  5491       <!-- heigh t -->
  5492                                 
  5493       <td>
  5494                                           
  5495        <xsl:value -of 
  5496         select="$h eight/n1:v alue/@valu e" 
  5497        />
  5498                                           
  5499        <xsl:value -of 
  5500         select="$h eight/n1:v alue/@unit
  5501        />
  5502                                  
  5503       </td>
  5504                                 
  5505       <!-- weigh t -->
  5506                                 
  5507       <td>
  5508                                           
  5509        <xsl:if 
  5510         test="$wei ght"
  5511        >
  5512                                                    
  5513         <xsl:value -of 
  5514          select="$w eight/n1:v alue/@valu e" 
  5515         />
  5516                                                    
  5517         <xsl:value -of 
  5518          select="$w eight/n1:v alue/@unit
  5519         />
  5520                                            
  5521        </xsl:if>
  5522                                           
  5523        <xsl:if 
  5524         test="$wei ght1"
  5525        >
  5526                                                    
  5527         <xsl:value -of 
  5528          select="$w eight1/n1: value/@val ue" 
  5529         />
  5530                                                    
  5531         <xsl:value -of 
  5532          select="$w eight1/n1: value/@uni t" 
  5533         />
  5534                                            
  5535        </xsl:if>
  5536                                  
  5537       </td>
  5538                                 
  5539       <!-- pox - ->
  5540                                 
  5541       <td>
  5542                                           
  5543        <xsl:value -of 
  5544         select="$p ox/n1:valu e/@value" 
  5545        />
  5546                                  
  5547       </td>
  5548                                 
  5549       <!-- sourc e -->
  5550                                 
  5551       <td>
  5552                                           
  5553        <xsl:value -of
  5554                                                   
  5555         select="$r ow/n1:orga nizer/n1:a uthor/n1:a ssignedAut hor/n1:rep resentedOr ganization /n1:name" 
  5556        />
  5557                                  
  5558       </td>
  5559                        
  5560      </tr>
  5561              
  5562     </xsl:temp late>
  5563    
  5564             
  5565     <!-- flyov er -->
  5566             
  5567     <xsl:templ ate 
  5568      name="flyo verSpan"
  5569     >
  5570                       
  5571      <xsl:param  
  5572       name="data
  5573      />
  5574                       
  5575      <xsl:choos e>
  5576                                 
  5577       <xsl:when 
  5578        test="$dat a"
  5579       >
  5580                                           
  5581        <span 
  5582         onmouseove r='Display Tip(this,2 5,-50)'
  5583        >
  5584                                                    
  5585         <xsl:value -of 
  5586          select="$d ata" 
  5587         />
  5588                                            
  5589        </span>
  5590                                  
  5591       </xsl:when >
  5592                                 
  5593       <xsl:other wise>
  5594                                           
  5595        <xsl:call- template 
  5596         name="na" 
  5597        />
  5598                                  
  5599       </xsl:othe rwise>
  5600                        
  5601      </xsl:choo se>
  5602              
  5603     </xsl:temp late>
  5604    
  5605             
  5606     <!-- flyov er Free Te xt -->
  5607             
  5608     <xsl:templ ate 
  5609      name="flyo verTextSpa n"
  5610     >
  5611                       
  5612      <xsl:param  
  5613       name="data
  5614      />
  5615                       
  5616      <xsl:choos e>
  5617                                 
  5618       <xsl:when 
  5619        test="$dat a"
  5620       >
  5621                                           
  5622        <span 
  5623         onmouseove r='Display Text(this, 25,-50)'
  5624        >
  5625                                                    
  5626         <xsl:value -of 
  5627          select="$d ata" 
  5628         />
  5629                                            
  5630        </span>
  5631                                  
  5632       </xsl:when >
  5633                                 
  5634       <xsl:other wise>
  5635                                           
  5636        <xsl:call- template 
  5637         name="na" 
  5638        />
  5639                                  
  5640       </xsl:othe rwise>
  5641                        
  5642      </xsl:choo se>
  5643              
  5644     </xsl:temp late>
  5645    
  5646    
  5647             
  5648     <!-- Title  -->
  5649             
  5650     <xsl:templ ate 
  5651      match="n1: title"
  5652     >
  5653                       
  5654      <h3>
  5655                                 
  5656       <span 
  5657        style="fon t-weight:b old;"
  5658       >
  5659                                           
  5660        <a 
  5661         name="{gen erate-id(. )}" 
  5662         href="#toc "
  5663        >
  5664                                                    
  5665         <xsl:value -of 
  5666          select="."  
  5667         />
  5668                                            
  5669        </a>
  5670                                  
  5671       </span>
  5672                        
  5673      </h3>
  5674              
  5675     </xsl:temp late>
  5676    
  5677             
  5678     <!-- Text  -->
  5679             
  5680     <xsl:templ ate 
  5681      match="n1: text"
  5682     >
  5683                       
  5684      <xsl:apply -templates  />
  5685              
  5686     </xsl:temp late>
  5687    
  5688             
  5689     <!-- Botto mline -->
  5690    
  5691             
  5692     <xsl:templ ate 
  5693      name="bott omline"
  5694     >
  5695                       
  5696      <p>
  5697                                 
  5698       <b>
  5699                                           
  5700        <xsl:text>
  5701         Electronic ally gener ated: 
  5702        </xsl:text >
  5703                                  
  5704       </b>
  5705                                 
  5706       <xsl:call- template 
  5707        name="getN ame"
  5708       >
  5709                                           
  5710        <xsl:with- param 
  5711         name="name "
  5712                                                   
  5713         select="/n 1:Clinical Document/n 1:legalAut henticator /n1:assign edEntity/n 1:represen tedOrganiz ation/n1:n ame" 
  5714        />
  5715                                  
  5716       </xsl:call -template>
  5717                                 
  5718       <xsl:text>
  5719         on 
  5720       </xsl:text >
  5721                                 
  5722       <xsl:choos e>
  5723                                           
  5724        <xsl:when
  5725                                                   
  5726         test="stri ng-length( /n1:Clinic alDocument /n1:effect iveTime/@v alue)=0"
  5727        >
  5728                                                    
  5729         <xsl:call- template 
  5730          name="na" 
  5731         />
  5732                                            
  5733        </xsl:when >
  5734                                           
  5735        <xsl:when
  5736                                                   
  5737         test="star ts-with(/n 1:Clinical Document/n 1:effectiv eTime/@val ue,' ')"
  5738        >
  5739                                                    
  5740         <xsl:call- template 
  5741          name="na" 
  5742         />
  5743                                            
  5744        </xsl:when >
  5745                                           
  5746        <xsl:other wise>
  5747                                                    
  5748         <xsl:call- template 
  5749          name="form atDateFull "
  5750         >
  5751                                                              
  5752          <xsl:with- param 
  5753           name="date "
  5754                                                                       
  5755           select="/n 1:Clinical Document/n 1:effectiv eTime/@val ue" 
  5756          />
  5757                                                     
  5758         </xsl:call -template>
  5759                                            
  5760        </xsl:othe rwise>
  5761                                  
  5762       </xsl:choo se>
  5763      
  5764                        
  5765      </p>
  5766              
  5767     </xsl:temp late>
  5768    
  5769             
  5770     <xsl:templ ate
  5771                      
  5772      match="n1: component/ n1:section [n1:templa teId/@root ='2.16.840 .1.113883. IP          ']/n1:text /n1:table/ n1:tbody"
  5773     >
  5774                       
  5775      <xsl:apply -templates >
  5776                                 
  5777       <xsl:sort 
  5778        select="n1 :td[3]" 
  5779        order="des cending" 
  5780       />
  5781                        
  5782      </xsl:appl y-template s>
  5783              
  5784     </xsl:temp late>
  5785    
  5786             
  5787     <xsl:templ ate
  5788                      
  5789      match="n1: component/ n1:section [n1:templa teId/@root ='2.16.840 .1.113883. IP         ']/n1:text /n1:table/ n1:tbody"
  5790     >
  5791                       
  5792      <xsl:apply -templates >
  5793                                 
  5794       <xsl:sort 
  5795        select="n1 :td[5]" 
  5796        order="des cending" 
  5797       />
  5798                        
  5799      </xsl:appl y-template s>
  5800              
  5801     </xsl:temp late>
  5802    
  5803             
  5804     <xsl:templ ate
  5805                      
  5806      match="n1: component/ n1:section [n1:templa teId/@root ='2.16.840 .1.113883. IP          ' or n1:te mplateId/@ root='2.16 .840.1.113 883. IP          ' or n1:te mplateId/@ root='2.16 .840.1.113 883. IP         ' or n1:te mplateId/@ root='2.16 .840.1.113 883. IP         ']/n1:text /n1:table/ n1:tbody"
  5807     >
  5808                       
  5809      <xsl:apply -templates >
  5810                                 
  5811       <xsl:sort 
  5812        select="n1 :td[2]" 
  5813        order="des cending" 
  5814       />
  5815                        
  5816      </xsl:appl y-template s>
  5817              
  5818     </xsl:temp late>
  5819    
  5820             
  5821     <xsl:templ ate
  5822                      
  5823      match="n1: component/ n1:section [n1:templa teId/@root ='2.16.840 .1.113883. IP          ']/n1:text /n1:table/ n1:tbody/n 1:tr/n1:td [3]"
  5824     >
  5825                       
  5826      <td>
  5827                                 
  5828       <xsl:call- template 
  5829        name="form atDate"
  5830       >
  5831                                           
  5832        <xsl:with- param 
  5833         name="date
  5834         select="te xt()" 
  5835        />
  5836                                  
  5837       </xsl:call -template>
  5838                        
  5839      </td>
  5840              
  5841     </xsl:temp late>
  5842    
  5843             
  5844     <xsl:templ ate
  5845                      
  5846      match="n1: component/ n1:section [n1:templa teId/@root ='2.16.840 .1.113883. IP         ']/n1:text /n1:table/ n1:tbody/n 1:tr/n1:td [5]"
  5847     >
  5848                       
  5849      <td>
  5850                                 
  5851       <xsl:call- template 
  5852        name="form atDate"
  5853       >
  5854                                           
  5855        <xsl:with- param 
  5856         name="date
  5857         select="te xt()" 
  5858        />
  5859                                  
  5860       </xsl:call -template>
  5861                        
  5862      </td>
  5863              
  5864     </xsl:temp late>
  5865    
  5866             
  5867     <xsl:templ ate
  5868                      
  5869      match="n1: component/ n1:section [n1:templa teId/@root ='2.16.840 .1.113883. IP          ' or n1:te mplateId/@ root='2.16 .840.1.113 883. IP          ' or n1:te mplateId/@ root='2.16 .840.1.113 883. IP         ' or n1:te mplateId/@ root='2.16 .840.1.113 883. IP         ']/n1:text /n1:table/ n1:tbody/n 1:tr/n1:td [2]"
  5870     >
  5871                       
  5872      <td>
  5873                                 
  5874       <xsl:call- template 
  5875        name="form atDate"
  5876       >
  5877                                           
  5878        <xsl:with- param 
  5879         name="date "
  5880                                                   
  5881         select="co ncat(subst ring(text( ),1,4),sub string(tex t(),6,2),s ubstring(t ext(),9,2) )" 
  5882        />
  5883                                  
  5884       </xsl:call -template>
  5885                        
  5886      </td>
  5887              
  5888     </xsl:temp late>
  5889    
  5890             
  5891     <xsl:templ ate 
  5892      match="n1: languageCo mmunicatio n"
  5893     >
  5894                       
  5895      <xsl:varia ble 
  5896       name="lang Code" 
  5897       select="su bstring(n1 :languageC ode/@code, 1,2)" 
  5898      />
  5899                       
  5900      <xsl:choos e>
  5901                                 
  5902       <xsl:when 
  5903        test="stri ng-length( $langCode) =0"
  5904       >
  5905                                  
  5906       </xsl:when >
  5907                                 
  5908       <xsl:when 
  5909        test="$lan gCode='en' "
  5910       >
  5911                                           
  5912        <li>
  5913                                                    
  5914         <xsl:text>
  5915          English
  5916         </xsl:text >
  5917                                            
  5918        </li>
  5919                                  
  5920       </xsl:when >
  5921                                 
  5922       <xsl:when 
  5923        test="$lan gCode='es' "
  5924       >
  5925                                           
  5926        <li>
  5927                                                    
  5928         <xsl:text>
  5929          Spanish
  5930         </xsl:text >
  5931                                            
  5932        </li>
  5933                                  
  5934       </xsl:when >
  5935                                 
  5936       <xsl:other wise>
  5937                                           
  5938        <li>
  5939                                                    
  5940         <xsl:value -of 
  5941          select="n1 :languageC ode/@code"  
  5942         />
  5943                                            
  5944        </li>
  5945                                  
  5946       </xsl:othe rwise>
  5947                        
  5948      </xsl:choo se>
  5949              
  5950     </xsl:temp late>
  5951    
  5952             
  5953     <xsl:templ ate 
  5954      name="docu mentTitle"
  5955     >
  5956                       
  5957      <xsl:param  
  5958       name="root
  5959      />
  5960     
  5961                       
  5962      <xsl:choos e>
  5963                                 
  5964       <xsl:when
  5965                                          
  5966        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"
  5967       >
  5968                                           
  5969        <xsl:value -of
  5970                                                   
  5971         select="$r oot/n1:cus todian/n1: assignedCu stodian/n1 :represent edCustodia nOrganizat ion/n1:nam e" 
  5972        />
  5973                                  
  5974       </xsl:when >
  5975                                 
  5976       <xsl:other wise>
  5977                                           
  5978        <xsl:value -of
  5979                                                   
  5980         select="$r oot/n1:aut hor[1]/n1: assignedAu thor/n1:re presentedO rganizatio n/n1:name"  
  5981        />
  5982                                  
  5983       </xsl:othe rwise>
  5984                        
  5985      </xsl:choo se>
  5986     
  5987              
  5988     </xsl:temp late>
  5989    
  5990             
  5991     <!-- free  text proce ssing -->
  5992    
  5993             
  5994     <xsl:templ ate 
  5995      name="free Text"
  5996     >
  5997                       
  5998      <xsl:param  
  5999       name="text
  6000      />
  6001     
  6002              
  6003     </xsl:temp late>
  6004    
  6005    
  6006             
  6007     <xsl:templ ate 
  6008      name="getM edName"
  6009     >
  6010                       
  6011      <xsl:param  
  6012       name="subs tanceAdmin
  6013      />
  6014                       
  6015      <xsl:varia ble 
  6016       name="ref1 "
  6017                                
  6018       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" 
  6019      />
  6020                       
  6021      <xsl:if 
  6022       test="$sub stanceAdmi n"
  6023      >
  6024                                 
  6025       <xsl:choos e>
  6026                                           
  6027        <xsl:when 
  6028         test="../n 1:text/n1: list/n1:it em/n1:cont ent[@ID=$r ef1]"
  6029        >
  6030                                                    
  6031         <xsl:value -of
  6032                                                             
  6033          select="$r ow/../n1:t ext/n1:lis t/n1:item/ n1:content [@ID=$ref1 ]" 
  6034         />
  6035                                            
  6036        </xsl:when >
  6037                                           
  6038        <xsl:when 
  6039         test="../n 1:text/n1: content[@I D=substrin g-after($r ef1,'#')]"
  6040        >
  6041                                                    
  6042         <xsl:value -of
  6043                                                             
  6044          select=".. /n1:text/n 1:content[ @ID=substr ing-after( $ref1,'#') ]" 
  6045         />
  6046                                            
  6047        </xsl:when >
  6048                                           
  6049        <xsl:when
  6050                                                   
  6051         test="$sub stanceAdmi n/n1:consu mable/n1:m anufacture dProduct/n 1:manufact uredMateri al/n1:code /n1:origin alText"
  6052        >
  6053                                                    
  6054         <xsl:value -of
  6055                                                             
  6056          select="$s ubstanceAd min/n1:con sumable/n1 :manufactu redProduct /n1:manufa cturedMate rial/n1:co de/n1:orig inalText" 
  6057         />
  6058                                            
  6059        </xsl:when >
  6060                                           
  6061        <xsl:when
  6062                                                   
  6063         test="$sub stanceAdmi n/n1:consu mable/n1:m anufacture dProduct/n 1:manufact uredMateri al/n1:code /@displayN ame"
  6064        >
  6065                                                    
  6066         <xsl:value -of
  6067                                                             
  6068          select="$s ubstanceAd min/n1:con sumable/n1 :manufactu redProduct /n1:manufa cturedMate rial/n1:co de/@displa yName" 
  6069         />
  6070                                            
  6071        </xsl:when >
  6072                                           
  6073        <xsl:other wise>
  6074                                                    
  6075         <xsl:value -of
  6076                                                             
  6077          select="$s ubstanceAd min/n1:con sumable/n1 :manufactu redProduct /n1:manufa cturedMate rial/n1:na me" 
  6078         />
  6079                                            
  6080        </xsl:othe rwise>
  6081                                  
  6082       </xsl:choo se>
  6083                        
  6084      </xsl:if>
  6085              
  6086     </xsl:temp late>
  6087    
  6088             
  6089     <xsl:templ ate 
  6090      name="medS tatus"
  6091     >
  6092                       
  6093      <xsl:param  
  6094       name="subs tanceAdmin
  6095      />
  6096                       
  6097      <xsl:varia ble 
  6098       name="stat us"
  6099      >
  6100                                 
  6101       <xsl:call- template 
  6102        name="getM edStatusSt ring"
  6103       >
  6104                                           
  6105        <xsl:with- param 
  6106         name="subs tanceAdmin
  6107         select="$s ubstanceAd min" 
  6108        />
  6109                                  
  6110       </xsl:call -template>
  6111                        
  6112      </xsl:vari able>
  6113                       
  6114      <xsl:choos e>
  6115                                 
  6116       <xsl:when 
  6117        test="stri ng-length( $status)&g t;0"
  6118       >
  6119                                           
  6120        <xsl:value -of 
  6121         select="$s tatus" 
  6122        />
  6123                                  
  6124       </xsl:when >
  6125                                 
  6126       <xsl:other wise>
  6127                                           
  6128        <xsl:call- template 
  6129         name="na" 
  6130        />
  6131                                  
  6132       </xsl:othe rwise>
  6133                        
  6134      </xsl:choo se>
  6135              
  6136     </xsl:temp late>
  6137    
  6138             
  6139     <xsl:templ ate 
  6140      name="medQ uantity"
  6141     >
  6142                       
  6143      <xsl:param  
  6144       name="subs tanceAdmin
  6145      />
  6146                       
  6147      <xsl:varia ble 
  6148       name="qtyS tring"
  6149      >
  6150                                 
  6151       <xsl:call- template 
  6152        name="getM edQuantity String"
  6153       >
  6154                                           
  6155        <xsl:with- param 
  6156         name="subs tanceAdmin
  6157         select="$s ubstanceAd min" 
  6158        />
  6159                                  
  6160       </xsl:call -template>
  6161                        
  6162      </xsl:vari able>
  6163                       
  6164      <xsl:choos e>
  6165                                 
  6166       <xsl:when 
  6167        test="stri ng-length( $qtyString )>0"
  6168       >
  6169                                           
  6170        <xsl:value -of 
  6171         select="$q tyString" 
  6172        />
  6173                                  
  6174       </xsl:when >
  6175                                 
  6176       <xsl:other wise>
  6177                                           
  6178        <xsl:call- template 
  6179         name="na" 
  6180        />
  6181                                  
  6182       </xsl:othe rwise>
  6183                        
  6184      </xsl:choo se>
  6185              
  6186     </xsl:temp late>
  6187    
  6188             
  6189     <xsl:templ ate 
  6190      name="medB egintime"
  6191     >
  6192                       
  6193      <xsl:param  
  6194       name="row"  
  6195      />
  6196                       
  6197      <xsl:varia ble 
  6198       name="medB eginString "
  6199      >
  6200                                 
  6201       <xsl:call- template 
  6202        name="medD ateBeginSt ring"
  6203       >
  6204                                           
  6205        <xsl:with- param 
  6206         name="subs tanceAdmin "
  6207                                                   
  6208         select="$r ow/n1:subs tanceAdmin istration"  
  6209        />
  6210                                  
  6211       </xsl:call -template>
  6212                        
  6213      </xsl:vari able>
  6214                       
  6215      <xsl:choos e>
  6216                                 
  6217       <xsl:when 
  6218        test="stri ng-length( $medBeginS tring)&gt; 1"
  6219       >
  6220                                           
  6221        <xsl:call- template 
  6222         name="form atDate"
  6223        >
  6224                                                    
  6225         <xsl:with- param 
  6226          name="date
  6227          select="$m edBeginStr ing" 
  6228         />
  6229                                            
  6230        </xsl:call -template>
  6231                                  
  6232       </xsl:when >
  6233                                 
  6234       <xsl:other wise>
  6235                                           
  6236        <xsl:call- template 
  6237         name="na" 
  6238        />
  6239                                  
  6240       </xsl:othe rwise>
  6241                        
  6242      </xsl:choo se>
  6243              
  6244     </xsl:temp late>
  6245    
  6246             
  6247     <xsl:templ ate 
  6248      name="medE xpiretime"
  6249     >
  6250                       
  6251      <xsl:param  
  6252       name="subs tanceAdmin
  6253      />
  6254                       
  6255      <xsl:varia ble 
  6256       name="medE xpireStrin g"
  6257      >
  6258                                 
  6259       <xsl:call- template 
  6260        name="medE xpireDateS tring"
  6261       >
  6262                                           
  6263        <xsl:with- param 
  6264         name="subs tanceAdmin
  6265         select="$s ubstanceAd min" 
  6266        />
  6267                                  
  6268       </xsl:call -template>
  6269                        
  6270      </xsl:vari able>
  6271                       
  6272      <xsl:choos e>
  6273                                 
  6274       <xsl:when 
  6275        test="stri ng-length( $medExpire String)>1"
  6276       >
  6277                                           
  6278        <xsl:call- template 
  6279         name="form atDate"
  6280        >
  6281                                                    
  6282         <xsl:with- param 
  6283          name="date
  6284          select="$m edExpireSt ring" 
  6285         />
  6286                                            
  6287        </xsl:call -template>
  6288                                  
  6289       </xsl:when >
  6290                                 
  6291       <xsl:other wise>
  6292                                           
  6293        <xsl:call- template 
  6294         name="na" 
  6295        />
  6296                                  
  6297       </xsl:othe rwise>
  6298                        
  6299      </xsl:choo se>
  6300              
  6301     </xsl:temp late>
  6302    
  6303             
  6304     <xsl:templ ate 
  6305      name="prob Name"
  6306     >
  6307                       
  6308      <xsl:param  
  6309       name="ref"  
  6310      />
  6311                       
  6312      <xsl:param  
  6313       name="rowD ata" 
  6314      />
  6315                       
  6316      <xsl:varia ble 
  6317       name="prob Reference1
  6318       select="$r ef/@value"  
  6319      />
  6320                       
  6321      <!--<xsl:v ariable na me="probRe ference2"  select="$r ef/@value" /> -->
  6322                       
  6323      <xsl:choos e>
  6324                                 
  6325       <xsl:when 
  6326        test="../n 1:text/n1: paragraph[ @ID=$probR eference1] "
  6327       >
  6328                                           
  6329        <xsl:value -of 
  6330         select=".. /n1:text/n 1:paragrap h[@ID=$pro bReference 1]" 
  6331        />
  6332                                  
  6333       </xsl:when >
  6334      
  6335                                 
  6336       <xsl:when
  6337                                          
  6338        test="../n 1:text/n1: paragraph[ @ID=substr ing-after( $probRefer ence1,'#') ]"
  6339       >
  6340                                           
  6341        <xsl:value -of
  6342                                                   
  6343         select=".. /n1:text/n 1:paragrap h[@ID=subs tring-afte r($probRef erence1,'# ')]" 
  6344        />
  6345                                  
  6346       </xsl:when >
  6347      
  6348                                 
  6349       <!--DoD -- >
  6350                                 
  6351       <xsl:when
  6352                                          
  6353        test="../n 1:text/n1: table/n1:t body/n1:tr /n1:td/n1: content[@I D=substrin g-after($p robReferen ce1,'#')]"
  6354       >
  6355                                           
  6356        <xsl:value -of
  6357                                                   
  6358         select=".. /n1:text/n 1:table/n1 :tbody/n1: tr/n1:td/n 1:content[ @ID=substr ing-after( $probRefer ence1,'#') ]" 
  6359        />
  6360                                  
  6361       </xsl:when >
  6362      
  6363                                 
  6364       <xsl:when
  6365                                          
  6366        test="../n 1:text/n1: table/n1:t body/n1:tr /n1:td[@ID =substring -after($pr obReferenc e1,'#')]"
  6367       >
  6368                                           
  6369        <xsl:value -of
  6370                                                   
  6371         select=".. /n1:text/n 1:table/n1 :tbody/n1: tr/n1:td[@ ID=substri ng-after($ probRefere nce1,'#')]
  6372        />
  6373                                  
  6374       </xsl:when >
  6375      
  6376                                 
  6377       <xsl:when 
  6378        test="../n 1:text/n1: content[@I D=$probRef erence1]"
  6379       >
  6380                                           
  6381        <xsl:value -of 
  6382         select=".. /n1:text/n 1:content[ @ID=$probR eference1]
  6383        />
  6384                                  
  6385       </xsl:when >
  6386                                 
  6387       <xsl:when
  6388                                          
  6389        test="../n 1:text/n1: content[@I D=substrin g-after($p robReferen ce1,'#')]"
  6390       >
  6391                                           
  6392        <xsl:value -of
  6393                                                   
  6394         select=".. /n1:text/n 1:content[ @ID=substr ing-after( $probRefer ence1,'#') ]" 
  6395        />
  6396                                  
  6397       </xsl:when >
  6398                                 
  6399       <xsl:other wise>
  6400                                           
  6401        <xsl:call- template 
  6402         name="na" 
  6403        />
  6404                                  
  6405       </xsl:othe rwise>
  6406                        
  6407      </xsl:choo se>
  6408              
  6409     </xsl:temp late>
  6410    
  6411             
  6412     <xsl:templ ate 
  6413      name="prob Status"
  6414     >
  6415                       
  6416      <xsl:param  
  6417       name="row"  
  6418      />
  6419                       
  6420      <xsl:choos e>
  6421                                 
  6422       <xsl:when
  6423                                          
  6424        test="$row /n1:act/n1 :entryRela tionship[@ typeCode=' SUBJ']/n1: observatio n/n1:entry Relationsh ip[@typeCo de='REFR'] /n1:observ ation/n1:v alue/@disp layName"
  6425       >
  6426                                           
  6427        <xsl:value -of
  6428                                                   
  6429         select="$r ow/n1:act/ n1:entryRe lationship [@typeCode ='SUBJ']/n 1:observat ion/n1:ent ryRelation ship[@type Code='REFR ']/n1:obse rvation/n1 :value/@di splayName"  
  6430        />
  6431                                  
  6432       </xsl:when >
  6433                                 
  6434       <xsl:when
  6435                                          
  6436        test="$row /n1:act/n1 :entryRela tionship[@ typeCode=' REFR']/n1: observatio n/n1:value /@displayN ame"
  6437       >
  6438                                           
  6439        <xsl:value -of
  6440                                                   
  6441         select="$r ow/n1:act/ n1:entryRe lationship [@typeCode ='REFR']/n 1:observat ion/n1:val ue/@displa yName" 
  6442        />
  6443                                  
  6444       </xsl:when >
  6445                                 
  6446       <xsl:other wise>
  6447                                           
  6448        <xsl:call- template 
  6449         name="na" 
  6450        />
  6451                                  
  6452       </xsl:othe rwise>
  6453                        
  6454      </xsl:choo se>
  6455              
  6456     </xsl:temp late>
  6457    
  6458             
  6459     <xsl:templ ate 
  6460      name="prob Date"
  6461     >
  6462                       
  6463      <xsl:param  
  6464       name="row"  
  6465      />
  6466                       
  6467      <xsl:varia ble 
  6468       name="rawD ate"
  6469      >
  6470                                 
  6471       <xsl:call- template 
  6472        name="getP roblemOnse tDateStrin g"
  6473       >
  6474                                           
  6475        <xsl:with- param 
  6476         name="act"  
  6477         select="$r ow/n1:act"  
  6478        />
  6479                                  
  6480       </xsl:call -template>
  6481                        
  6482      </xsl:vari able>
  6483                       
  6484      <xsl:choos e>
  6485                                 
  6486       <xsl:when 
  6487        test="stri ng-length( $rawDate)> 1"
  6488       >
  6489                                           
  6490        <xsl:call- template 
  6491         name="form atDate"
  6492        >
  6493                                                    
  6494         <xsl:with- param 
  6495          name="date
  6496          select="$r awDate" 
  6497         />
  6498                                            
  6499        </xsl:call -template>
  6500                                  
  6501       </xsl:when >
  6502                                 
  6503       <xsl:other wise>
  6504                                           
  6505        <xsl:call- template 
  6506         name="na" 
  6507        />
  6508                                  
  6509       </xsl:othe rwise>
  6510                        
  6511      </xsl:choo se>
  6512              
  6513     </xsl:temp late>
  6514    
  6515             
  6516     <xsl:templ ate 
  6517      name="alle rgyType"
  6518     >
  6519                       
  6520      <xsl:param  
  6521       name="row"  
  6522      />
  6523                       
  6524      <xsl:choos e>
  6525                                 
  6526       <xsl:when 
  6527        test="$row /n1:code"
  6528       >
  6529                                           
  6530        <xsl:choos e>
  6531                                                    
  6532         <xsl:when 
  6533          test="$row /n1:code/n 1:original Text"
  6534         >
  6535                                                              
  6536          <xsl:value -of 
  6537           select="$r ow/n1:code /n1:origin alText" 
  6538          />
  6539                                                     
  6540         </xsl:when >
  6541                                                    
  6542         <xsl:when 
  6543          test="$row /n1:code/@ displayNam e"
  6544         >
  6545                                                              
  6546          <xsl:value -of 
  6547           select="$r ow/n1:code /@displayN ame" 
  6548          />
  6549                                                     
  6550         </xsl:when >
  6551                                                    
  6552         <xsl:other wise>
  6553                                                              
  6554          <xsl:call- template 
  6555           name="na" 
  6556          />
  6557                                                     
  6558         </xsl:othe rwise>
  6559                                            
  6560        </xsl:choo se>
  6561                                  
  6562       </xsl:when >
  6563                                 
  6564       <xsl:other wise>
  6565                                           
  6566        <xsl:call- template 
  6567         name="na" 
  6568        />
  6569                                  
  6570       </xsl:othe rwise>
  6571                        
  6572      </xsl:choo se>
  6573              
  6574     </xsl:temp late>
  6575    
  6576             
  6577     <xsl:templ ate 
  6578      name="alle rgySource"
  6579     >
  6580                       
  6581      <xsl:param  
  6582       name="row"  
  6583      />
  6584                       
  6585      <xsl:param  
  6586       name="isPl aintext" 
  6587       select="bo olean(true )" 
  6588      />
  6589                       
  6590      <xsl:choos e>
  6591                                 
  6592       <xsl:when
  6593                                          
  6594        test="$row /n1:act/n1 :author/n1 :assignedA uthor/n1:r epresented Organizati on/n1:name "
  6595       >
  6596                                           
  6597        <xsl:value -of
  6598                                                   
  6599         select="$r ow/n1:act/ n1:author/ n1:assigne dAuthor/n1 :represent edOrganiza tion/n1:na me" 
  6600        />
  6601                                  
  6602       </xsl:when >
  6603                                 
  6604       <xsl:other wise>
  6605                                           
  6606        <xsl:call- template 
  6607         name="na" 
  6608        />
  6609                                  
  6610       </xsl:othe rwise>
  6611                        
  6612      </xsl:choo se>
  6613              
  6614     </xsl:temp late>
  6615    
  6616             
  6617     <xsl:templ ate 
  6618      name="getC reatedOnDa te"
  6619     >
  6620                       
  6621      <xsl:choos e>
  6622                                 
  6623       <xsl:when
  6624                                          
  6625        test="stri ng-length( /n1:Clinic alDocument /n1:effect iveTime/@v alue)=0"
  6626       >
  6627                                           
  6628        <xsl:call- template 
  6629         name="na" 
  6630        />
  6631                                  
  6632       </xsl:when >
  6633                                 
  6634       <xsl:when
  6635                                          
  6636        test="star ts-with(/n 1:Clinical Document/n 1:effectiv eTime/@val ue,' ')"
  6637       >
  6638                                           
  6639        <xsl:call- template 
  6640         name="na" 
  6641        />
  6642                                  
  6643       </xsl:when >
  6644                                 
  6645       <xsl:other wise>
  6646                                           
  6647        <xsl:call- template 
  6648         name="form atDateFull "
  6649        >
  6650                                                    
  6651         <xsl:with- param 
  6652          name="date "
  6653                                                             
  6654          select="/n 1:Clinical Document/n 1:effectiv eTime/@val ue" 
  6655         />
  6656                                            
  6657        </xsl:call -template>
  6658                                  
  6659       </xsl:othe rwise>
  6660                        
  6661      </xsl:choo se>
  6662              
  6663     </xsl:temp late>
  6664    
  6665             
  6666     <xsl:templ ate 
  6667      name="getG enderStrin g"
  6668     >
  6669                       
  6670      <xsl:choos e>
  6671                                 
  6672       <xsl:when
  6673                                          
  6674        test="/n1: ClinicalDo cument/n1: recordTarg et/n1:pati entRole/n1 :patient/n 1:administ rativeGend erCode/@co de"
  6675       >
  6676                                           
  6677        <xsl:value -of
  6678                                                   
  6679         select="/n 1:Clinical Document/n 1:recordTa rget/n1:pa tientRole/ n1:patient /n1:admini strativeGe nderCode/@ code" 
  6680        />
  6681                                  
  6682       </xsl:when >
  6683                                 
  6684       <xsl:other wise>
  6685                                           
  6686        <xsl:call- template 
  6687         name="gend erString"
  6688        >
  6689                                                    
  6690         <xsl:with- param 
  6691          name="sex"
  6692                                                             
  6693          select="/n 1:Clinical Document/n 1:recordTa rget/n1:pa tientRole/ n1:patient /n1:admini strativeGe nderCode/n 1:original Text" 
  6694         />
  6695                                            
  6696        </xsl:call -template>
  6697                                  
  6698       </xsl:othe rwise>
  6699                        
  6700      </xsl:choo se>
  6701              
  6702     </xsl:temp late>
  6703    
  6704             
  6705     <xsl:templ ate 
  6706      name="getR eactionStr ing"
  6707     >
  6708                       
  6709      <xsl:param  
  6710       name="obse rvation" 
  6711      />
  6712                       
  6713      <!--<xsl:f or-each se lect="$obs ervation/n 1:entryRel ationship[ @inversion Ind='true'  
  6714                                and @t ypeCode='M FST']"> -- >
  6715                       
  6716      <xsl:for-e ach 
  6717       select="$o bservation /n1:entryR elationshi p[@typeCod e='MFST']"
  6718      >
  6719                                 
  6720       <!--<xsl:v ariable na me="reacti onReferenc e" select= "substring -after(n1: observatio n/n1:text/ n1:referen ce/@value, '#')"/> -- >
  6721                                 
  6722       <xsl:varia ble 
  6723        name="reac tionRefere nce"
  6724                                          
  6725        select="n1 :observati on/n1:text /n1:refere nce/@value
  6726       />
  6727                                 
  6728       <xsl:varia ble 
  6729        name="reac tionValue"
  6730                                          
  6731        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]" 
  6732       />
  6733                                 
  6734       <xsl:varia ble 
  6735        name="reac tionValue2 "
  6736                                          
  6737        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,'#')]" 
  6738       />
  6739                                 
  6740       <xsl:varia ble 
  6741        name="reac tion"
  6742                                          
  6743        select=".. /../../../ ../n1:text /n1:conten t[@ID=$rea ctionRefer ence]" 
  6744       />
  6745                                 
  6746       <xsl:if 
  6747        test="stri ng-length( $reactionV alue)>1"
  6748       >
  6749                                           
  6750        <xsl:if 
  6751         test="posi tion()>1"
  6752        >
  6753                                                    
  6754         <xsl:text>
  6755         
  6756         </xsl:text >
  6757                                            
  6758        </xsl:if>
  6759                                           
  6760        <xsl:value -of 
  6761         select="$r eactionVal ue" 
  6762        />
  6763                                  
  6764       </xsl:if>
  6765                                 
  6766       <xsl:if 
  6767        test="stri ng-length( $reactionV alue2)>1"
  6768       >
  6769                                           
  6770        <xsl:if 
  6771         test="posi tion()>1"
  6772        >
  6773                                                    
  6774         <xsl:text>
  6775         
  6776         </xsl:text >
  6777                                            
  6778        </xsl:if>
  6779                                           
  6780        <xsl:value -of 
  6781         select="$r eactionVal ue2" 
  6782        />
  6783                                  
  6784       </xsl:if>
  6785                        
  6786      </xsl:for- each>
  6787              
  6788     </xsl:temp late>
  6789    
  6790             
  6791     <xsl:templ ate 
  6792      name="getS everityStr ing"
  6793     >
  6794                       
  6795      <xsl:param  
  6796       name="obse rvation" 
  6797      />
  6798                       
  6799      <xsl:if 
  6800       test="$obs ervation"
  6801      >
  6802                                 
  6803       <xsl:varia ble 
  6804        name="sevr Reference"
  6805                                          
  6806        select="su bstring-af ter($obser vation/n1: entryRelat ionship/n1 :observati on/n1:entr yRelations hip/n1:obs ervation/n 1:text/n1: reference/ @value,'#' )" 
  6807       />
  6808                                 
  6809       <xsl:varia ble 
  6810        name="seve rity"
  6811                                          
  6812        select="$o bservation /../../../ ../n1:text /n1:conten t[@ID=$sev rReference ]" 
  6813       />
  6814                                 
  6815       <xsl:if 
  6816        test="stri ng-length( $severity) >1"
  6817       >
  6818                                           
  6819        <xsl:value -of 
  6820         select="$s everity" 
  6821        />
  6822                                  
  6823       </xsl:if>
  6824                        
  6825      </xsl:if>
  6826              
  6827     </xsl:temp late>
  6828    
  6829             
  6830     <xsl:templ ate 
  6831      name="getA llergyType "
  6832     >
  6833                       
  6834      <xsl:param  
  6835       name="obse rvation" 
  6836      />
  6837                       
  6838      <xsl:choos e>
  6839                                 
  6840       <xsl:when 
  6841        test="$obs ervation/n 1:code/@di splayName"
  6842       >
  6843                                           
  6844        <xsl:value -of 
  6845         select="ob servation/ n1:code/@d isplayName
  6846        />
  6847                                  
  6848       </xsl:when >
  6849                                 
  6850       <xsl:other wise>
  6851                                           
  6852        <xsl:call- template 
  6853         name="na" 
  6854        />
  6855                                  
  6856       </xsl:othe rwise>
  6857                        
  6858      </xsl:choo se>
  6859              
  6860     </xsl:temp late>
  6861    
  6862             
  6863     <xsl:templ ate 
  6864      name="getS everityTex t"
  6865     >
  6866                       
  6867      <xsl:param  
  6868       name="obse rvation" 
  6869      />
  6870                       
  6871      <xsl:if 
  6872       test="$obs ervation"
  6873      >
  6874                                 
  6875       <xsl:varia ble 
  6876        name="sevr Reference"
  6877                                          
  6878        select="su bstring-af ter($obser vation/n1: entryRelat ionship/n1 :observati on/n1:entr yRelations hip/n1:obs ervation/n 1:text/n1: reference/ @value,'#' )" 
  6879       />
  6880                                 
  6881       <xsl:varia ble 
  6882        name="seve rity"
  6883                                          
  6884        select="$o bservation /../../../ ../n1:text /n1:conten t[@ID=$sev rReference ]" 
  6885       />
  6886                                 
  6887       <xsl:if 
  6888        test="stri ng-length( $severity) >1"
  6889       >
  6890                                           
  6891        <xsl:value -of 
  6892         select="$s everity" 
  6893        />
  6894                                  
  6895       </xsl:if>
  6896                        
  6897      </xsl:if>
  6898              
  6899     </xsl:temp late>
  6900    
  6901             
  6902     <xsl:templ ate 
  6903      name="getP roblemProv iderName"
  6904     >
  6905                       
  6906      <xsl:param  
  6907       name="act"  
  6908      />
  6909                       
  6910      <xsl:if 
  6911       test="$act "
  6912      >
  6913                                 
  6914       <xsl:choos e>
  6915                                           
  6916        <xsl:when
  6917                                                   
  6918         test="$act /n1:entryR elationshi p/n1:obser vation/n1: entryRelat ionship/n1 :observati on[@classC ode='OBS'  and @moodC ode='EVN'] /n1:perfor mer/n1:ass ignedEntit y/n1:assig nedPerson/ n1:name"
  6919        >
  6920                                                    
  6921         <xsl:value -of
  6922                                                             
  6923          select="$a ct/n1:entr yRelations hip/n1:obs ervation/n 1:entryRel ationship/ n1:observa tion[@clas sCode='OBS ' and @moo dCode='EVN ']/n1:perf ormer/n1:a ssignedEnt ity/n1:ass ignedPerso n/n1:name"  
  6924         />
  6925                                            
  6926        </xsl:when >
  6927                                           
  6928        <xsl:when
  6929                                                   
  6930         test="$act /n1:perfor mer/n1:ass ignedEntit y/n1:assig nedPerson/ n1:name"
  6931        >
  6932                                                    
  6933         <xsl:value -of
  6934                                                             
  6935          select="$a ct/n1:perf ormer/n1:a ssignedEnt ity/n1:ass ignedPerso n/n1:name"  
  6936         />
  6937                                            
  6938        </xsl:when >
  6939                                           
  6940        <xsl:when 
  6941         test="$act /n1:perfor mer/n1:ass ignedEntit y/n1:id/@e xtension"
  6942        >
  6943                                                    
  6944         <xsl:varia ble 
  6945          name="prov iderId"
  6946                                                             
  6947          select="$a ct/n1:perf ormer/n1:a ssignedEnt ity/n1:id/ @extension
  6948         />
  6949                                                    
  6950         <xsl:value -of
  6951                                                             
  6952          select="/n 1:Clinical Document/n 1:document ationOf/n1 :serviceEv ent/n1:per former/n1: assignedEn tity/n1:id [@extensio n=$provide rId]/@assi gningAutho rityName" 
  6953         />
  6954                                            
  6955        </xsl:when >
  6956                                           
  6957        <xsl:other wise>
  6958                                                    
  6959         <xsl:value -of
  6960                                                             
  6961          select="$a ct/n1:auth or/n1:assi gnedAuthor /n1:repres entedOrgan ization/n1 :name" 
  6962         />
  6963                                            
  6964        </xsl:othe rwise>
  6965                                  
  6966       </xsl:choo se>
  6967                        
  6968      </xsl:if>
  6969              
  6970     </xsl:temp late>
  6971    
  6972             
  6973     <xsl:templ ate 
  6974      name="getR esultValue "
  6975     >
  6976                       
  6977      <xsl:param  
  6978       name="obse rvation" 
  6979      />
  6980                       
  6981      <xsl:if 
  6982       test="$obs ervation"
  6983      >
  6984                                 
  6985       <xsl:choos e>
  6986                                           
  6987        <xsl:when 
  6988         test="$obs ervation/n 1:value/@v alue"
  6989        >
  6990                                                    
  6991         <xsl:value -of 
  6992          select="$o bservation /n1:value/ @value" 
  6993         />
  6994                                                    
  6995         <xsl:if 
  6996          test="$obs ervation/n 1:value/@u nit"
  6997         >
  6998                                                              
  6999          <xsl:text>
  7000            
  7001          </xsl:text >
  7002                                                              
  7003          <xsl:value -of 
  7004           select="$o bservation /n1:value/ @unit" 
  7005          />
  7006                                                     
  7007         </xsl:if>
  7008                                            
  7009        </xsl:when >
  7010                                           
  7011        <xsl:other wise>
  7012                                                    
  7013         <xsl:call- template 
  7014          name="na" 
  7015         />
  7016                                            
  7017        </xsl:othe rwise>
  7018                                  
  7019       </xsl:choo se>
  7020                        
  7021      </xsl:if>
  7022              
  7023     </xsl:temp late>
  7024    
  7025             
  7026     <xsl:templ ate 
  7027      name="getR esultValue Detail"
  7028     >
  7029                       
  7030      <xsl:param  
  7031       name="obse rvation" 
  7032      />
  7033                       
  7034      <xsl:if 
  7035       test="$obs ervation"
  7036      >
  7037                                 
  7038       <xsl:choos e>
  7039                                           
  7040        <xsl:when 
  7041         test="$obs ervation/n 1:value/@v alue"
  7042        >
  7043                                                    
  7044         <xsl:value -of 
  7045          select="$o bservation /n1:value/ @value" 
  7046         />
  7047                                                    
  7048         <xsl:if 
  7049          test="$obs ervation/n 1:value/@u nit"
  7050         >
  7051                                                              
  7052          <xsl:text>
  7053            
  7054          </xsl:text >
  7055                                                              
  7056          <xsl:value -of 
  7057           select="$o bservation /n1:value/ @unit" 
  7058          />
  7059                                                     
  7060         </xsl:if>
  7061                                            
  7062        </xsl:when >
  7063                                           
  7064        <xsl:other wise>
  7065                                                    
  7066         <xsl:call- template 
  7067          name="na" 
  7068         />
  7069                                            
  7070        </xsl:othe rwise>
  7071                                  
  7072       </xsl:choo se>
  7073                        
  7074      </xsl:if>
  7075              
  7076     </xsl:temp late>
  7077    
  7078             
  7079     <xsl:templ ate 
  7080      name="getF lag"
  7081     >
  7082                       
  7083      <xsl:param  
  7084       name="inte rpretation
  7085      />
  7086                       
  7087      <xsl:choos e>
  7088                                 
  7089       <xsl:when 
  7090        test="$int erpretatio n/@display Name"
  7091       >
  7092                                           
  7093        <xsl:value -of 
  7094         select="$i nterpretat ion/@displ ayName" 
  7095        />
  7096                                  
  7097       </xsl:when >
  7098                                 
  7099       <xsl:when 
  7100        test="$int erpretatio n/n1:origi nalText"
  7101       >
  7102                                           
  7103        <xsl:value -of 
  7104         select="$i nterpretat ion/n1:ori ginalText"  
  7105        />
  7106                                  
  7107       </xsl:when >
  7108                                 
  7109       <xsl:other wise>
  7110                                           
  7111        <xsl:call- template 
  7112         name="na" 
  7113        />
  7114                                  
  7115       </xsl:othe rwise>
  7116                        
  7117      </xsl:choo se>
  7118              
  7119     </xsl:temp late>
  7120    
  7121             
  7122     <xsl:templ ate 
  7123      name="getR esultUnit"
  7124     >
  7125                       
  7126      <xsl:param  
  7127       name="obse rvation" 
  7128      />
  7129                       
  7130      <xsl:if 
  7131       test="$obs ervation"
  7132      >
  7133                                 
  7134       <xsl:choos e>
  7135                                           
  7136        <xsl:when 
  7137         test="$obs ervation/n 1:value/@u nit"
  7138        >
  7139                                                    
  7140         <xsl:value -of 
  7141          select="$o bservation /n1:value/ @unit" 
  7142         />
  7143                                            
  7144        </xsl:when >
  7145                                           
  7146        <xsl:other wise>
  7147                                                    
  7148         <xsl:call- template 
  7149          name="na" 
  7150         />
  7151                                            
  7152        </xsl:othe rwise>
  7153                                  
  7154       </xsl:choo se>
  7155                        
  7156      </xsl:if>
  7157              
  7158     </xsl:temp late>
  7159    
  7160             
  7161     <xsl:templ ate 
  7162      name="faci lityProper ty"
  7163     >
  7164                       
  7165      <xsl:varia ble 
  7166       name="root
  7167       select="/n 1:Clinical Document" 
  7168      />
  7169                       
  7170      <Facility>
  7171                                 
  7172       <xsl:choos e>
  7173                                           
  7174        <xsl:when
  7175                                                   
  7176         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"
  7177        >
  7178                                                    
  7179         <xsl:value -of
  7180                                                             
  7181          select="$r oot/n1:cus todian/n1: assignedCu stodian/n1 :represent edCustodia nOrganizat ion/n1:nam e" 
  7182         />
  7183                                            
  7184        </xsl:when >
  7185       
  7186                                           
  7187        <xsl:when
  7188                                                   
  7189         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 "
  7190        >
  7191                                                    
  7192         <xsl:value -of
  7193                                                             
  7194          select="$r oot/n1:doc umentation Of/n1:serv iceEvent/n 1:performe r/n1:assig nedEntity/ n1:represe ntedOrgani zation/n1: name" 
  7195         />
  7196                                            
  7197        </xsl:when >
  7198                                           
  7199        <xsl:other wise />
  7200                                  
  7201       </xsl:choo se>
  7202                                 
  7203       <!--xsl:if  test="n1: act/n1:aut hor/n1:ass ignedAutho r/n1:repre sentedOrga nization/n 1:name"> 
  7204                                          <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"/
  7205                                          </xsl:if  -->
  7206                        
  7207      </Facility >
  7208     
  7209              
  7210     </xsl:temp late>
  7211    
  7212             
  7213     <xsl:templ ate 
  7214      name="gend erString"
  7215     >
  7216                       
  7217      <xsl:param  
  7218       name="sex"  
  7219       select="'u nknown'" 
  7220      />
  7221                       
  7222      <xsl:choos e>
  7223                                 
  7224       <xsl:when 
  7225        test="$sex ='M' or $s ex='m' or  $sex='Male ' or $sex= 'male'"
  7226       >
  7227                                           
  7228        <xsl:text>
  7229         Male
  7230        </xsl:text >
  7231                                  
  7232       </xsl:when >
  7233                                 
  7234       <xsl:when 
  7235        test="$sex ='F' or $s ex='f' or  $sex='Fema le' or $se x='female' "
  7236       >
  7237                                           
  7238        <xsl:text>
  7239         Female
  7240        </xsl:text >
  7241                                  
  7242       </xsl:when >
  7243                        
  7244      </xsl:choo se>
  7245              
  7246     </xsl:temp late>
  7247    
  7248    
  7249    
  7250             
  7251     <xsl:templ ate 
  7252      name="getI mmunizatio n"
  7253     >
  7254                       
  7255      <xsl:param  
  7256       name="manu facturedMa terial" 
  7257      />
  7258     
  7259                       
  7260      <xsl:varia ble 
  7261       name="immR eference"
  7262      >
  7263                                 
  7264       <xsl:choos e>
  7265                                           
  7266        <xsl:when
  7267                                                   
  7268         test="star ts-with($m anufacture dMaterial/ n1:code/n1 :originalT ext/n1:ref erence/@va lue,'#')"
  7269        >
  7270                                                    
  7271         <xsl:value -of
  7272                                                             
  7273          select="su bstring($m anufacture dMaterial/ n1:code/n1 :originalT ext/n1:ref erence/@va lue,2)" 
  7274         />
  7275                                            
  7276        </xsl:when >
  7277                                           
  7278        <xsl:other wise>
  7279                                                    
  7280         <xsl:value -of
  7281                                                             
  7282          select="$m anufacture dMaterial/ n1:code/n1 :originalT ext/n1:ref erence/@va lue" 
  7283         />
  7284                                            
  7285        </xsl:othe rwise>
  7286                                  
  7287       </xsl:choo se>
  7288                        
  7289      </xsl:vari able>
  7290     
  7291                       
  7292      <xsl:choos e>
  7293                                 
  7294       <xsl:when 
  7295        test="$imm Reference"
  7296       >
  7297                                           
  7298        <xsl:choos e>
  7299                                                    
  7300         <xsl:when
  7301                                                             
  7302          test="../n 1:text/n1: table/n1:t body/n1:tr /n1:td/n1: content[@I D=$immRefe rence]"
  7303         >
  7304                                                              
  7305          <xsl:value -of
  7306                                                                       
  7307           select=".. /n1:text/n 1:table/n1 :tbody/n1: tr/n1:td/n 1:content[ @ID=$immRe ference]" 
  7308          />
  7309                                                     
  7310         </xsl:when >
  7311                                                    
  7312         <xsl:other wise>
  7313                                                              
  7314          <xsl:if
  7315                                                                       
  7316           test="../n 1:text/n1: table/n1:t body/n1:tr /n1:td[@ID =$immRefer ence]"
  7317          >
  7318                                                                        
  7319           <xsl:value -of
  7320                                                                                 
  7321            select=".. /n1:text/n 1:table/n1 :tbody/n1: tr/n1:td[@ ID=$immRef erence]" 
  7322           />
  7323                                                               
  7324          </xsl:if>
  7325                                                     
  7326         </xsl:othe rwise>
  7327                                            
  7328        </xsl:choo se>
  7329                                  
  7330       </xsl:when >
  7331                                 
  7332       <xsl:other wise>
  7333                                           
  7334        <xsl:value -of 
  7335         select="$m anufacture dMaterial/ n1:name" 
  7336        />
  7337                                  
  7338       </xsl:othe rwise>
  7339                        
  7340      </xsl:choo se>
  7341              
  7342     </xsl:temp late>
  7343    
  7344             
  7345     <xsl:templ ate 
  7346      name="getI mmunizatio nSeries"
  7347     >
  7348                       
  7349      <xsl:param  
  7350       name="manu facturedMa terial" 
  7351      />
  7352     
  7353                       
  7354      <xsl:value -of 
  7355       select="$m anufacture dMaterial/ n1:lotNumb erText" 
  7356      />
  7357     
  7358              
  7359     </xsl:temp late>
  7360    
  7361             
  7362     <xsl:templ ate 
  7363      name="getA llergen"
  7364     >
  7365                       
  7366      <xsl:param  
  7367       name="obse rvation" 
  7368      />
  7369                       
  7370      <xsl:if 
  7371       test="$obs ervation"
  7372      >
  7373                                 
  7374       <xsl:choos e>
  7375                                           
  7376        <xsl:when
  7377                                                   
  7378         test="stri ng-length( $observati on/n1:part icipant/n1 :participa ntRole/n1: playingEnt ity/n1:nam e)>0"
  7379        >
  7380                                                    
  7381         <xsl:value -of
  7382                                                             
  7383          select="$o bservation /n1:partic ipant/n1:p articipant Role/n1:pl ayingEntit y/n1:name"  
  7384         />
  7385                                            
  7386        </xsl:when >
  7387                                           
  7388        <xsl:when
  7389                                                   
  7390         test="$obs ervation/n 1:particip ant/n1:par ticipantRo le/n1:play ingEntity/ n1:code/n1 :originalT ext/n1:ref erence/@va lue"
  7391        >
  7392                                                    
  7393         <xsl:varia ble 
  7394          name="reac tionNameRe f1"
  7395                                                             
  7396          select="$o bservation /n1:partic ipant/n1:p articipant Role/n1:pl ayingEntit y/n1:code/ n1:origina lText/n1:r eference/@ value" 
  7397         />
  7398                                                    
  7399         <xsl:varia ble 
  7400          name="reac tionNameRe f2"
  7401                                                             
  7402          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)" 
  7403         />
  7404                                                    
  7405         <xsl:if
  7406                                                             
  7407          test="../n 1:text/n1: table/n1:t body/n1:tr /n1:td[@ID =$reaction NameRef1]"
  7408         >
  7409                                                              
  7410          <xsl:value -of
  7411                                                                       
  7412           select=".. /n1:text/n 1:table/n1 :tbody/n1: tr/n1:td[@ ID=$reacti onNameRef1 ]" 
  7413          />
  7414                                                     
  7415         </xsl:if>
  7416                                                    
  7417         <xsl:if
  7418                                                             
  7419          test="../n 1:text/n1: table/n1:t body/n1:tr /n1:td[@ID =$reaction NameRef2]"
  7420         >
  7421                                                              
  7422          <xsl:value -of
  7423                                                                       
  7424           select=".. /n1:text/n 1:table/n1 :tbody/n1: tr/n1:td[@ ID=$reacti onNameRef2 ]" 
  7425          />
  7426                                                     
  7427         </xsl:if>
  7428                                                    
  7429         <xsl:if
  7430                                                             
  7431          test="../n 1:text/n1: table/n1:t body/n1:tr /n1:td/n1: content[@I D=$reactio nNameRef1] "
  7432         >
  7433                                                              
  7434          <xsl:value -of
  7435                                                                       
  7436           select=".. /n1:text/n 1:table/n1 :tbody/n1: tr/n1:td/n 1:content[ @ID=$react ionNameRef 1]" 
  7437          />
  7438                                                     
  7439         </xsl:if>
  7440                                                    
  7441         <xsl:if
  7442                                                             
  7443          test="../n 1:text/n1: table/n1:t body/n1:tr /n1:td/n1: content[@I D=$reactio nNameRef2] "
  7444         >
  7445                                                              
  7446          <xsl:value -of
  7447                                                                       
  7448           select=".. /n1:text/n 1:table/n1 :tbody/n1: tr/n1:td/n 1:content[ @ID=$react ionNameRef 2]" 
  7449          />
  7450                                                     
  7451         </xsl:if>
  7452                                            
  7453        </xsl:when >
  7454                                           
  7455        <xsl:other wise>
  7456                                                    
  7457         <xsl:value -of
  7458                                                             
  7459          select="$o bservation /n1:partic ipant[@typ eCode='CSM ']/n1:part icipantRol e[@classCo de='MANU'] /n1:playin gEntity[@c lassCode=' MMAT']" 
  7460         />
  7461                                            
  7462        </xsl:othe rwise>
  7463                                  
  7464       </xsl:choo se>
  7465                        
  7466      </xsl:if>
  7467              
  7468     </xsl:temp late>
  7469    
  7470             
  7471     <xsl:templ ate 
  7472      name="getA llergenTex t"
  7473     >
  7474                       
  7475      <xsl:param  
  7476       name="obse rvation" 
  7477      />
  7478                       
  7479      <xsl:if 
  7480       test="$obs ervation"
  7481      >
  7482                                 
  7483       <xsl:choos e>
  7484                                           
  7485        <xsl:when
  7486                                                   
  7487         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"
  7488        >
  7489                                                    
  7490         <xsl:value -of
  7491                                                             
  7492          select="$o bservation /n1:partic ipant/n1:p articipant Role/n1:pl ayingEntit y/n1:name"  
  7493         />
  7494                                            
  7495        </xsl:when >
  7496                                           
  7497        <xsl:other wise>
  7498                                                    
  7499         <xsl:value -of
  7500                                                             
  7501          select="$o bservation /participa nt[@typeCo de='CSM']/ n1:partici pantRole[@ classCode= 'MANU']/n1 :playingEn tity[@clas sCode='MMA T']/@name"  
  7502         />
  7503                                            
  7504        </xsl:othe rwise>
  7505                                  
  7506       </xsl:choo se>
  7507                        
  7508      </xsl:if>
  7509              
  7510     </xsl:temp late>
  7511    
  7512             
  7513     <xsl:templ ate 
  7514      name="getE ventType"
  7515     >
  7516                       
  7517      <xsl:param  
  7518       name="obs"  
  7519      />
  7520                       
  7521      <xsl:if 
  7522       test="$obs "
  7523      >
  7524                                 
  7525       <xsl:choos e>
  7526                                           
  7527        <xsl:when 
  7528         test="stri ng-length( $obs/n1:co de/n1:disp layName)>0 "
  7529        >
  7530                                                    
  7531         <xsl:value -of 
  7532          select="$o bs/n1:code /n1:displa yName" 
  7533         />
  7534                                            
  7535        </xsl:when >
  7536                                           
  7537        <xsl:when 
  7538         test="stri ng-length( $obs/n1:co de/@displa yName)>0"
  7539        >
  7540                                                    
  7541         <xsl:value -of 
  7542          select="$o bs/n1:code /@displayN ame" 
  7543         />
  7544                                            
  7545        </xsl:when >
  7546                                           
  7547        <xsl:when 
  7548         test="$obs /n1:code/n 1:original Text/n1:re ference/@v alue"
  7549        >
  7550                                                    
  7551         <xsl:varia ble 
  7552          name="type NameRef1"
  7553                                                             
  7554          select="$o bs/n1:code /n1:origin alText/n1: reference/ @value" 
  7555         />
  7556                                                    
  7557         <xsl:varia ble 
  7558          name="type NameRef2"
  7559                                                             
  7560          select="su bstring($o bs/n1:code /n1:origin alText/n1: reference/ @value,2)"  
  7561         />
  7562                                                    
  7563         <xsl:if
  7564                                                             
  7565          test="../n 1:text/n1: table/n1:t body/n1:tr /n1:td[@ID =$typeName Ref1]"
  7566         >
  7567                                                              
  7568          <xsl:value -of
  7569                                                                       
  7570           select=".. /n1:text/n 1:table/n1 :tbody/n1: tr/n1:td[@ ID=$typeNa meRef1]" 
  7571          />
  7572                                                     
  7573         </xsl:if>
  7574                                                    
  7575         <xsl:if
  7576                                                             
  7577          test="../n 1:text/n1: table/n1:t body/n1:tr /n1:td[@ID =$typeName Ref2]"
  7578         >
  7579                                                              
  7580          <xsl:value -of
  7581                                                                       
  7582           select=".. /n1:text/n 1:table/n1 :tbody/n1: tr/n1:td[@ ID=$typeNa meRef2]" 
  7583          />
  7584                                                     
  7585         </xsl:if>
  7586                                                    
  7587         <xsl:if
  7588                                                             
  7589          test="../n 1:text/n1: table/n1:t body/n1:tr /n1:td/n1: content[@I D=$typeNam eRef1]"
  7590         >
  7591                                                              
  7592          <xsl:value -of
  7593                                                                       
  7594           select=".. /n1:text/n 1:table/n1 :tbody/n1: tr/n1:td/n 1:content[ @ID=$typeN ameRef1]" 
  7595          />
  7596                                                     
  7597         </xsl:if>
  7598                                                    
  7599         <xsl:if
  7600                                                             
  7601          test="../n 1:text/n1: table/n1:t body/n1:tr /n1:td/n1: content[@I D=$typeNam eRef2]"
  7602         >
  7603                                                              
  7604          <xsl:value -of
  7605                                                                       
  7606           select=".. /n1:text/n 1:table/n1 :tbody/n1: tr/n1:td/n 1:content[ @ID=$typeN ameRef2]" 
  7607          />
  7608                                                     
  7609         </xsl:if>
  7610                                            
  7611        </xsl:when >
  7612                                           
  7613        <xsl:other wise>
  7614                                                    
  7615         <xsl:call- template 
  7616          name="na" 
  7617         />
  7618                                            
  7619        </xsl:othe rwise>
  7620                                  
  7621       </xsl:choo se>
  7622                        
  7623      </xsl:if>
  7624     
  7625     
  7626              
  7627     </xsl:temp late>
  7628    
  7629             
  7630     <!--<xsl:t emplate na me="getRea ction"> <x sl:param n ame="react ion"/> <xs l:variable  
  7631                      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]"
  7632                      <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]"/> 
  7633                      </xs l:when> <x sl:when te st="starts -with($rea ctionRefer ence,'#')" > <xsl:var iable 
  7634                      name ="reaction Reference1 " select=" substring( $reactionR eference,2 )"/> <xsl: value-of 
  7635                      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]"/> 
  7636                      </xs l:when> </ xsl:choose > </xsl:te mplate> -- >
  7637    
  7638             
  7639     <xsl:templ ate 
  7640      name="getR eactionVal ue"
  7641     >
  7642                       
  7643      <xsl:param  
  7644       name="reac tion" 
  7645      />
  7646                       
  7647      <xsl:varia ble 
  7648       name="reac tionRefere nce" 
  7649       select="$r eaction" 
  7650      />
  7651                       
  7652      <xsl:varia ble 
  7653       name="reac tionValue"
  7654                                
  7655       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]" 
  7656      />
  7657                       
  7658      <xsl:varia ble 
  7659       name="reac tionValue2 "
  7660                                
  7661       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,'#')]" 
  7662      />
  7663                       
  7664      <xsl:varia ble 
  7665       name="reac tionValue3 "
  7666                                
  7667       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]" 
  7668      />
  7669                       
  7670      <xsl:varia ble 
  7671       name="reac tionValue4 "
  7672                                
  7673       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,'#')]" 
  7674      />
  7675                       
  7676      <xsl:varia ble 
  7677       name="reac tionValue5 "
  7678                                
  7679       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]" 
  7680      />
  7681                       
  7682      <xsl:varia ble 
  7683       name="reac tionValue6 "
  7684                                
  7685       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 ,'#')]" 
  7686      />
  7687                       
  7688      <!--<xsl:v alue-of se lect="$rea ctionValue "/> -->
  7689                       
  7690      <xsl:if 
  7691       test="stri ng-length( $reactionV alue)>1"
  7692      >
  7693                                 
  7694       <xsl:if 
  7695        test="posi tion()>1"
  7696       >
  7697                                           
  7698        <xsl:text>
  7699        
  7700        </xsl:text >
  7701                                  
  7702       </xsl:if>
  7703                                 
  7704       <xsl:value -of 
  7705        select="$r eactionVal ue" 
  7706       />
  7707                        
  7708      </xsl:if>
  7709                       
  7710      <xsl:if 
  7711       test="stri ng-length( $reactionV alue2)>1"
  7712      >
  7713                                 
  7714       <xsl:if 
  7715        test="posi tion()>1"
  7716       >
  7717                                           
  7718        <xsl:text>
  7719        
  7720        </xsl:text >
  7721                                  
  7722       </xsl:if>
  7723                                 
  7724       <xsl:value -of 
  7725        select="$r eactionVal ue2" 
  7726       />
  7727                        
  7728      </xsl:if>
  7729                       
  7730      <xsl:if 
  7731       test="stri ng-length( $reactionV alue3)>1"
  7732      >
  7733                                 
  7734       <xsl:if 
  7735        test="posi tion()>1"
  7736       >
  7737                                           
  7738        <xsl:text>
  7739        
  7740        </xsl:text >
  7741                                  
  7742       </xsl:if>
  7743                                 
  7744       <xsl:value -of 
  7745        select="$r eactionVal ue3" 
  7746       />
  7747                        
  7748      </xsl:if>
  7749                       
  7750      <xsl:if 
  7751       test="stri ng-length( $reactionV alue4)>1"
  7752      >
  7753                                 
  7754       <xsl:if 
  7755        test="posi tion()>1"
  7756       >
  7757                                           
  7758        <xsl:text>
  7759        
  7760        </xsl:text >
  7761                                  
  7762       </xsl:if>
  7763                                 
  7764       <xsl:value -of 
  7765        select="$r eactionVal ue4" 
  7766       />
  7767                        
  7768      </xsl:if>
  7769                       
  7770      <xsl:if 
  7771       test="stri ng-length( $reactionV alue5)>1"
  7772      >
  7773                                 
  7774       <xsl:if 
  7775        test="posi tion()>1"
  7776       >
  7777                                           
  7778        <xsl:text>
  7779        
  7780        </xsl:text >
  7781                                  
  7782       </xsl:if>
  7783                                 
  7784       <xsl:value -of 
  7785        select="$r eactionVal ue5" 
  7786       />
  7787                        
  7788      </xsl:if>
  7789                       
  7790      <xsl:if 
  7791       test="stri ng-length( $reactionV alue6)>1"
  7792      >
  7793                                 
  7794       <xsl:if 
  7795        test="posi tion()>1"
  7796       >
  7797                                           
  7798        <xsl:text>
  7799        
  7800        </xsl:text >
  7801                                  
  7802       </xsl:if>
  7803                                 
  7804       <xsl:value -of 
  7805        select="$r eactionVal ue6" 
  7806       />
  7807                        
  7808      </xsl:if>
  7809              
  7810     </xsl:temp late>
  7811    
  7812             
  7813     <xsl:templ ate 
  7814      name="getA llergySour ce"
  7815     >
  7816                       
  7817      <xsl:param  
  7818       name="row"  
  7819      />
  7820                       
  7821      <xsl:param  
  7822       name="isPl aintext" 
  7823       select="bo olean(true )" 
  7824      />
  7825                       
  7826      <xsl:choos e>
  7827                                 
  7828       <xsl:when
  7829                                          
  7830        test="$row /n1:act/n1 :author/n1 :assignedA uthor/n1:r epresented Organizati on/n1:name "
  7831       >
  7832                                           
  7833        <xsl:value -of
  7834                                                   
  7835         select="$r ow/n1:act/ n1:author/ n1:assigne dAuthor/n1 :represent edOrganiza tion/n1:na me" 
  7836        />
  7837                                  
  7838       </xsl:when >
  7839                                 
  7840       <xsl:other wise>
  7841                                           
  7842        <xsl:call- template 
  7843         name="na" 
  7844        />
  7845                                  
  7846       </xsl:othe rwise>
  7847                        
  7848      </xsl:choo se>
  7849              
  7850     </xsl:temp late>
  7851    
  7852             
  7853     <xsl:templ ate 
  7854      name="getS everity"
  7855     >
  7856                       
  7857      <xsl:param  
  7858       name="obse rvation" 
  7859      />
  7860                       
  7861      <xsl:varia ble 
  7862       name="seve rityRefere nce"
  7863                                
  7864       select="$o bservation /n1:entryR elationshi p[@typeCod e='SUBJ']/ n1:observa tion/n1:te xt/n1:refe rence/@val ue" 
  7865      />
  7866     
  7867                       
  7868      <xsl:value -of 
  7869       select=".. /n1:text/n 1:content[ @ID=$sever ityReferen ce]" 
  7870      />
  7871                       
  7872      <xsl:value -of
  7873                                
  7874       select=".. /n1:text/n 1:content[ @ID=substr ing-after( $severityR eference,' #')]" 
  7875      />
  7876     
  7877                       
  7878      <xsl:text>
  7879        
  7880      </xsl:text >
  7881     
  7882     
  7883              
  7884     </xsl:temp late>
  7885    
  7886    
  7887             
  7888     <xsl:templ ate 
  7889      name="getR eactionCod ed"
  7890     >
  7891                       
  7892      <xsl:param  
  7893       name="eR" 
  7894      />
  7895                       
  7896      <xsl:varia ble 
  7897       name="code d"
  7898                                
  7899       select="$e R[@inversi onInd='tru e' and @ty peCode='MF ST']" 
  7900      />
  7901                       
  7902      <xsl:for-e ach 
  7903       select="$c oded"
  7904      >
  7905                                 
  7906       <xsl:if 
  7907        test="n1:o bservation /n1:value/ n1:transla tion/@disp layName"
  7908       >
  7909                                           
  7910        <xsl:value -of 
  7911         select="n1 :observati on/n1:valu e/n1:trans lation/@di splayName"  
  7912        />
  7913                                  
  7914       </xsl:if>
  7915                        
  7916      </xsl:for- each>
  7917              
  7918     </xsl:temp late>
  7919    
  7920             
  7921     <xsl:templ ate 
  7922      name="getP roblemOnse tDateStrin g"
  7923     >
  7924                       
  7925      <xsl:param  
  7926       name="act"  
  7927      />
  7928                       
  7929      <xsl:if 
  7930       test="$act "
  7931      >
  7932                                 
  7933       <xsl:choos e>
  7934                                           
  7935        <xsl:when
  7936                                                   
  7937         test="stri ng-length( $act/n1:en tryRelatio nship/n1:o bservation /n1:effect iveTime/n1 :low/@valu e)>1"
  7938        >
  7939                                                    
  7940         <xsl:value -of
  7941                                                             
  7942          select="$a ct/n1:entr yRelations hip/n1:obs ervation/n 1:effectiv eTime/n1:l ow/@value"  
  7943         />
  7944                                            
  7945        </xsl:when >
  7946                                           
  7947        <xsl:when 
  7948         test="stri ng-length( $act/n1:ef fectiveTim e/n1:low/@ value)>1"
  7949        >
  7950                                                    
  7951         <xsl:value -of 
  7952          select="n1 :act/n1:ef fectiveTim e/n1:low/@ value" 
  7953         />
  7954                                            
  7955        </xsl:when >
  7956                                  
  7957       </xsl:choo se>
  7958                        
  7959      </xsl:if>
  7960              
  7961     </xsl:temp late>
  7962    
  7963             
  7964     <xsl:templ ate 
  7965      name="getP roblemCode "
  7966     >
  7967                       
  7968      <xsl:param  
  7969       name="rowD ata" 
  7970      />
  7971                       
  7972      <!--<xsl:v ariable na me="probco denull" se lect="$row Data/n1:co de/@nullFl avor"/> -- >
  7973                       
  7974      <xsl:choos e>
  7975                                 
  7976       <!--<xsl:w hen test=" string($pr obcodenull )='UNK' ">  <xsl:call -template 
  7977                                          name="na "/> </xsl: when> -->
  7978                                 
  7979       <xsl:when 
  7980        test="$row Data/n1:va lue/@code  and not($i sKaiser)"
  7981       >
  7982                                           
  7983        <xsl:value -of 
  7984         select="$r owData/n1: value/@cod e" 
  7985        />
  7986                                  
  7987       </xsl:when >
  7988                                 
  7989       <xsl:when 
  7990        test="$row Data/n1:va lue/n1:tra nslation/@ code"
  7991       >
  7992                                           
  7993        <xsl:value -of 
  7994         select="$r owData/n1: value/n1:t ranslation /@code" 
  7995        />
  7996                                  
  7997       </xsl:when >
  7998                                 
  7999       <xsl:other wise>
  8000                                           
  8001        <xsl:call- template 
  8002         name="na" 
  8003        />
  8004                                  
  8005       </xsl:othe rwise>
  8006                        
  8007      </xsl:choo se>
  8008              
  8009     </xsl:temp late>
  8010    
  8011             
  8012     <xsl:templ ate 
  8013      name="getE ncounterID "
  8014     >
  8015                       
  8016      <xsl:param  
  8017       name="enco unter" 
  8018      />
  8019                       
  8020      <xsl:choos e>
  8021                                 
  8022       <xsl:when 
  8023        test="$enc ounter/n1: id/@root"
  8024       >
  8025                                           
  8026        <xsl:value -of 
  8027         select="$e ncounter/n 1:id/@root
  8028        />
  8029                                  
  8030       </xsl:when >
  8031                                 
  8032       <xsl:other wise>
  8033                                           
  8034        <xsl:call- template 
  8035         name="na" 
  8036        />
  8037                                  
  8038       </xsl:othe rwise>
  8039                        
  8040      </xsl:choo se>
  8041              
  8042     </xsl:temp late>
  8043    
  8044             
  8045     <xsl:templ ate 
  8046      name="getE ncounterTy pe"
  8047     >
  8048                       
  8049      <xsl:param  
  8050       name="enco unter" 
  8051      />
  8052                       
  8053      <xsl:choos e>
  8054      
  8055                                 
  8056       <xsl:when 
  8057        test="$enc ounter/n1: code/@disp layName"
  8058       >
  8059                                           
  8060        <xsl:value -of 
  8061         select="$e ncounter/n 1:code/@di splayName"  
  8062        />
  8063                                  
  8064       </xsl:when >
  8065                                 
  8066       <xsl:when 
  8067        test="$enc ounter/n1: code/@code "
  8068       >
  8069                                           
  8070        <xsl:value -of 
  8071         select="$e ncounter/n 1:code/@co de" 
  8072        />
  8073                                  
  8074       </xsl:when >
  8075                                 
  8076       <xsl:other wise>
  8077                                           
  8078        <xsl:call- template 
  8079         name="na" 
  8080        />
  8081                                  
  8082       </xsl:othe rwise>
  8083                        
  8084      </xsl:choo se>
  8085     
  8086              
  8087     </xsl:temp late>
  8088    
  8089             
  8090     <xsl:templ ate 
  8091      name="getE ncounterFr eeText"
  8092     >
  8093                       
  8094      <xsl:param  
  8095       name="enco unter" 
  8096      />
  8097                       
  8098      <xsl:choos e>
  8099                                 
  8100       <xsl:when
  8101                                          
  8102        test="star ts-with($e ncounter/n 1:code/n1: originalTe xt/n1:refe rence/@val ue,'#')"
  8103       >
  8104                                           
  8105        <xsl:value -of
  8106                                                   
  8107         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)]" 
  8108        />
  8109                                  
  8110       </xsl:when >
  8111                                 
  8112       <xsl:when 
  8113        test="star ts-with($e ncounter/n 1:text/n1: reference/ @value,'#' )"
  8114       >
  8115                                           
  8116        <xsl:if
  8117                                                   
  8118         test="$enc ounter/../ ../n1:text /n1:conten t[@ID=subs tring($enc ounter/n1: text/n1:re ference/@v alue,2)]"
  8119        >
  8120                                                    
  8121         <xsl:value -of
  8122                                                             
  8123          select="$e ncounter/. ./../n1:te xt/n1:cont ent[@ID=su bstring($e ncounter/n 1:text/n1: reference/ @value,2)]
  8124         />
  8125                                            
  8126        </xsl:if>
  8127                                           
  8128        <xsl:if
  8129                                                   
  8130         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)]"
  8131        >
  8132                                                    
  8133         <xsl:value -of
  8134                                                             
  8135          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)]"  
  8136         />
  8137                                            
  8138        </xsl:if>
  8139       
  8140                                  
  8141       </xsl:when >
  8142                                 
  8143       <xsl:when 
  8144        test="$enc ounter/n1: code/n1:or iginalText /n1:refere nce/@value "
  8145       >
  8146                                           
  8147        <xsl:value -of
  8148                                                   
  8149         select="$e ncounter/. ./../n1:te xt/n1:cont ent[@ID=$e ncounter/n 1:code/n1: originalTe xt/n1:refe rence/@val ue]" 
  8150        />
  8151                                  
  8152       </xsl:when >
  8153      
  8154                                 
  8155       <xsl:when 
  8156        test="star ts-with($e ncounter/n 1:text/n1: reference/ @value,'#' )"
  8157       >
  8158                                           
  8159        <xsl:varia ble 
  8160         name="encR ef"
  8161                                                   
  8162         select="su bstring($e ncounter/n 1:text/n1: reference/ @value,2)"  
  8163        />
  8164                                           
  8165        <xsl:varia ble 
  8166         name="enc"
  8167                                                   
  8168         select="$e ncounter/. ./../n1:te xt/n1:cont ent[@ID=$e ncRef]" 
  8169        />
  8170                                           
  8171        <xsl:value -of 
  8172         select="$e nc" 
  8173        />
  8174                                  
  8175       </xsl:when >
  8176                                 
  8177       <xsl:other wise>
  8178                                           
  8179        <xsl:varia ble 
  8180         name="encR ef"
  8181                                                   
  8182         select="$e ncounter/n 1:code/n1: originalTe xt/n1:refe rence/@val ue" 
  8183        />
  8184                                           
  8185        <xsl:varia ble 
  8186         name="enc"
  8187                                                   
  8188         select="$e ncounter/. ./../n1:te xt/n1:cont ent[@ID=$e ncRef]" 
  8189        />
  8190                                           
  8191        <xsl:value -of 
  8192         select="$e nc" 
  8193        />
  8194                                  
  8195       </xsl:othe rwise>
  8196                        
  8197      </xsl:choo se>
  8198              
  8199     </xsl:temp late>
  8200    
  8201    
  8202             
  8203     <xsl:templ ate 
  8204      name="getE ncounterDa teTime"
  8205     >
  8206                       
  8207      <xsl:param  
  8208       name="enco unter" 
  8209      />
  8210                       
  8211      <xsl:if 
  8212       test="$enc ounter"
  8213      >
  8214                                 
  8215       <xsl:choos e>
  8216                                           
  8217        <xsl:when 
  8218         test="$enc ounter/n1: effectiveT ime/n1:low /@value"
  8219        >
  8220                                                    
  8221         <xsl:value -of 
  8222          select="$e ncounter/n 1:effectiv eTime/n1:l ow/@value"  
  8223         />
  8224                                            
  8225        </xsl:when >
  8226                                  
  8227       </xsl:choo se>
  8228                        
  8229      </xsl:if>
  8230              
  8231     </xsl:temp late>
  8232    
  8233             
  8234     <xsl:templ ate 
  8235      name="getE ncounterPr ovider"
  8236     >
  8237                       
  8238      <xsl:param  
  8239       name="enco unter" 
  8240      />
  8241                       
  8242      <xsl:if 
  8243       test="$enc ounter"
  8244      >
  8245                                 
  8246       <xsl:choos e>
  8247                                           
  8248        <xsl:when
  8249                                                   
  8250         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"
  8251        >
  8252                                                    
  8253         <xsl:varia ble 
  8254          name="firs t"
  8255                                                             
  8256          select="$e ncounter/n 1:performe r/n1:assig nedEntity/ n1:assigne dPerson/n1 :name/n1:g iven" 
  8257         />
  8258                                                    
  8259         <xsl:varia ble 
  8260          name="last "
  8261                                                             
  8262          select="$e ncounter/n 1:performe r/n1:assig nedEntity/ n1:assigne dPerson/n1 :name/n1:f amily" 
  8263         />
  8264                                                    
  8265         <xsl:call- template 
  8266          name="form atProvider Name"
  8267         >
  8268                                                              
  8269          <xsl:with- param 
  8270           name="row"  
  8271           select="."  
  8272          />
  8273                                                              
  8274          <xsl:with- param 
  8275           name="firs t" 
  8276           select="$f irst" 
  8277          />
  8278                                                              
  8279          <xsl:with- param 
  8280           name="last
  8281           select="$l ast" 
  8282          />
  8283                                                     
  8284         </xsl:call -template>
  8285                                            
  8286        </xsl:when >
  8287                                           
  8288        <xsl:other wise>
  8289                                                    
  8290         <xsl:value -of
  8291                                                             
  8292          select="$e ncounter/n 1:performe r/n1:assig nedEntity/ n1:assigne dPerson" 
  8293         />
  8294                                            
  8295        </xsl:othe rwise>
  8296                                  
  8297       </xsl:choo se>
  8298                        
  8299      </xsl:if>
  8300              
  8301     </xsl:temp late>
  8302    
  8303             
  8304     <xsl:templ ate 
  8305      name="getE ncounterSo urce"
  8306     >
  8307                       
  8308      <xsl:param  
  8309       name="enco unter" 
  8310      />
  8311                       
  8312      <xsl:param  
  8313       name="isPl aintext" 
  8314       select="bo olean(true )" 
  8315      />
  8316                       
  8317      <xsl:choos e>
  8318                                 
  8319       <xsl:when
  8320                                          
  8321        test="$enc ounter/n1: author/n1: assignedAu thor/n1:re presentedO rganizatio n/n1:name"
  8322       >
  8323                                           
  8324        <xsl:value -of
  8325                                                   
  8326         select="$e ncounter/n 1:author/n 1:assigned Author/n1: represente dOrganizat ion/n1:nam e" 
  8327        />
  8328                                  
  8329       </xsl:when >
  8330                                 
  8331       <xsl:other wise>
  8332                                           
  8333        <xsl:call- template 
  8334         name="na" 
  8335        />
  8336                                  
  8337       </xsl:othe rwise>
  8338                        
  8339      </xsl:choo se>
  8340              
  8341     </xsl:temp late>
  8342    
  8343             
  8344     <xsl:templ ate 
  8345      name="getE ncounterRe ason"
  8346     >
  8347                       
  8348      <xsl:param  
  8349       name="enco unter" 
  8350      />
  8351                       
  8352      <xsl:param  
  8353       name="isPl aintext" 
  8354       select="bo olean(true )" 
  8355      />
  8356                       
  8357      <xsl:choos e>
  8358                                 
  8359       <xsl:when
  8360                                          
  8361        test="$enc ounter/n1: entryRelat ionship/n1 :observati on/n1:text /n1:refere nce/@value "
  8362       >
  8363                                           
  8364        <xsl:varia ble 
  8365         name="encR easonRef"
  8366                                                   
  8367         select="$e ncounter/n 1:entryRel ationship/ n1:observa tion/n1:te xt/n1:refe rence/@val ue" 
  8368        />
  8369                                           
  8370        <xsl:choos e>
  8371                                                    
  8372         <xsl:when 
  8373          test="$enc ounter/../ ../n1:text /n1:conten t[@ID=$enc ReasonRef] "
  8374         >
  8375                                                              
  8376          <xsl:value -of
  8377                                                                       
  8378           select="$e ncounter/. ./../n1:te xt/n1:cont ent[@ID=$e ncReasonRe f]" 
  8379          />
  8380                                                     
  8381         </xsl:when >
  8382                                                    
  8383         <xsl:when
  8384                                                             
  8385          test="$enc ounter/../ ../n1:text /n1:conten t[@ID=subs tring($enc ReasonRef, 2)]"
  8386         >
  8387                                                              
  8388          <xsl:value -of
  8389                                                                       
  8390           select="$e ncounter/. ./../n1:te xt/n1:cont ent[@ID=su bstring($e ncReasonRe f,2)]" 
  8391          />
  8392                                                     
  8393         </xsl:when >
  8394                                            
  8395        </xsl:choo se>
  8396       
  8397       
  8398       
  8399                                  
  8400       </xsl:when >
  8401                                 
  8402       <xsl:other wise>
  8403                                           
  8404        <xsl:call- template 
  8405         name="na" 
  8406        />
  8407                                  
  8408       </xsl:othe rwise>
  8409                        
  8410      </xsl:choo se>
  8411              
  8412     </xsl:temp late>
  8413    
  8414    
  8415             
  8416     <xsl:templ ate 
  8417      name="getP rocedureID "
  8418     >
  8419                       
  8420      <xsl:param  
  8421       name="proc edure" 
  8422      />
  8423                       
  8424      <xsl:if 
  8425       test="$pro cedure"
  8426      >
  8427                                 
  8428       <xsl:choos e>
  8429                                           
  8430        <xsl:when 
  8431         test="$pro cedure/n1: id/@root"
  8432        >
  8433                                                    
  8434         <xsl:value -of 
  8435          select="$p rocedure/n 1:id/@root
  8436         />
  8437                                            
  8438        </xsl:when >
  8439                                           
  8440        <xsl:other wise />
  8441                                  
  8442       </xsl:choo se>
  8443                        
  8444      </xsl:if>
  8445              
  8446     </xsl:temp late>
  8447    
  8448             
  8449     <xsl:templ ate 
  8450      name="getP rocedureTy pe"
  8451     >
  8452                       
  8453      <xsl:param  
  8454       name="proc edure" 
  8455      />
  8456                       
  8457      <xsl:varia ble 
  8458       name="disp layName" 
  8459       select="$p rocedure/n 1:code/@di splayName"  
  8460      />
  8461                       
  8462      <xsl:varia ble 
  8463       name="code
  8464       select="$p rocedure/n 1:code/@co de" 
  8465      />
  8466                       
  8467      <xsl:choos e>
  8468                                 
  8469       <xsl:when 
  8470        test="cont ains($disp layName,$c ode)"
  8471       >
  8472                                           
  8473        <xsl:value -of 
  8474         select="su bstring-af ter($displ ayName,$co de)" 
  8475        />
  8476                                  
  8477       </xsl:when >
  8478                                 
  8479       <xsl:other wise>
  8480                                           
  8481        <xsl:value -of 
  8482         select="$p rocedure/n 1:code/@di splayName"  
  8483        />
  8484                                  
  8485       </xsl:othe rwise>
  8486                        
  8487      </xsl:choo se>
  8488              
  8489     </xsl:temp late>
  8490    
  8491             
  8492     <xsl:templ ate 
  8493      name="getP rocedureQu alifier"
  8494     >
  8495                       
  8496      <xsl:param  
  8497       name="proc edure" 
  8498      />
  8499                       
  8500      <xsl:value -of 
  8501       select="$p rocedure/n 1:name/@di splayName"  
  8502      />
  8503                       
  8504      <xsl:text>
  8505        
  8506      </xsl:text >
  8507                       
  8508      <xsl:value -of 
  8509       select="$p rocedure/n 1:value/@d isplayName
  8510      />
  8511              
  8512     </xsl:temp late>
  8513    
  8514    
  8515             
  8516     <xsl:templ ate 
  8517      name="getP rocedureFr eeText"
  8518     >
  8519                       
  8520      <xsl:param  
  8521       name="proc edure" 
  8522      />
  8523                       
  8524      <xsl:choos e>
  8525                                 
  8526       <xsl:when 
  8527        test="star ts-with($p rocedure/n 1:text/n1: reference/ @value,'#' )"
  8528       >
  8529                                           
  8530        <xsl:varia ble 
  8531         name="proc Ref"
  8532                                                   
  8533         select="su bstring($p rocedure/n 1:text/n1: reference/ @value,2)"  
  8534        />
  8535                                           
  8536        <xsl:varia ble 
  8537         name="proc "
  8538                                                   
  8539         select="$p rocedure/. ./../n1:te xt/n1:cont ent[@ID=$p rocRef]" 
  8540        />
  8541                                           
  8542        <xsl:value -of 
  8543         select="$p roc" 
  8544        />
  8545                                  
  8546       </xsl:when >
  8547                                 
  8548       <xsl:when
  8549                                          
  8550        test="star ts-with($p rocedure/n 1:code/n1: originalTe xt/n1:refe rence/@val ue,'#')"
  8551       >
  8552                                           
  8553        <xsl:varia ble 
  8554         name="proc Ref"
  8555                                                   
  8556         select="su bstring($p rocedure/n 1:code/n1: originalTe xt/n1:refe rence/@val ue,2)" 
  8557        />
  8558                                           
  8559        <xsl:varia ble 
  8560         name="proc "
  8561                                                   
  8562         select="$p rocedure/. ./../n1:te xt/n1:cont ent[@ID=$p rocRef]" 
  8563        />
  8564                                           
  8565        <xsl:value -of 
  8566         select="$p roc" 
  8567        />
  8568                                  
  8569       </xsl:when >
  8570                                 
  8571       <xsl:other wise>
  8572                                           
  8573        <xsl:varia ble 
  8574         name="proc Ref"
  8575                                                   
  8576         select="$p rocedure/n 1:code/n1: originalTe xt/n1:refe rence/@val ue" 
  8577        />
  8578                                           
  8579        <xsl:varia ble 
  8580         name="proc "
  8581                                                   
  8582         select="$p rocedure/. ./../n1:te xt/n1:cont ent[@ID=$p rocRef]" 
  8583        />
  8584                                           
  8585        <xsl:value -of 
  8586         select="$p roc" 
  8587        />
  8588                                  
  8589       </xsl:othe rwise>
  8590                        
  8591      </xsl:choo se>
  8592              
  8593     </xsl:temp late>
  8594    
  8595    
  8596             
  8597     <xsl:templ ate 
  8598      name="getP rocedureDa teTime"
  8599     >
  8600                       
  8601      <xsl:param  
  8602       name="proc edure" 
  8603      />
  8604                       
  8605      <xsl:if 
  8606       test="$pro cedure"
  8607      >
  8608                                 
  8609       <xsl:choos e>
  8610                                           
  8611        <xsl:when 
  8612         test="$pro cedure/n1: effectiveT ime/n1:low /@value"
  8613        >
  8614                                                    
  8615         <xsl:value -of 
  8616          select="$p rocedure/n 1:effectiv eTime/n1:l ow/@value"  
  8617         />
  8618                                            
  8619        </xsl:when >
  8620                                  
  8621       </xsl:choo se>
  8622                        
  8623      </xsl:if>
  8624              
  8625     </xsl:temp late>
  8626    
  8627             
  8628     <xsl:templ ate 
  8629      name="getP rocedurePr ovider"
  8630     >
  8631                       
  8632      <xsl:param  
  8633       name="proc edure" 
  8634      />
  8635                       
  8636      <xsl:if 
  8637       test="$pro cedure"
  8638      >
  8639                                 
  8640       <xsl:choos e>
  8641                                           
  8642        <xsl:when
  8643                                                   
  8644         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"
  8645        >
  8646                                                    
  8647         <xsl:varia ble 
  8648          name="firs t"
  8649                                                             
  8650          select="$p rocedure/n 1:performe r/n1:assig nedEntity/ n1:assigne dPerson/n1 :name/n1:g iven" 
  8651         />
  8652                                                    
  8653         <xsl:varia ble 
  8654          name="last "
  8655                                                             
  8656          select="$p rocedure/n 1:performe r/n1:assig nedEntity/ n1:assigne dPerson/n1 :name/n1:f amily" 
  8657         />
  8658                                                    
  8659         <xsl:call- template 
  8660          name="form atProvider Name"
  8661         >
  8662                                                              
  8663          <xsl:with- param 
  8664           name="row"  
  8665           select="."  
  8666          />
  8667                                                              
  8668          <xsl:with- param 
  8669           name="firs t" 
  8670           select="$f irst" 
  8671          />
  8672                                                              
  8673          <xsl:with- param 
  8674           name="last
  8675           select="$l ast" 
  8676          />
  8677                                                     
  8678         </xsl:call -template>
  8679                                            
  8680        </xsl:when >
  8681                                           
  8682        <xsl:other wise>
  8683                                                    
  8684         <xsl:value -of
  8685                                                             
  8686          select="$p rocedure/n 1:performe r/n1:assig nedEntity/ n1:assigne dPerson" 
  8687         />
  8688                                            
  8689        </xsl:othe rwise>
  8690                                  
  8691       </xsl:choo se>
  8692                        
  8693      </xsl:if>
  8694              
  8695     </xsl:temp late>
  8696    
  8697    
  8698    
  8699    
  8700    
  8701    
  8702    
  8703             
  8704     <xsl:templ ate 
  8705      name="getP rocedureSo urce"
  8706     >
  8707                       
  8708      <xsl:param  
  8709       name="proc edure" 
  8710      />
  8711                       
  8712      <xsl:param  
  8713       name="isPl aintext" 
  8714       select="bo olean(true )" 
  8715      />
  8716                       
  8717      <xsl:choos e>
  8718                                 
  8719       <xsl:when
  8720                                          
  8721        test="$pro cedure/n1: author/n1: assignedAu thor/n1:re presentedO rganizatio n/n1:name"
  8722       >
  8723                                           
  8724        <xsl:value -of
  8725                                                   
  8726         select="$p rocedure/n 1:author/n 1:assigned Author/n1: represente dOrganizat ion/n1:nam e" 
  8727        />
  8728                                  
  8729       </xsl:when >
  8730                                 
  8731       <xsl:other wise>
  8732                                           
  8733        <xsl:call- template 
  8734         name="na" 
  8735        />
  8736                                  
  8737       </xsl:othe rwise>
  8738                        
  8739      </xsl:choo se>
  8740              
  8741     </xsl:temp late>
  8742    
  8743    
  8744    
  8745    
  8746    
  8747             
  8748     <xsl:templ ate 
  8749      name="medD ateBeginSt ring"
  8750     >
  8751                       
  8752      <xsl:param  
  8753       name="subs tanceAdmin
  8754      />
  8755                       
  8756      <xsl:if 
  8757       test="$sub stanceAdmi n"
  8758      >
  8759                                 
  8760       <xsl:choos e>
  8761       
  8762                                           
  8763        <xsl:when
  8764                                                   
  8765         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"
  8766        >
  8767                                                    
  8768         <xsl:value -of
  8769                                                             
  8770          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" 
  8771         />
  8772                                            
  8773        </xsl:when >
  8774                                           
  8775        <xsl:when
  8776                                                   
  8777         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"
  8778        >
  8779                                                    
  8780         <xsl:value -of
  8781                                                             
  8782          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" 
  8783         />
  8784                                            
  8785        </xsl:when >
  8786       
  8787                                  
  8788       </xsl:choo se>
  8789                        
  8790      </xsl:if>
  8791              
  8792     </xsl:temp late>
  8793    
  8794             
  8795     <xsl:templ ate 
  8796      name="getM edicationN ame"
  8797     >
  8798                       
  8799      <xsl:param  
  8800       name="subs tanceAdmin
  8801      />
  8802                       
  8803      <xsl:param  
  8804       name="row"  
  8805      />
  8806                       
  8807      <xsl:varia ble 
  8808       name="ref1 "
  8809                                
  8810       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" 
  8811      />
  8812                       
  8813      <xsl:if 
  8814       test="$sub stanceAdmi n"
  8815      >
  8816                                 
  8817       <xsl:choos e>
  8818                                           
  8819        <xsl:when 
  8820         test="$row /../n1:tex t/n1:list/ n1:item/n1 :content[@ ID=$ref1]"
  8821        >
  8822                                                    
  8823         <xsl:value -of
  8824                                                             
  8825          select="$r ow/../n1:t ext/n1:lis t/n1:item/ n1:content [@ID=$ref1 ]" 
  8826         />
  8827                                            
  8828        </xsl:when >
  8829                                           
  8830        <xsl:when
  8831                                                   
  8832         test="$row /../n1:tex t/n1:list/ n1:item/n1 :content[@ ID=substri ng-after($ ref1,'#')] "
  8833        >
  8834                                                    
  8835         <xsl:value -of
  8836                                                             
  8837          select="$r ow/../n1:t ext/n1:lis t/n1:item/ n1:content [@ID=subst ring-after ($ref1,'#' )]" 
  8838         />
  8839                                            
  8840        </xsl:when >
  8841                                           
  8842        <xsl:when
  8843                                                   
  8844         test="$row /../n1:tex t/n1:conte nt[@ID=sub string-aft er($ref1,' #')]"
  8845        >
  8846                                                    
  8847         <xsl:value -of
  8848                                                             
  8849          select="$r ow/../n1:t ext/n1:con tent[@ID=s ubstring-a fter($ref1 ,'#')]" 
  8850         />
  8851                                            
  8852        </xsl:when >
  8853                                           
  8854        <xsl:when
  8855                                                   
  8856         test="$row /../n1:tex t/n1:table /n1:tbody/ n1:tr/n1:t d/n1:conte nt[@ID=sub string-aft er($ref1,' #')]"
  8857        >
  8858                                                    
  8859         <xsl:value -of
  8860                                                             
  8861          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 ,'#')]" 
  8862         />
  8863                                            
  8864        </xsl:when >
  8865                                           
  8866        <xsl:when
  8867                                                   
  8868         test="$row /../n1:tex t/n1:table /n1:tbody/ n1:tr/n1:t d[@ID=subs tring-afte r($ref1,'# ')]"
  8869        >
  8870                                                    
  8871         <xsl:value -of
  8872                                                             
  8873          select="$r ow/../n1:t ext/n1:tab le/n1:tbod y/n1:tr/n1 :td[@ID=su bstring-af ter($ref1, '#')]" 
  8874         />
  8875                                            
  8876        </xsl:when >
  8877                                           
  8878        <xsl:when
  8879                                                   
  8880         test="$sub stanceAdmi n/n1:consu mable/n1:m anufacture dProduct/n 1:manufact uredMateri al/n1:code /n1:origin alText"
  8881        >
  8882                                                    
  8883         <xsl:value -of
  8884                                                             
  8885          select="$s ubstanceAd min/n1:con sumable/n1 :manufactu redProduct /n1:manufa cturedMate rial/n1:co de/n1:orig inalText" 
  8886         />
  8887                                            
  8888        </xsl:when >
  8889                                           
  8890        <xsl:when
  8891                                                   
  8892         test="$sub stanceAdmi n/n1:consu mable/n1:m anufacture dProduct/n 1:manufact uredMateri al/n1:code /@displayN ame"
  8893        >
  8894                                                    
  8895         <xsl:value -of
  8896                                                             
  8897          select="$s ubstanceAd min/n1:con sumable/n1 :manufactu redProduct /n1:manufa cturedMate rial/n1:co de/@displa yName" 
  8898         />
  8899                                            
  8900        </xsl:when >
  8901                                           
  8902        <xsl:other wise>
  8903                                                    
  8904         <xsl:value -of
  8905                                                             
  8906          select="$s ubstanceAd min/n1:con sumable/n1 :manufactu redProduct /n1:manufa cturedMate rial/n1:na me" 
  8907         />
  8908                                            
  8909        </xsl:othe rwise>
  8910                                  
  8911       </xsl:choo se>
  8912                        
  8913      </xsl:if>
  8914              
  8915     </xsl:temp late>
  8916    
  8917             
  8918     <xsl:templ ate 
  8919      name="medE xpireDateS tring"
  8920     >
  8921                       
  8922      <xsl:param  
  8923       name="subs tanceAdmin
  8924      />
  8925                       
  8926      <xsl:if 
  8927       test="$sub stanceAdmi n"
  8928      >
  8929                                 
  8930       <xsl:choos e>
  8931       
  8932       
  8933                                           
  8934        <xsl:when
  8935                                                   
  8936         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 "
  8937        >
  8938                                                    
  8939         <xsl:value -of
  8940                                                             
  8941          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" 
  8942         />
  8943                                            
  8944        </xsl:when >
  8945                                           
  8946        <xsl:when
  8947                                                   
  8948         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"
  8949        >
  8950                                                    
  8951         <xsl:value -of
  8952                                                             
  8953          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" 
  8954         />
  8955                                            
  8956        </xsl:when >
  8957       
  8958                                  
  8959       </xsl:choo se>
  8960                        
  8961      </xsl:if>
  8962              
  8963     </xsl:temp late>
  8964    
  8965             
  8966     <xsl:templ ate 
  8967      name="getM edStatusSt ring"
  8968     >
  8969                       
  8970      <xsl:param  
  8971       name="subs tanceAdmin
  8972      />
  8973                       
  8974      <xsl:if 
  8975       test="$sub stanceAdmi n"
  8976      >
  8977                                 
  8978       <xsl:choos e>
  8979                                           
  8980        <xsl:when
  8981                                                   
  8982         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"
  8983        >
  8984                                                    
  8985         <xsl:value -of
  8986                                                             
  8987          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" 
  8988         />
  8989                                            
  8990        </xsl:when >
  8991       
  8992                                           
  8993        <xsl:when
  8994                                                   
  8995         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"
  8996        >
  8997                                                    
  8998         <xsl:value -of
  8999                                                             
  9000          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" 
  9001         />
  9002                                            
  9003        </xsl:when >
  9004       
  9005                                           
  9006        <xsl:when
  9007                                                   
  9008         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"
  9009        >
  9010                                                    
  9011         <xsl:value -of
  9012                                                             
  9013          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
  9014         />
  9015                                            
  9016        </xsl:when >
  9017       
  9018       
  9019       
  9020       
  9021                                           
  9022        <xsl:when
  9023                                                   
  9024         test="stri ng-length( $substance Admin/n1:e ntryRelati onship/n1: observatio n/n1:value [@xsi:type ='CE']/n1: originalTe xt)>1"
  9025        >
  9026                                                    
  9027         <xsl:value -of
  9028                                                             
  9029          select="$s ubstanceAd min/n1:ent ryRelation ship/n1:ob servation/ n1:value[@ xsi:type=' CE']/n1:or iginalText
  9030         />
  9031                                            
  9032        </xsl:when >
  9033                                           
  9034        <xsl:when
  9035                                                   
  9036         test="stri ng-length( $substance Admin/n1:e ntryRelati onship/n1: observatio n/n1:value [@xsi:type ='CE']/@di splayName) >1"
  9037        >
  9038                                                    
  9039         <xsl:value -of
  9040                                                             
  9041          select="$s ubstanceAd min/n1:ent ryRelation ship/n1:ob servation/ n1:value[@ xsi:type=' CE']/@disp layName" 
  9042         />
  9043                                            
  9044        </xsl:when >
  9045                                  
  9046       </xsl:choo se>
  9047                        
  9048      </xsl:if>
  9049              
  9050     </xsl:temp late>
  9051    
  9052             
  9053     <xsl:templ ate 
  9054      name="getR xNumString "
  9055     >
  9056                       
  9057      <xsl:param  
  9058       name="subs tanceAdmin
  9059      />
  9060                       
  9061      <xsl:if 
  9062       test="$sub stanceAdmi n"
  9063      >
  9064                                 
  9065       <xsl:choos e>
  9066                                           
  9067        <xsl:when
  9068                                                   
  9069         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"
  9070        >
  9071                                                    
  9072         <xsl:value -of
  9073                                                             
  9074          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" 
  9075         />
  9076                                            
  9077        </xsl:when >
  9078                                           
  9079        <xsl:when
  9080                                                   
  9081         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"
  9082        >
  9083                                                    
  9084         <xsl:value -of
  9085                                                             
  9086          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"  
  9087         />
  9088                                            
  9089        </xsl:when >
  9090                                  
  9091       </xsl:choo se>
  9092                        
  9093      </xsl:if>
  9094              
  9095     </xsl:temp late>
  9096    
  9097             
  9098     <xsl:templ ate 
  9099      name="getM edProvider "
  9100     >
  9101                       
  9102      <xsl:param  
  9103       name="subs tanceAdmin
  9104      />
  9105                       
  9106      <xsl:varia ble 
  9107       name="assi gnedPerson 1"
  9108                                
  9109       select="$s ubstanceAd min/n1:ent ryRelation ship[@type Code='REFR ']/n1:supp ly/n1:auth or/n1:assi gnedAuthor /n1:assign edPerson" 
  9110      />
  9111                       
  9112      <xsl:varia ble 
  9113       name="assi gnedPerson 2"
  9114                                
  9115       select="$s ubstanceAd min/n1:ent ryRelation ship/n1:su pply/n1:au thor/n1:as signedAuth or/n1:assi gnedPerson
  9116      />
  9117                       
  9118      <xsl:varia ble 
  9119       name="assi gnedPerson 3"
  9120                                
  9121       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" 
  9122      />
  9123     
  9124                       
  9125      <xsl:if 
  9126       test="$sub stanceAdmi n"
  9127      >
  9128      
  9129                                 
  9130       <xsl:choos e>
  9131       
  9132                                           
  9133        <xsl:when 
  9134         test="stri ng-length( $assignedP erson1/n1: name)>1"
  9135        >
  9136                                                    
  9137         <xsl:choos e>
  9138                                                              
  9139          <xsl:when
  9140                                                                       
  9141           test="$ass ignedPerso n1/n1:name /n1:given  and $assig nedPerson1 /n1:name/n 1:family"
  9142          >
  9143                                                                        
  9144           <xsl:call- template 
  9145            name="form atProvider Name"
  9146           >
  9147                                                                                  
  9148            <xsl:with- param 
  9149             name="row"  
  9150             select="."  
  9151            />
  9152                                                                                  
  9153            <xsl:with- param 
  9154             name="firs t"
  9155                                                                                           
  9156             select="$a ssignedPer son1/n1:na me/n1:give n" 
  9157            />
  9158                                                                                  
  9159            <xsl:with- param 
  9160             name="last "
  9161                                                                                           
  9162             select="$a ssignedPer son1/n1:na me/n1:fami ly" 
  9163            />
  9164                                                                         
  9165           </xsl:call -template>
  9166                                                               
  9167          </xsl:when >
  9168                                                              
  9169          <xsl:other wise>
  9170                                                                        
  9171           <xsl:value -of 
  9172            select="$a ssignedPer son1/n1:na me" 
  9173           />
  9174                                                               
  9175          </xsl:othe rwise>
  9176                                                     
  9177         </xsl:choo se>
  9178                                            
  9179        </xsl:when >
  9180       
  9181                                           
  9182        <xsl:when
  9183                                                   
  9184         test="stri ng-length( $substance Admin/n1:e ntryRelati onship/n1: supply/n1: author/n1: assignedAu thor/n1:as signedPers on/n1:name )>1"
  9185        >
  9186                                                    
  9187         <xsl:choos e>
  9188                                                              
  9189          <xsl:when
  9190                                                                       
  9191           test="$ass ignedPerso n2/n1:name /n1:given  and $assig nedPerson2 /n1:name/n 1:family"
  9192          >
  9193                                                                        
  9194           <xsl:call- template 
  9195            name="form atProvider Name"
  9196           >
  9197                                                                                  
  9198            <xsl:with- param 
  9199             name="row"  
  9200             select="."  
  9201            />
  9202                                                                                  
  9203            <xsl:with- param 
  9204             name="firs t"
  9205                                                                                           
  9206             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" 
  9207            />
  9208                                                                                  
  9209            <xsl:with- param 
  9210             name="last "
  9211                                                                                           
  9212             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" 
  9213            />
  9214                                                                         
  9215           </xsl:call -template>
  9216                                                               
  9217          </xsl:when >
  9218                                                              
  9219          <xsl:other wise>
  9220                                                                        
  9221           <xsl:value -of
  9222                                                                                 
  9223            select="$s ubstanceAd min/n1:ent ryRelation ship/n1:su pply/n1:au thor/n1:as signedAuth or/n1:assi gnedPerson /n1:name" 
  9224           />
  9225                                                               
  9226          </xsl:othe rwise>
  9227                                                     
  9228         </xsl:choo se>
  9229                                            
  9230        </xsl:when >
  9231       
  9232                                           
  9233        <xsl:when
  9234                                                   
  9235         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"
  9236        >
  9237                                                    
  9238         <xsl:choos e>
  9239                                                              
  9240          <xsl:when
  9241                                                                       
  9242           test="$ass ignedPerso n3/n1:name /n1:given  and $assig nedPerson3 /n1:name/n 1:family"
  9243          >
  9244                                                                        
  9245           <xsl:call- template 
  9246            name="form atProvider Name"
  9247           >
  9248                                                                                  
  9249            <xsl:with- param 
  9250             name="row"  
  9251             select="."  
  9252            />
  9253                                                                                  
  9254            <xsl:with- param 
  9255             name="firs t"
  9256                                                                                           
  9257             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" 
  9258            />
  9259                                                                                  
  9260            <xsl:with- param 
  9261             name="last "
  9262                                                                                           
  9263             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"  
  9264            />
  9265                                                                         
  9266           </xsl:call -template>
  9267                                                               
  9268          </xsl:when >
  9269                                                              
  9270          <xsl:other wise>
  9271                                                                        
  9272           <xsl:value -of
  9273                                                                                 
  9274            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"  
  9275           />
  9276                                                               
  9277          </xsl:othe rwise>
  9278                                                     
  9279         </xsl:choo se>
  9280                                            
  9281        </xsl:when >
  9282       
  9283       
  9284       
  9285                                           
  9286        <!--<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"> 
  9287                                                    <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"/> 
  9288                                                    </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"> 
  9289                                                    <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"/> 
  9290                                                    </xsl:when > -->
  9291       
  9292                                  
  9293       </xsl:choo se>
  9294                        
  9295      </xsl:if>
  9296              
  9297     </xsl:temp late>
  9298    
  9299             
  9300     <xsl:templ ate 
  9301      name="getM edQuantity String"
  9302     >
  9303                       
  9304      <xsl:param  
  9305       name="subs tanceAdmin
  9306      />
  9307                       
  9308      <xsl:if 
  9309       test="$sub stanceAdmi n"
  9310      >
  9311                                 
  9312       <xsl:choos e>
  9313                                           
  9314        <xsl:when
  9315                                                   
  9316         test="stri ng-length( $substance Admin/n1:e ntryRelati onship[@ty peCode='RE FR']/n1:su pply/n1:qu antity/@va lue)>1"
  9317        >
  9318                                                    
  9319         <xsl:value -of
  9320                                                             
  9321          select="$s ubstanceAd min/n1:ent ryRelation ship[@type Code='REFR ']/n1:supp ly/n1:quan tity/@valu e" 
  9322         />
  9323                                            
  9324        </xsl:when >
  9325                                           
  9326        <xsl:when
  9327                                                   
  9328         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"
  9329        >
  9330                                                    
  9331         <xsl:value -of
  9332                                                             
  9333          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" 
  9334         />
  9335                                            
  9336        </xsl:when >
  9337                                           
  9338        <xsl:when
  9339                                                   
  9340         test="stri ng-length( $substance Admin/n1:e ntryRelati onship/n1: supply/n1: quantity/@ value)>1"
  9341        >
  9342                                                    
  9343         <xsl:value -of
  9344                                                             
  9345          select="$s ubstanceAd min/n1:ent ryRelation ship/n1:su pply/n1:qu antity/@va lue" 
  9346         />
  9347                                            
  9348        </xsl:when >
  9349                                           
  9350        <xsl:when 
  9351         test="stri ng-length( $substance Admin/n1:d oseQuantit y/@value)> 1"
  9352        >
  9353                                                    
  9354         <xsl:value -of 
  9355          select="$s ubstanceAd min/n1:dos eQuantity/ @value" 
  9356         />
  9357                                            
  9358        </xsl:when >
  9359                                           
  9360        <xsl:when
  9361                                                   
  9362         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"
  9363        >
  9364                                                    
  9365         <xsl:value -of
  9366                                                             
  9367          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" 
  9368         />
  9369                                            
  9370        </xsl:when >
  9371                                  
  9372       </xsl:choo se>
  9373                        
  9374      </xsl:if>
  9375              
  9376     </xsl:temp late>
  9377    
  9378             
  9379     <xsl:templ ate 
  9380      name="getS ig"
  9381     >
  9382                       
  9383      <xsl:param  
  9384       name="subs tanceAdmin
  9385      />
  9386                       
  9387      <xsl:varia ble 
  9388       name="sigI d1"
  9389                                
  9390       select="$s ubstanceAd min/n1:tex t/n1:refer ence/@valu e" 
  9391      />
  9392                       
  9393      <xsl:varia ble 
  9394       name="sigI d2" 
  9395       select="su bstring-af ter($sigId 1,'#')" 
  9396      />
  9397                       
  9398      <!--<xsl:i f test="$s ubstanceAd min/n1:tex t/n1:refer ence/@valu e"> -->
  9399                       
  9400      <xsl:choos e>
  9401                                 
  9402       <xsl:when
  9403                                          
  9404        test="$sub stanceAdmi n/../../n1 :text/n1:l ist/n1:ite m/n1:conte nt[@ID=$si gId1]"
  9405       >
  9406                                           
  9407        <xsl:value -of
  9408                                                   
  9409         select="$s ubstanceAd min/../../ n1:text/n1 :list/n1:i tem/n1:con tent[@ID=$ sigId1]" 
  9410        />
  9411                                  
  9412       </xsl:when >
  9413                                 
  9414       <xsl:when
  9415                                          
  9416        test="$sub stanceAdmi n/../../n1 :text/n1:l ist/n1:ite m/n1:conte nt[@ID=$si gId2]"
  9417       >
  9418                                           
  9419        <xsl:value -of
  9420                                                   
  9421         select="$s ubstanceAd min/../../ n1:text/n1 :list/n1:i tem/n1:con tent[@ID=$ sigId2]" 
  9422        />
  9423                                  
  9424       </xsl:when >
  9425                                 
  9426       <xsl:when
  9427                                          
  9428        test="$sub stanceAdmi n/../../n1 :text/n1:t able/n1:tb ody/n1:tr/ n1:td/n1:c ontent[@ID =$sigId2]"
  9429       >
  9430                                           
  9431        <xsl:value -of
  9432                                                   
  9433         select="$s ubstanceAd min/../../ n1:text/n1 :table/n1: tbody/n1:t r/n1:td/n1 :content[@ ID=$sigId2 ]" 
  9434        />
  9435                                  
  9436       </xsl:when >
  9437                                 
  9438       <xsl:other wise />
  9439                        
  9440      </xsl:choo se>
  9441                       
  9442      <!--</xsl: if> -->
  9443              
  9444     </xsl:temp late>
  9445    
  9446             
  9447     <xsl:templ ate 
  9448      name="getP roblemSour ce"
  9449     >
  9450                       
  9451      <xsl:param  
  9452       name="row"  
  9453      />
  9454                       
  9455      <xsl:param  
  9456       name="isPl aintext" 
  9457       select="bo olean(true )" 
  9458      />
  9459                       
  9460      <xsl:choos e>
  9461                                 
  9462       <xsl:when
  9463                                          
  9464        test="$row /n1:act/n1 :author/n1 :assignedA uthor/n1:r epresented Organizati on/n1:name "
  9465       >
  9466                                           
  9467        <xsl:value -of
  9468                                                   
  9469         select="$r ow/n1:act/ n1:author/ n1:assigne dAuthor/n1 :represent edOrganiza tion/n1:na me" 
  9470        />
  9471                                  
  9472       </xsl:when >
  9473                                 
  9474       <xsl:other wise>
  9475                                           
  9476        <xsl:call- template 
  9477         name="na" 
  9478        />
  9479                                  
  9480       </xsl:othe rwise>
  9481                        
  9482      </xsl:choo se>
  9483              
  9484     </xsl:temp late>
  9485    
  9486             
  9487     <xsl:templ ate 
  9488      name="getP roblemProv ider"
  9489     >
  9490                       
  9491      <xsl:param  
  9492       name="perf ormer" 
  9493      />
  9494                       
  9495      <xsl:varia ble 
  9496       name="prov iderRef"
  9497                                
  9498       select="$p erformer/n 1:assigned Entity/n1: id/@extens ion" 
  9499      />
  9500                       
  9501      <xsl:choos e>
  9502                                 
  9503       <xsl:when
  9504                                          
  9505        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"
  9506       >
  9507                                           
  9508        <xsl:value -of
  9509                                                   
  9510         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" 
  9511        />
  9512                                  
  9513       </xsl:when >
  9514                                 
  9515       <xsl:other wise>
  9516                                           
  9517        <xsl:call- template 
  9518         name="na" 
  9519        />
  9520                                  
  9521       </xsl:othe rwise>
  9522                        
  9523      </xsl:choo se>
  9524              
  9525     </xsl:temp late>
  9526    
  9527             
  9528     <!-- LABS  -->
  9529    
  9530             
  9531     <xsl:templ ate 
  9532      name="getR esultDT"
  9533     >
  9534                       
  9535      <xsl:param  
  9536       name="obse rvation" 
  9537      />
  9538                       
  9539      <xsl:if 
  9540       test="$obs ervation"
  9541      >
  9542                                 
  9543       <xsl:choos e>
  9544                                           
  9545        <xsl:when 
  9546         test="$obs ervation/n 1:effectiv eTime/@val ue"
  9547        >
  9548                                                    
  9549         <xsl:call- template 
  9550          name="form atDate"
  9551         >
  9552                                                              
  9553          <xsl:with- param 
  9554           name="date "
  9555                                                                       
  9556           select="$o bservation /n1:effect iveTime/@v alue" 
  9557          />
  9558                                                     
  9559         </xsl:call -template>
  9560                                            
  9561        </xsl:when >
  9562                                           
  9563        <xsl:when
  9564                                                   
  9565         test="n1:e ntry/n1:or ganizer/n1 :component /n1:observ ation/n1:e ffectiveTi me/@value"
  9566        >
  9567                                                    
  9568         <xsl:call- template 
  9569          name="form atDate"
  9570         >
  9571                                                              
  9572          <xsl:with- param 
  9573           name="date "
  9574                                                                       
  9575           select="n1 :entry/n1: organizer/ n1:compone nt/n1:obse rvation/n1 :effective Time/@valu e" 
  9576          />
  9577                                                     
  9578         </xsl:call -template>
  9579                                            
  9580        </xsl:when >
  9581                                           
  9582        <xsl:other wise />
  9583                                  
  9584       </xsl:choo se>
  9585                        
  9586      </xsl:if>
  9587              
  9588     </xsl:temp late>
  9589    
  9590             
  9591     <xsl:templ ate 
  9592      name="getR esultID"
  9593     >
  9594                       
  9595      <xsl:param  
  9596       name="obse rvation" 
  9597      />
  9598                       
  9599      <xsl:if 
  9600       test="$obs ervation"
  9601      >
  9602                                 
  9603       <xsl:choos e>
  9604                                           
  9605        <xsl:when 
  9606         test="$obs ervation/n 1:id/@root "
  9607        >
  9608                                                    
  9609         <xsl:value -of 
  9610          select="$o bservation /n1:id/@ro ot" 
  9611         />
  9612                                            
  9613        </xsl:when >
  9614                                           
  9615        <xsl:other wise />
  9616                                  
  9617       </xsl:choo se>
  9618                        
  9619      </xsl:if>
  9620              
  9621     </xsl:temp late>
  9622    
  9623             
  9624     <xsl:templ ate 
  9625      name="getR esultType"
  9626     >
  9627                       
  9628      <xsl:param  
  9629       name="obse rvation" 
  9630      />
  9631                       
  9632      <xsl:choos e>
  9633                                 
  9634       <!--<xsl:w hen test=" $observati on/n1:code /@code"> < xsl:value- of select= "$observat ion/n1:cod e/@code"/>  
  9635                                          </xsl:wh en> -->
  9636                                 
  9637       <xsl:when 
  9638        test="$obs ervation/n 1:code/@di splayName"
  9639       >
  9640                                           
  9641        <xsl:value -of 
  9642         select="$o bservation /n1:code/@ displayNam e" 
  9643        />
  9644                                  
  9645       </xsl:when >
  9646                                 
  9647       <xsl:other wise />
  9648                        
  9649      </xsl:choo se>
  9650              
  9651     </xsl:temp late>
  9652    
  9653             
  9654     <xsl:templ ate 
  9655      name="getI nterpretat ion"
  9656     >
  9657                       
  9658      <xsl:param  
  9659       name="inte rpretation
  9660      />
  9661                       
  9662      <xsl:choos e>
  9663                                 
  9664       <xsl:when 
  9665        test="$int erpretatio n/@display Name"
  9666       >
  9667                                           
  9668        <xsl:value -of 
  9669         select="$i nterpretat ion/@displ ayName" 
  9670        />
  9671                                  
  9672       </xsl:when >
  9673                                 
  9674       <xsl:when 
  9675        test="$int erpretatio n/n1:origi nalText"
  9676       >
  9677                                           
  9678        <xsl:value -of 
  9679         select="$i nterpretat ion/n1:ori ginalText"  
  9680        />
  9681                                  
  9682       </xsl:when >
  9683                                 
  9684       <xsl:other wise />
  9685                        
  9686      </xsl:choo se>
  9687              
  9688     </xsl:temp late>
  9689    
  9690             
  9691     <xsl:templ ate 
  9692      name="getR efRange"
  9693     >
  9694                       
  9695      <xsl:param  
  9696       name="row"  
  9697      />
  9698                       
  9699      <xsl:choos e>
  9700                                 
  9701       <xsl:when
  9702                                          
  9703        test="$row /n1:observ ation/n1:r eferenceRa nge/n1:obs ervationRa nge/n1:tex t"
  9704       >
  9705                                           
  9706        <xsl:value -of
  9707                                                   
  9708         select="$r ow/n1:obse rvation/n1 :reference Range/n1:o bservation Range/n1:t ext" 
  9709        />
  9710                                  
  9711       </xsl:when >
  9712                                 
  9713       <xsl:when
  9714                                          
  9715        test="$row /n1:organi zer/n1:com ponent/n1: observatio n/n1:refer enceRange/ n1:observa tionRange/ n1:text"
  9716       >
  9717                                           
  9718        <xsl:value -of
  9719                                                   
  9720         select="$r ow/n1:orga nizer/n1:c omponent/n 1:observat ion/n1:ref erenceRang e/n1:obser vationRang e/n1:text"  
  9721        />
  9722                                  
  9723       </xsl:when >
  9724                                 
  9725       <xsl:other wise />
  9726                        
  9727      </xsl:choo se>
  9728              
  9729     </xsl:temp late>
  9730    
  9731    
  9732             
  9733     <xsl:templ ate 
  9734      name="na"
  9735     >
  9736                       
  9737      <span 
  9738       title="Not  Available "
  9739      >
  9740                                 
  9741       <xsl:text>
  9742        --
  9743       </xsl:text >
  9744                        
  9745      </span>
  9746              
  9747     </xsl:temp late>
  9748    
  9749             
  9750     <!-- Comme nts Sectio n -->
  9751    
  9752             
  9753     <!-- Med C omments -- >
  9754             
  9755     <xsl:templ ate 
  9756      name="medC omments"
  9757     >
  9758                       
  9759      <xsl:varia ble 
  9760       name="ref1 "
  9761                                
  9762       select="n1 :entry/n1: act/n1:tex t/n1:refer ence/@valu e" 
  9763      />
  9764                       
  9765      <xsl:varia ble 
  9766       name="ref2
  9767       select="su bstring-af ter($ref1, '#')" 
  9768      />
  9769                       
  9770      <xsl:choos e>
  9771                                 
  9772       <xsl:when 
  9773        test="n1:t ext/n1:con tent[@ID=$ ref1]"
  9774       >
  9775                                           
  9776        <xsl:call- template 
  9777         name="form atComments "
  9778        >
  9779                                                    
  9780         <xsl:with- param 
  9781          name="comm ents" 
  9782          select="n1 :text/n1:c ontent[@ID =$ref1]" 
  9783         />
  9784                                            
  9785        </xsl:call -template>
  9786                                  
  9787       </xsl:when >
  9788                                 
  9789       <xsl:when 
  9790        test="n1:t ext/n1:con tent[@ID=$ ref2]"
  9791       >
  9792                                           
  9793        <xsl:call- template 
  9794         name="form atComments "
  9795        >
  9796                                                    
  9797         <xsl:with- param 
  9798          name="comm ents" 
  9799          select="n1 :text/n1:c ontent[@ID =$ref2]" 
  9800         />
  9801                                            
  9802        </xsl:call -template>
  9803                                  
  9804       </xsl:when >
  9805                                 
  9806       <xsl:other wise>
  9807                                  
  9808       </xsl:othe rwise>
  9809                        
  9810      </xsl:choo se>
  9811              
  9812     </xsl:temp late>
  9813    
  9814             
  9815     <!-- Probl em Comment s -->
  9816             
  9817     <xsl:templ ate 
  9818      name="prob Comments"
  9819     >
  9820                       
  9821      <xsl:param  
  9822       name="sect ion" 
  9823      />
  9824                       
  9825      <xsl:varia ble 
  9826       name="ref1 "
  9827                                
  9828       select="n1 :entry/n1: act/n1:tex t/n1:refer ence/@valu e" 
  9829      />
  9830                       
  9831      <xsl:varia ble 
  9832       name="ref2
  9833       select="su bstring-af ter($ref1, '#')" 
  9834      />
  9835                       
  9836      <xsl:choos e>
  9837                                 
  9838       <xsl:when 
  9839        test="n1:t ext/n1:con tent[@ID=$ ref1]"
  9840       >
  9841                                           
  9842        <xsl:call- template 
  9843         name="form atComments "
  9844        >
  9845                                                    
  9846         <xsl:with- param 
  9847          name="comm ents" 
  9848          select="n1 :text/n1:c ontent[@ID =$ref1]" 
  9849         />
  9850                                            
  9851        </xsl:call -template>
  9852                                  
  9853       </xsl:when >
  9854                                 
  9855       <xsl:when 
  9856        test="n1:t ext/n1:con tent[@ID=$ ref2]"
  9857       >
  9858                                           
  9859        <xsl:call- template 
  9860         name="form atComments "
  9861        >
  9862                                                    
  9863         <xsl:with- param 
  9864          name="comm ents" 
  9865          select="n1 :text/n1:c ontent[@ID =$ref2]" 
  9866         />
  9867                                            
  9868        </xsl:call -template>
  9869                                  
  9870       </xsl:when >
  9871                                 
  9872       <xsl:other wise>
  9873                                  
  9874       </xsl:othe rwise>
  9875                        
  9876      </xsl:choo se>
  9877              
  9878     </xsl:temp late>
  9879    
  9880             
  9881     <!-- Aller gy Comment s -->
  9882             
  9883     <xsl:templ ate 
  9884      name="alle rgyComment s"
  9885     >
  9886                       
  9887      <xsl:param  
  9888       name="sect ion" 
  9889      />
  9890                       
  9891      <xsl:varia ble 
  9892       name="ref1 "
  9893                                
  9894       select="n1 :entry/n1: act/n1:tex t/n1:refer ence/@valu e" 
  9895      />
  9896                       
  9897      <xsl:varia ble 
  9898       name="ref2
  9899       select="su bstring-af ter($ref1, '#')" 
  9900      />
  9901                       
  9902      <xsl:choos e>
  9903                                 
  9904       <xsl:when 
  9905        test="n1:t ext/n1:con tent[@ID=$ ref1]"
  9906       >
  9907                                           
  9908        <xsl:call- template 
  9909         name="form atComments "
  9910        >
  9911                                                    
  9912         <xsl:with- param 
  9913          name="comm ents" 
  9914          select="n1 :text/n1:c ontent[@ID =$ref1]" 
  9915         />
  9916                                            
  9917        </xsl:call -template>
  9918                                  
  9919       </xsl:when >
  9920                                 
  9921       <xsl:when 
  9922        test="n1:t ext/n1:con tent[@ID=$ ref2]"
  9923       >
  9924                                           
  9925        <xsl:call- template 
  9926         name="form atComments "
  9927        >
  9928                                                    
  9929         <xsl:with- param 
  9930          name="comm ents" 
  9931          select="n1 :text/n1:c ontent[@ID =$ref2]" 
  9932         />
  9933                                            
  9934        </xsl:call -template>
  9935                                  
  9936       </xsl:when >
  9937                                 
  9938       <xsl:other wise>
  9939                                  
  9940       </xsl:othe rwise>
  9941                        
  9942      </xsl:choo se>
  9943              
  9944     </xsl:temp late>
  9945    
  9946             
  9947     <!-- Resul ts Comment s -->
  9948             
  9949     <xsl:templ ate 
  9950      name="resu ltsComment s"
  9951     >
  9952                       
  9953      <xsl:param  
  9954       name="sect ion" 
  9955      />
  9956                       
  9957      <xsl:varia ble 
  9958       name="ref1 "
  9959                                
  9960       select="n1 :entry/n1: act/n1:tex t/n1:refer ence/@valu e" 
  9961      />
  9962                       
  9963      <xsl:varia ble 
  9964       name="ref2
  9965       select="su bstring-af ter($ref1, '#')" 
  9966      />
  9967                       
  9968      <xsl:choos e>
  9969                                 
  9970       <xsl:when 
  9971        test="n1:t ext/n1:con tent[@ID=$ ref1]"
  9972       >
  9973                                           
  9974        <xsl:call- template 
  9975         name="form atComments "
  9976        >
  9977                                                    
  9978         <xsl:with- param 
  9979          name="comm ents" 
  9980          select="n1 :text/n1:c ontent[@ID =$ref1]" 
  9981         />
  9982                                            
  9983        </xsl:call -template>
  9984                                  
  9985       </xsl:when >
  9986                                 
  9987       <xsl:when 
  9988        test="n1:t ext/n1:con tent[@ID=$ ref2]"
  9989       >
  9990                                           
  9991        <xsl:call- template 
  9992         name="form atComments "
  9993        >
  9994                                                    
  9995         <xsl:with- param 
  9996          name="comm ents" 
  9997          select="n1 :text/n1:c ontent[@ID =$ref2]" 
  9998         />
  9999                                            
  10000        </xsl:call -template>
  10001                                  
  10002       </xsl:when >
  10003                                 
  10004       <xsl:other wise>
  10005                                  
  10006       </xsl:othe rwise>
  10007                        
  10008      </xsl:choo se>
  10009              
  10010     </xsl:temp late>
  10011    
  10012             
  10013     <!-- Encou nters Comm ents -->
  10014             
  10015     <!-- Proce dures Comm ents -->
  10016             
  10017     <!-- heade r elements  -->
  10018             
  10019     <xsl:templ ate 
  10020      name="docu mentGenera l"
  10021     >
  10022                       
  10023      <table 
  10024       class="hea der_table"
  10025      >
  10026                                 
  10027       <tbody>
  10028                                           
  10029        <tr 
  10030         class="tr_ header"
  10031        >
  10032                                                    
  10033         <td 
  10034          width="20%
  10035          class="td_ header_lab el"
  10036         >
  10037                                                              
  10038          <span 
  10039           class="td_ label"
  10040          >
  10041                                                                        
  10042           <xsl:text>
  10043            Document I d
  10044           </xsl:text >
  10045                                                               
  10046          </span>
  10047                                                     
  10048         </td>
  10049                                                    
  10050         <td 
  10051          width="80% "
  10052         >
  10053                                                              
  10054          <xsl:call- template 
  10055           name="show -id"
  10056          >
  10057                                                                        
  10058           <xsl:with- param 
  10059            name="id" 
  10060            select="n1 :id" 
  10061           />
  10062                                                               
  10063          </xsl:call -template>
  10064                                                     
  10065         </td>
  10066                                            
  10067        </tr>
  10068                                           
  10069        <tr 
  10070         class="tr_ header"
  10071        >
  10072                                                    
  10073         <td 
  10074          width="20%
  10075          class="td_ header_lab el"
  10076         >
  10077                                                              
  10078          <span 
  10079           class="td_ label"
  10080          >
  10081                                                                        
  10082           <xsl:text>
  10083            Document C reated:
  10084           </xsl:text >
  10085                                                               
  10086          </span>
  10087                                                     
  10088         </td>
  10089                                                    
  10090         <td 
  10091          width="80% "
  10092         >
  10093                                                              
  10094          <xsl:call- template 
  10095           name="show -time"
  10096          >
  10097                                                                        
  10098           <xsl:with- param 
  10099            name="date time" 
  10100            select="n1 :effective Time" 
  10101           />
  10102                                                               
  10103          </xsl:call -template>
  10104                                                     
  10105         </td>
  10106                                            
  10107        </tr>
  10108                                  
  10109       </tbody>
  10110                        
  10111      </table>
  10112              
  10113     </xsl:temp late>
  10114             
  10115     <!-- confi dentiality  -->
  10116             
  10117     <xsl:templ ate 
  10118      name="conf identialit y"
  10119     >
  10120                       
  10121      <table 
  10122       class="hea der_table"
  10123      >
  10124                                 
  10125       <tbody>
  10126                                           
  10127        <tr 
  10128         class="tr_ header"
  10129        >
  10130                                                    
  10131         <td 
  10132          width="20%
  10133          class="td_ header_lab el"
  10134         >
  10135                                                              
  10136          <xsl:text>
  10137           Confidenti ality
  10138          </xsl:text >
  10139                                                     
  10140         </td>
  10141                                                    
  10142         <td 
  10143          width="80% "
  10144         >
  10145                                                              
  10146          <xsl:choos e>
  10147                                                                        
  10148           <xsl:when 
  10149            test="n1:c onfidentia lityCode/@ code  = &a pos;N&apos ;"
  10150           >
  10151                                                                                  
  10152            <xsl:text>
  10153             Normal
  10154            </xsl:text >
  10155                                                                         
  10156           </xsl:when >
  10157                                                                        
  10158           <xsl:when 
  10159            test="n1:c onfidentia lityCode/@ code  = &a pos;R&apos ;"
  10160           >
  10161                                                                                  
  10162            <xsl:text>
  10163             Restricted
  10164            </xsl:text >
  10165                                                                         
  10166           </xsl:when >
  10167                                                                        
  10168           <xsl:when 
  10169            test="n1:c onfidentia lityCode/@ code  = &a pos;V&apos ;"
  10170           >
  10171                                                                                  
  10172            <xsl:text>
  10173             Very restr icted
  10174            </xsl:text >
  10175                                                                         
  10176           </xsl:when >
  10177                                                               
  10178          </xsl:choo se>
  10179                                                              
  10180          <xsl:if 
  10181           test="n1:c onfidentia lityCode/n 1:original Text"
  10182          >
  10183                                                                        
  10184           <xsl:text>
  10185             
  10186           </xsl:text >
  10187                                                                        
  10188           <xsl:value -of 
  10189            select="n1 :confident ialityCode /n1:origin alText" 
  10190           />
  10191                                                               
  10192          </xsl:if>
  10193                                                     
  10194         </td>
  10195                                            
  10196        </tr>
  10197                                  
  10198       </tbody>
  10199                        
  10200      </table>
  10201              
  10202     </xsl:temp late>
  10203             
  10204     <!-- autho r -->
  10205             
  10206     <xsl:templ ate 
  10207      name="auth or"
  10208     >
  10209                       
  10210      <xsl:if 
  10211       test="n1:a uthor"
  10212      >
  10213                                 
  10214       <table 
  10215        class="hea der_table"
  10216       >
  10217                                           
  10218        <tbody>
  10219                                                    
  10220         <xsl:for-e ach 
  10221          select="n1 :author/n1 :assignedA uthor"
  10222         >
  10223                                                              
  10224          <tr 
  10225           class="tr_ header"
  10226          >
  10227                                                                        
  10228           <td 
  10229            width="20%
  10230            class="td_ header_lab el"
  10231           >
  10232                                                                                  
  10233            <span 
  10234             class="td_ label"
  10235            >
  10236                                                                                            
  10237             <xsl:text>
  10238              Author
  10239             </xsl:text >
  10240                                                                                   
  10241            </span>
  10242                                                                         
  10243           </td>
  10244                                                                        
  10245           <td 
  10246            width="80% "
  10247           >
  10248                                                                                  
  10249            <xsl:choos e>
  10250                                                                                            
  10251             <xsl:when 
  10252              test="n1:a ssignedPer son/n1:nam e"
  10253             >
  10254                                                                                                     
  10255              <xsl:call- template 
  10256               name="show -name"
  10257              >
  10258                                                                                                               
  10259               <xsl:with- param 
  10260                name="name "
  10261                                                                                                                        
  10262                select="n1 :assignedP erson/n1:n ame" 
  10263               />
  10264                                                                                                      
  10265              </xsl:call -template>
  10266                                                                                                     
  10267              <xsl:if 
  10268               test="n1:r epresented Organizati on"
  10269              >
  10270                                                                                                               
  10271               <xsl:text>
  10272               
  10273               </xsl:text >
  10274                                                                                                               
  10275               <xsl:call- template 
  10276                name="show -name"
  10277               >
  10278                                                                                                                         
  10279                <xsl:with- param 
  10280                 name="name "
  10281                                                                                                                                  
  10282                 select="n1 :represent edOrganiza tion/n1:na me" 
  10283                />
  10284                                                                                                                
  10285               </xsl:call -template>
  10286                                                                                                      
  10287              </xsl:if>
  10288                                                                                             
  10289             </xsl:when >
  10290                                                                                            
  10291             <xsl:when 
  10292              test="n1:a ssignedAut horingDevi ce/n1:soft wareName"
  10293             >
  10294                                                                                                     
  10295              <xsl:value -of 
  10296               select="n1 :assignedA uthoringDe vice/n1:so ftwareName
  10297              />
  10298                                                                                             
  10299             </xsl:when >
  10300                                                                                            
  10301             <xsl:when 
  10302              test="n1:r epresented Organizati on"
  10303             >
  10304                                                                                                     
  10305              <xsl:call- template 
  10306               name="show -name"
  10307              >
  10308                                                                                                               
  10309               <xsl:with- param 
  10310                name="name "
  10311                                                                                                                        
  10312                select="n1 :represent edOrganiza tion/n1:na me" 
  10313               />
  10314                                                                                                      
  10315              </xsl:call -template>
  10316                                                                                             
  10317             </xsl:when >
  10318                                                                                            
  10319             <xsl:other wise>
  10320                                                                                                     
  10321              <xsl:for-e ach 
  10322               select="n1 :id"
  10323              >
  10324                                                                                                               
  10325               <xsl:call- template 
  10326                name="show -id" 
  10327               />
  10328                                                                                                               
  10329               <br />
  10330                                                                                                      
  10331              </xsl:for- each>
  10332                                                                                             
  10333             </xsl:othe rwise>
  10334                                                                                   
  10335            </xsl:choo se>
  10336                                                                         
  10337           </td>
  10338                                                               
  10339          </tr>
  10340                                                              
  10341          <xsl:if 
  10342           test="n1:a ddr | n1:t elecom"
  10343          >
  10344                                                                        
  10345           <tr 
  10346            class="tr_ header"
  10347           >
  10348                                                                                  
  10349            <td 
  10350             width="20%
  10351             class="td_ header_lab el"
  10352            >
  10353                                                                                            
  10354             <span 
  10355              class="td_ label"
  10356             >
  10357                                                                                                     
  10358              <xsl:text>
  10359               Contact in fo
  10360              </xsl:text >
  10361                                                                                             
  10362             </span>
  10363                                                                                   
  10364            </td>
  10365                                                                                  
  10366            <td 
  10367             width="80% "
  10368            >
  10369                                                                                            
  10370             <xsl:call- template 
  10371              name="show -contactIn fo"
  10372             >
  10373                                                                                                     
  10374              <xsl:with- param 
  10375               name="cont act" 
  10376               select="."  
  10377              />
  10378                                                                                             
  10379             </xsl:call -template>
  10380                                                                                   
  10381            </td>
  10382                                                                         
  10383           </tr>
  10384                                                               
  10385          </xsl:if>
  10386                                                     
  10387         </xsl:for- each>
  10388                                            
  10389        </tbody>
  10390                                  
  10391       </table>
  10392                        
  10393      </xsl:if>
  10394              
  10395     </xsl:temp late>
  10396             
  10397     <!-- authe nticator - ->
  10398             
  10399     <xsl:templ ate 
  10400      name="auth enticator"
  10401     >
  10402                       
  10403      <xsl:if 
  10404       test="n1:a uthenticat or"
  10405      >
  10406                                 
  10407       <table 
  10408        class="hea der_table"
  10409       >
  10410                                           
  10411        <tbody>
  10412                                                    
  10413         <tr>
  10414                                                              
  10415          <xsl:for-e ach 
  10416           select="n1 :authentic ator"
  10417          >
  10418                                                                        
  10419           <tr 
  10420            class="tr_ header"
  10421           >
  10422                                                                                  
  10423            <td 
  10424             width="20%
  10425             class="td_ header_lab el"
  10426            >
  10427                                                                                            
  10428             <span 
  10429              class="td_ label"
  10430             >
  10431                                                                                                     
  10432              <xsl:text>
  10433               Signed 
  10434              </xsl:text >
  10435                                                                                             
  10436             </span>
  10437                                                                                   
  10438            </td>
  10439                                                                                  
  10440            <td 
  10441             width="80% "
  10442            >
  10443                                                                                            
  10444             <xsl:call- template 
  10445              name="show -name"
  10446             >
  10447                                                                                                     
  10448              <xsl:with- param 
  10449               name="name "
  10450                                                                                                              
  10451               select="n1 :assignedE ntity/n1:a ssignedPer son/n1:nam e" 
  10452              />
  10453                                                                                             
  10454             </xsl:call -template>
  10455                                                                                            
  10456             <xsl:text>
  10457               at 
  10458             </xsl:text >
  10459                                                                                            
  10460             <xsl:call- template 
  10461              name="show -time"
  10462             >
  10463                                                                                                     
  10464              <xsl:with- param 
  10465               name="date
  10466               select="n1 :time" 
  10467              />
  10468                                                                                             
  10469             </xsl:call -template>
  10470                                                                                   
  10471            </td>
  10472                                                                         
  10473           </tr>
  10474                                                                        
  10475           <xsl:if
  10476                                                                                 
  10477            test="n1:a ssignedEnt ity/n1:add r | n1:ass ignedEntit y/n1:telec om"
  10478           >
  10479                                                                                  
  10480            <tr 
  10481             class="tr_ header"
  10482            >
  10483                                                                                            
  10484             <td 
  10485              width="20%
  10486              class="td_ header_lab el"
  10487             >
  10488                                                                                                     
  10489              <span 
  10490               class="td_ label"
  10491              >
  10492                                                                                                               
  10493               <xsl:text>
  10494                Contact in fo
  10495               </xsl:text >
  10496                                                                                                      
  10497              </span>
  10498                                                                                             
  10499             </td>
  10500                                                                                            
  10501             <td 
  10502              width="80% "
  10503             >
  10504                                                                                                     
  10505              <xsl:call- template 
  10506               name="show -contactIn fo"
  10507              >
  10508                                                                                                               
  10509               <xsl:with- param 
  10510                name="cont act" 
  10511                select="n1 :assignedE ntity" 
  10512               />
  10513                                                                                                      
  10514              </xsl:call -template>
  10515                                                                                             
  10516             </td>
  10517                                                                                   
  10518            </tr>
  10519                                                                         
  10520           </xsl:if>
  10521                                                               
  10522          </xsl:for- each>
  10523                                                     
  10524         </tr>
  10525                                            
  10526        </tbody>
  10527                                  
  10528       </table>
  10529                        
  10530      </xsl:if>
  10531              
  10532     </xsl:temp late>
  10533             
  10534     <!-- legal Authentica tor -->
  10535             
  10536     <xsl:templ ate 
  10537      name="lega lAuthentic ator"
  10538     >
  10539                       
  10540      <xsl:if 
  10541       test="n1:l egalAuthen ticator"
  10542      >
  10543                                 
  10544       <table 
  10545        class="hea der_table"
  10546       >
  10547                                           
  10548        <tbody>
  10549                                                    
  10550         <tr 
  10551          class="tr_ header"
  10552         >
  10553                                                              
  10554          <td 
  10555           width="20%
  10556           class="td_ header_lab el"
  10557          >
  10558                                                                        
  10559           <span 
  10560            class="td_ label"
  10561           >
  10562                                                                                  
  10563            <xsl:text>
  10564             Legal auth enticator
  10565            </xsl:text >
  10566                                                                         
  10567           </span>
  10568                                                               
  10569          </td>
  10570                                                              
  10571          <td 
  10572           width="80% "
  10573          >
  10574                                                                        
  10575           <xsl:call- template 
  10576            name="show -assignedE ntity"
  10577           >
  10578                                                                                  
  10579            <xsl:with- param 
  10580             name="asgn Entity"
  10581                                                                                           
  10582             select="n1 :legalAuth enticator/ n1:assigne dEntity" 
  10583            />
  10584                                                                         
  10585           </xsl:call -template>
  10586                                                                        
  10587           <xsl:text>
  10588             
  10589           </xsl:text >
  10590                                                                        
  10591           <xsl:call- template 
  10592            name="show -sig"
  10593           >
  10594                                                                                  
  10595            <xsl:with- param 
  10596             name="sig"
  10597                                                                                           
  10598             select="n1 :legalAuth enticator/ n1:signatu reCode" 
  10599            />
  10600                                                                         
  10601           </xsl:call -template>
  10602                                                                        
  10603           <xsl:if 
  10604            test="n1:l egalAuthen ticator/n1 :time/@val ue"
  10605           >
  10606                                                                                  
  10607            <xsl:text>
  10608              at 
  10609            </xsl:text >
  10610                                                                                  
  10611            <xsl:call- template 
  10612             name="show -time"
  10613            >
  10614                                                                                            
  10615             <xsl:with- param 
  10616              name="date time"
  10617                                                                                                    
  10618              select="n1 :legalAuth enticator/ n1:time" 
  10619             />
  10620                                                                                   
  10621            </xsl:call -template>
  10622                                                                         
  10623           </xsl:if>
  10624                                                               
  10625          </td>
  10626                                                     
  10627         </tr>
  10628                                                    
  10629         <xsl:if
  10630                                                             
  10631          test="n1:l egalAuthen ticator/n1 :assignedE ntity/n1:a ddr | n1:l egalAuthen ticator/n1 :assignedE ntity/n1:t elecom"
  10632         >
  10633                                                              
  10634          <tr 
  10635           class="tr_ header"
  10636          >
  10637                                                                        
  10638           <td 
  10639            width="20%
  10640            class="td_ header_lab el"
  10641           >
  10642                                                                                  
  10643            <span 
  10644             class="td_ label"
  10645            >
  10646                                                                                            
  10647             <xsl:text>
  10648              Contact in fo
  10649             </xsl:text >
  10650                                                                                   
  10651            </span>
  10652                                                                         
  10653           </td>
  10654                                                                        
  10655           <td 
  10656            width="80% "
  10657           >
  10658                                                                                  
  10659            <xsl:call- template 
  10660             name="show -contactIn fo"
  10661            >
  10662                                                                                            
  10663             <xsl:with- param 
  10664              name="cont act"
  10665                                                                                                    
  10666              select="n1 :legalAuth enticator/ n1:assigne dEntity" 
  10667             />
  10668                                                                                   
  10669            </xsl:call -template>
  10670                                                                         
  10671           </td>
  10672                                                               
  10673          </tr>
  10674                                                     
  10675         </xsl:if>
  10676                                            
  10677        </tbody>
  10678                                  
  10679       </table>
  10680                        
  10681      </xsl:if>
  10682              
  10683     </xsl:temp late>
  10684             
  10685     <!-- dataE nterer -->
  10686             
  10687     <xsl:templ ate 
  10688      name="data Enterer"
  10689     >
  10690                       
  10691      <xsl:if 
  10692       test="n1:d ataEnterer "
  10693      >
  10694                                 
  10695       <table 
  10696        class="hea der_table"
  10697       >
  10698                                           
  10699        <tbody>
  10700                                                    
  10701         <tr 
  10702          class="tr_ header"
  10703         >
  10704                                                              
  10705          <td 
  10706           width="20%
  10707           class="td_ header_lab el"
  10708          >
  10709                                                                        
  10710           <span 
  10711            class="td_ label"
  10712           >
  10713                                                                                  
  10714            <xsl:text>
  10715             Entered by
  10716            </xsl:text >
  10717                                                                         
  10718           </span>
  10719                                                               
  10720          </td>
  10721                                                              
  10722          <td 
  10723           width="80% "
  10724          >
  10725                                                                        
  10726           <xsl:call- template 
  10727            name="show -assignedE ntity"
  10728           >
  10729                                                                                  
  10730            <xsl:with- param 
  10731             name="asgn Entity"
  10732                                                                                           
  10733             select="n1 :dataEnter er/n1:assi gnedEntity
  10734            />
  10735                                                                         
  10736           </xsl:call -template>
  10737                                                               
  10738          </td>
  10739                                                     
  10740         </tr>
  10741                                                    
  10742         <xsl:if
  10743                                                             
  10744          test="n1:d ataEnterer /n1:assign edEntity/n 1:addr | n 1:dataEnte rer/n1:ass ignedEntit y/n1:telec om"
  10745         >
  10746                                                              
  10747          <tr 
  10748           class="tr_ header"
  10749          >
  10750                                                                        
  10751           <td 
  10752            width="20%
  10753            class="td_ header_lab el"
  10754           >
  10755                                                                                  
  10756            <span 
  10757             class="td_ label"
  10758            >
  10759                                                                                            
  10760             <xsl:text>
  10761              Contact in fo
  10762             </xsl:text >
  10763                                                                                   
  10764            </span>
  10765                                                                         
  10766           </td>
  10767                                                                        
  10768           <td 
  10769            width="80% "
  10770           >
  10771                                                                                  
  10772            <xsl:call- template 
  10773             name="show -contactIn fo"
  10774            >
  10775                                                                                            
  10776             <xsl:with- param 
  10777              name="cont act"
  10778                                                                                                    
  10779              select="n1 :dataEnter er/n1:assi gnedEntity
  10780             />
  10781                                                                                   
  10782            </xsl:call -template>
  10783                                                                         
  10784           </td>
  10785                                                               
  10786          </tr>
  10787                                                     
  10788         </xsl:if>
  10789                                            
  10790        </tbody>
  10791                                  
  10792       </table>
  10793                        
  10794      </xsl:if>
  10795              
  10796     </xsl:temp late>
  10797             
  10798     <!-- compo nentOf -->
  10799             
  10800     <xsl:templ ate 
  10801      name="comp onentof"
  10802     >
  10803                       
  10804      <xsl:if 
  10805       test="n1:c omponentOf "
  10806      >
  10807                                 
  10808       <table 
  10809        class="hea der_table"
  10810       >
  10811                                           
  10812        <tbody>
  10813                                                    
  10814         <xsl:for-e ach 
  10815          select="n1 :component Of/n1:enco mpassingEn counter"
  10816         >
  10817                                                              
  10818          <xsl:if 
  10819           test="n1:i d"
  10820          >
  10821                                                                        
  10822           <tr 
  10823            class="tr_ header"
  10824           >
  10825                                                                                  
  10826            <xsl:choos e>
  10827                                                                                            
  10828             <xsl:when 
  10829              test="n1:c ode"
  10830             >
  10831                                                                                                     
  10832              <td 
  10833               width="20%
  10834               class="td_ header_lab el"
  10835              >
  10836                                                                                                               
  10837               <span 
  10838                class="td_ label"
  10839               >
  10840                                                                                                                         
  10841                <xsl:text>
  10842                 Encounter  Id
  10843                </xsl:text >
  10844                                                                                                                
  10845               </span>
  10846                                                                                                      
  10847              </td>
  10848                                                                                                     
  10849              <td 
  10850               width="30% "
  10851              >
  10852                                                                                                               
  10853               <xsl:call- template 
  10854                name="show -id"
  10855               >
  10856                                                                                                                         
  10857                <xsl:with- param 
  10858                 name="id" 
  10859                 select="n1 :id" 
  10860                />
  10861                                                                                                                
  10862               </xsl:call -template>
  10863                                                                                                      
  10864              </td>
  10865                                                                                                     
  10866              <td 
  10867               width="20%
  10868               class="td_ header_lab el"
  10869              >
  10870                                                                                                               
  10871               <span 
  10872                class="td_ label"
  10873               >
  10874                                                                                                                         
  10875                <xsl:text>
  10876                 Encounter  Type
  10877                </xsl:text >
  10878                                                                                                                
  10879               </span>
  10880                                                                                                      
  10881              </td>
  10882                                                                                                     
  10883              <td 
  10884               width="30% "
  10885              >
  10886                                                                                                               
  10887               <xsl:call- template 
  10888                name="show -code"
  10889               >
  10890                                                                                                                         
  10891                <xsl:with- param 
  10892                 name="code
  10893                 select="n1 :code" 
  10894                />
  10895                                                                                                                
  10896               </xsl:call -template>
  10897                                                                                                      
  10898              </td>
  10899                                                                                             
  10900             </xsl:when >
  10901                                                                                            
  10902             <xsl:other wise>
  10903                                                                                                     
  10904              <td 
  10905               width="20%
  10906               class="td_ header_lab el"
  10907              >
  10908                                                                                                               
  10909               <span 
  10910                class="td_ label"
  10911               >
  10912                                                                                                                         
  10913                <xsl:text>
  10914                 Encounter  Id
  10915                </xsl:text >
  10916                                                                                                                
  10917               </span>
  10918                                                                                                      
  10919              </td>
  10920                                                                                                     
  10921              <td 
  10922               width="80% "
  10923              >
  10924                                                                                                               
  10925               <xsl:call- template 
  10926                name="show -id"
  10927               >
  10928                                                                                                                         
  10929                <xsl:with- param 
  10930                 name="id" 
  10931                 select="n1 :id" 
  10932                />
  10933                                                                                                                
  10934               </xsl:call -template>
  10935                                                                                                      
  10936              </td>
  10937                                                                                             
  10938             </xsl:othe rwise>
  10939                                                                                   
  10940            </xsl:choo se>
  10941                                                                         
  10942           </tr>
  10943                                                               
  10944          </xsl:if>
  10945                                                              
  10946          <tr 
  10947           class="tr_ header"
  10948          >
  10949                                                                        
  10950           <td 
  10951            width="20%
  10952            class="td_ header_lab el"
  10953           >
  10954                                                                                  
  10955            <span 
  10956             class="td_ label"
  10957            >
  10958                                                                                            
  10959             <xsl:text>
  10960              Encounter  Date
  10961             </xsl:text >
  10962                                                                                   
  10963            </span>
  10964                                                                         
  10965           </td>
  10966                                                                        
  10967           <td 
  10968            width="80%
  10969            colspan="3 "
  10970           >
  10971                                                                                  
  10972            <xsl:if 
  10973             test="n1:e ffectiveTi me"
  10974            >
  10975                                                                                            
  10976             <xsl:choos e>
  10977                                                                                                     
  10978              <xsl:when 
  10979               test="n1:e ffectiveTi me/@value"
  10980              >
  10981                                                                                                               
  10982               <xsl:text>
  10983                &#160;at&# 160;
  10984               </xsl:text >
  10985                                                                                                               
  10986               <xsl:call- template 
  10987                name="show -time"
  10988               >
  10989                                                                                                                         
  10990                <xsl:with- param 
  10991                 name="date time" 
  10992                 select="n1 :effective Time" 
  10993                />
  10994                                                                                                                
  10995               </xsl:call -template>
  10996                                                                                                      
  10997              </xsl:when >
  10998                                                                                                     
  10999              <xsl:when 
  11000               test="n1:e ffectiveTi me/n1:low"
  11001              >
  11002                                                                                                               
  11003               <xsl:text>
  11004                &#160;From &#160;
  11005               </xsl:text >
  11006                                                                                                               
  11007               <xsl:call- template 
  11008                name="show -time"
  11009               >
  11010                                                                                                                         
  11011                <xsl:with- param 
  11012                 name="date time"
  11013                                                                                                                                  
  11014                 select="n1 :effective Time/n1:lo w" 
  11015                />
  11016                                                                                                                
  11017               </xsl:call -template>
  11018                                                                                                               
  11019               <xsl:if 
  11020                test="n1:e ffectiveTi me/n1:high "
  11021               >
  11022                                                                                                                         
  11023                <xsl:text>
  11024                  to 
  11025                </xsl:text >
  11026                                                                                                                         
  11027                <xsl:call- template 
  11028                 name="show -time"
  11029                >
  11030                                                                                                                                   
  11031                 <xsl:with- param 
  11032                  name="date time"
  11033                                                                                                                                            
  11034                  select="n1 :effective Time/n1:hi gh" 
  11035                 />
  11036                                                                                                                          
  11037                </xsl:call -template>
  11038                                                                                                                
  11039               </xsl:if>
  11040                                                                                                      
  11041              </xsl:when >
  11042                                                                                             
  11043             </xsl:choo se>
  11044                                                                                   
  11045            </xsl:if>
  11046                                                                         
  11047           </td>
  11048                                                               
  11049          </tr>
  11050                                                              
  11051          <xsl:if 
  11052           test="n1:l ocation/n1 :healthCar eFacility"
  11053          >
  11054                                                                        
  11055           <tr 
  11056            class="tr_ header"
  11057           >
  11058                                                                                  
  11059            <td 
  11060             width="20%
  11061             class="td_ header_lab el"
  11062            >
  11063                                                                                            
  11064             <span 
  11065              class="td_ label"
  11066             >
  11067                                                                                                     
  11068              <xsl:text>
  11069               Encounter  Location
  11070              </xsl:text >
  11071                                                                                             
  11072             </span>
  11073                                                                                   
  11074            </td>
  11075                                                                                  
  11076            <td 
  11077             width="80%
  11078             colspan="3 "
  11079            >
  11080                                                                                            
  11081             <xsl:choos e>
  11082                                                                                                     
  11083              <xsl:when
  11084                                                                                                              
  11085               test="n1:l ocation/n1 :healthCar eFacility/ n1:locatio n/n1:name"
  11086              >
  11087                                                                                                               
  11088               <xsl:call- template 
  11089                name="show -name"
  11090               >
  11091                                                                                                                         
  11092                <xsl:with- param 
  11093                 name="name "
  11094                                                                                                                                  
  11095                 select="n1 :location/ n1:healthC areFacilit y/n1:locat ion/n1:nam e" 
  11096                />
  11097                                                                                                                
  11098               </xsl:call -template>
  11099                                                                                                               
  11100               <xsl:for-e ach
  11101                                                                                                                        
  11102                select="n1 :location/ n1:healthC areFacilit y/n1:servi ceProvider Organizati on/n1:name "
  11103               >
  11104                                                                                                                         
  11105                <xsl:text>
  11106                  of 
  11107                </xsl:text >
  11108                                                                                                                         
  11109                <xsl:call- template 
  11110                 name="show -name"
  11111                >
  11112                                                                                                                                   
  11113                 <xsl:with- param 
  11114                  name="name "
  11115                                                                                                                                            
  11116                  select="n1 :location/ n1:healthC areFacilit y/n1:servi ceProvider Organizati on/n1:name
  11117                 />
  11118                                                                                                                          
  11119                </xsl:call -template>
  11120                                                                                                                
  11121               </xsl:for- each>
  11122                                                                                                      
  11123              </xsl:when >
  11124                                                                                                     
  11125              <xsl:when 
  11126               test="n1:l ocation/n1 :healthCar eFacility/ n1:code"
  11127              >
  11128                                                                                                               
  11129               <xsl:call- template 
  11130                name="show -code"
  11131               >
  11132                                                                                                                         
  11133                <xsl:with- param 
  11134                 name="code "
  11135                                                                                                                                  
  11136                 select="n1 :location/ n1:healthC areFacilit y/n1:code"  
  11137                />
  11138                                                                                                                
  11139               </xsl:call -template>
  11140                                                                                                      
  11141              </xsl:when >
  11142                                                                                                     
  11143              <xsl:other wise>
  11144                                                                                                               
  11145               <xsl:if 
  11146                test="n1:l ocation/n1 :healthCar eFacility/ n1:id"
  11147               >
  11148                                                                                                                         
  11149                <xsl:text>
  11150                 id: 
  11151                </xsl:text >
  11152                                                                                                                         
  11153                <xsl:for-e ach 
  11154                 select="n1 :location/ n1:healthC areFacilit y/n1:id"
  11155                >
  11156                                                                                                                                   
  11157                 <xsl:call- template 
  11158                  name="show -id"
  11159                 >
  11160                                                                                                                                             
  11161                  <xsl:with- param 
  11162                   name="id" 
  11163                   select="."  
  11164                  />
  11165                                                                                                                                    
  11166                 </xsl:call -template>
  11167                                                                                                                          
  11168                </xsl:for- each>
  11169                                                                                                                
  11170               </xsl:if>
  11171                                                                                                      
  11172              </xsl:othe rwise>
  11173                                                                                             
  11174             </xsl:choo se>
  11175                                                                                   
  11176            </td>
  11177                                                                         
  11178           </tr>
  11179                                                               
  11180          </xsl:if>
  11181                                                              
  11182          <xsl:if 
  11183           test="n1:r esponsible Party"
  11184          >
  11185                                                                        
  11186           <tr 
  11187            class="tr_ header"
  11188           >
  11189                                                                                  
  11190            <td 
  11191             width="20%
  11192             class="td_ header_lab el"
  11193            >
  11194                                                                                            
  11195             <span 
  11196              class="td_ label"
  11197             >
  11198                                                                                                     
  11199              <xsl:text>
  11200               Responsibl e party
  11201              </xsl:text >
  11202                                                                                             
  11203             </span>
  11204                                                                                   
  11205            </td>
  11206                                                                                  
  11207            <td 
  11208             width="80%
  11209             colspan="3 "
  11210            >
  11211                                                                                            
  11212             <xsl:call- template 
  11213              name="show -assignedE ntity"
  11214             >
  11215                                                                                                     
  11216              <xsl:with- param 
  11217               name="asgn Entity"
  11218                                                                                                              
  11219               select="n1 :responsib leParty/n1 :assignedE ntity" 
  11220              />
  11221                                                                                             
  11222             </xsl:call -template>
  11223                                                                                   
  11224            </td>
  11225                                                                         
  11226           </tr>
  11227                                                               
  11228          </xsl:if>
  11229                                                              
  11230          <xsl:if
  11231                                                                       
  11232           test="n1:r esponsible Party/n1:a ssignedEnt ity/n1:add r | n1:res ponsiblePa rty/n1:ass ignedEntit y/n1:telec om"
  11233          >
  11234                                                                        
  11235           <tr 
  11236            class="tr_ header"
  11237           >
  11238                                                                                  
  11239            <td 
  11240             width="20%
  11241             class="td_ header_lab el"
  11242            >
  11243                                                                                            
  11244             <span 
  11245              class="td_ label"
  11246             >
  11247                                                                                                     
  11248              <xsl:text>
  11249               Contact in fo
  11250              </xsl:text >
  11251                                                                                             
  11252             </span>
  11253                                                                                   
  11254            </td>
  11255                                                                                  
  11256            <td 
  11257             width="80%
  11258             colspan="3 "
  11259            >
  11260                                                                                            
  11261             <xsl:call- template 
  11262              name="show -contactIn fo"
  11263             >
  11264                                                                                                     
  11265              <xsl:with- param 
  11266               name="cont act"
  11267                                                                                                              
  11268               select="n1 :responsib leParty/n1 :assignedE ntity" 
  11269              />
  11270                                                                                             
  11271             </xsl:call -template>
  11272                                                                                   
  11273            </td>
  11274                                                                         
  11275           </tr>
  11276                                                               
  11277          </xsl:if>
  11278                                                     
  11279         </xsl:for- each>
  11280                                            
  11281        </tbody>
  11282                                  
  11283       </table>
  11284                        
  11285      </xsl:if>
  11286              
  11287     </xsl:temp late>
  11288             
  11289     <!-- custo dian -->
  11290             
  11291     <xsl:templ ate 
  11292      name="cust odian"
  11293     >
  11294                       
  11295      <xsl:if 
  11296       test="n1:c ustodian"
  11297      >
  11298                                 
  11299       <table 
  11300        class="hea der_table"
  11301       >
  11302                                           
  11303        <tbody>
  11304                                                    
  11305         <tr 
  11306          class="tr_ header"
  11307         >
  11308                                                              
  11309          <td 
  11310           width="20%
  11311           class="td_ header_lab el"
  11312          >
  11313                                                                        
  11314           <span 
  11315            class="td_ label"
  11316           >
  11317                                                                                  
  11318            <xsl:text>
  11319             Document m aintained  by
  11320            </xsl:text >
  11321                                                                         
  11322           </span>
  11323                                                               
  11324          </td>
  11325                                                              
  11326          <td 
  11327           width="80% "
  11328          >
  11329                                                                        
  11330           <xsl:choos e>
  11331                                                                                  
  11332            <xsl:when
  11333                                                                                           
  11334             test="n1:c ustodian/n 1:assigned Custodian/ n1:represe ntedCustod ianOrganiz ation/n1:n ame"
  11335            >
  11336                                                                                            
  11337             <xsl:call- template 
  11338              name="show -name"
  11339             >
  11340                                                                                                     
  11341              <xsl:with- param 
  11342               name="name "
  11343                                                                                                              
  11344               select="n1 :custodian /n1:assign edCustodia n/n1:repre sentedCust odianOrgan ization/n1 :name" 
  11345              />
  11346                                                                                             
  11347             </xsl:call -template>
  11348                                                                                   
  11349            </xsl:when >
  11350                                                                                  
  11351            <xsl:other wise>
  11352                                                                                            
  11353             <xsl:for-e ach
  11354                                                                                                    
  11355              select="n1 :custodian /n1:assign edCustodia n/n1:repre sentedCust odianOrgan ization/n1 :id"
  11356             >
  11357                                                                                                     
  11358              <xsl:call- template 
  11359               name="show -id" 
  11360              />
  11361                                                                                                     
  11362              <xsl:if 
  11363               test="posi tion()!=la st()"
  11364              >
  11365                                                                                                               
  11366               <br />
  11367                                                                                                      
  11368              </xsl:if>
  11369                                                                                             
  11370             </xsl:for- each>
  11371                                                                                   
  11372            </xsl:othe rwise>
  11373                                                                         
  11374           </xsl:choo se>
  11375                                                               
  11376          </td>
  11377                                                     
  11378         </tr>
  11379                                                    
  11380         <xsl:if
  11381                                                             
  11382          test="n1:c ustodian/n 1:assigned Custodian/ n1:represe ntedCustod ianOrganiz ation/n1:a ddr |              n1 :custodian /n1:assign edCustodia n/n1:repre sentedCust odianOrgan ization/n1 :telecom"
  11383         >
  11384                                                              
  11385          <tr 
  11386           class="tr_ header"
  11387          >
  11388                                                                        
  11389           <td 
  11390            width="20%
  11391            class="td_ header_lab el"
  11392           >
  11393                                                                                  
  11394            <span 
  11395             class="td_ label"
  11396            >
  11397                                                                                            
  11398             <xsl:text>
  11399              Contact in fo
  11400             </xsl:text >
  11401                                                                                   
  11402            </span>
  11403                                                                         
  11404           </td>
  11405                                                                        
  11406           <td 
  11407            width="80% "
  11408           >
  11409                                                                                  
  11410            <xsl:call- template 
  11411             name="show -contactIn fo"
  11412            >
  11413                                                                                            
  11414             <xsl:with- param 
  11415              name="cont act"
  11416                                                                                                    
  11417              select="n1 :custodian /n1:assign edCustodia n/n1:repre sentedCust odianOrgan ization" 
  11418             />
  11419                                                                                   
  11420            </xsl:call -template>
  11421                                                                         
  11422           </td>
  11423                                                               
  11424          </tr>
  11425                                                     
  11426         </xsl:if>
  11427                                            
  11428        </tbody>
  11429                                  
  11430       </table>
  11431                        
  11432      </xsl:if>
  11433              
  11434     </xsl:temp late>
  11435             
  11436     <!-- docum entationOf  -->
  11437             
  11438     <xsl:templ ate 
  11439      name="docu mentationO f"
  11440     >
  11441                       
  11442      <xsl:if 
  11443       test="n1:d ocumentati onOf"
  11444      >
  11445                                 
  11446       <table 
  11447        class="hea der_table"
  11448       >
  11449                                           
  11450        <tbody>
  11451                                                    
  11452         <xsl:for-e ach 
  11453          select="n1 :documenta tionOf"
  11454         >
  11455                                                              
  11456          <xsl:if 
  11457           test="n1:s erviceEven t/@classCo de and n1: serviceEve nt/n1:code "
  11458          >
  11459                                                                        
  11460           <xsl:varia ble 
  11461            name="disp layName"
  11462           >
  11463                                                                                  
  11464            <xsl:call- template 
  11465             name="show -actClassC ode"
  11466            >
  11467                                                                                            
  11468             <xsl:with- param 
  11469              name="clsC ode"
  11470                                                                                                    
  11471              select="n1 :serviceEv ent/@class Code" 
  11472             />
  11473                                                                                   
  11474            </xsl:call -template>
  11475                                                                         
  11476           </xsl:vari able>
  11477                                                                        
  11478           <xsl:if 
  11479            test="$dis playName"
  11480           >
  11481                                                                                  
  11482            <tr 
  11483             class="tr_ header"
  11484            >
  11485                                                                                            
  11486             <td 
  11487              width="20%
  11488              class="td_ header_lab el"
  11489             >
  11490                                                                                                     
  11491              <span 
  11492               class="td_ label"
  11493              >
  11494                                                                                                               
  11495               <xsl:call- template 
  11496                name="firs tCharCaseU p"
  11497               >
  11498                                                                                                                         
  11499                <xsl:with- param 
  11500                 name="data
  11501                 select="$d isplayName
  11502                />
  11503                                                                                                                
  11504               </xsl:call -template>
  11505                                                                                                      
  11506              </span>
  11507                                                                                             
  11508             </td>
  11509                                                                                            
  11510             <td 
  11511              width="80%
  11512              colspan="3 "
  11513             >
  11514                                                                                                     
  11515              <xsl:call- template 
  11516               name="show -code"
  11517              >
  11518                                                                                                               
  11519               <xsl:with- param 
  11520                name="code
  11521                select="n1 :serviceEv ent/n1:cod e" 
  11522               />
  11523                                                                                                      
  11524              </xsl:call -template>
  11525                                                                                                     
  11526              <xsl:if 
  11527               test="n1:s erviceEven t/n1:effec tiveTime"
  11528              >
  11529                                                                                                               
  11530               <xsl:choos e>
  11531                                                                                                                         
  11532                <xsl:when 
  11533                 test="n1:s erviceEven t/n1:effec tiveTime/@ value"
  11534                >
  11535                                                                                                                                   
  11536                 <xsl:text>
  11537                  &#160;at&# 160;
  11538                 </xsl:text >
  11539                                                                                                                                   
  11540                 <xsl:call- template 
  11541                  name="show -time"
  11542                 >
  11543                                                                                                                                             
  11544                  <xsl:with- param 
  11545                   name="date time"
  11546                                                                                                                                                     
  11547                   select="n1 :serviceEv ent/n1:eff ectiveTime
  11548                  />
  11549                                                                                                                                    
  11550                 </xsl:call -template>
  11551                                                                                                                          
  11552                </xsl:when >
  11553                                                                                                                         
  11554                <xsl:when 
  11555                 test="n1:s erviceEven t/n1:effec tiveTime/n 1:low"
  11556                >
  11557                                                                                                                                   
  11558                 <xsl:text>
  11559                  &#160;from &#160;
  11560                 </xsl:text >
  11561                                                                                                                                   
  11562                 <xsl:call- template 
  11563                  name="show -time"
  11564                 >
  11565                                                                                                                                             
  11566                  <xsl:with- param 
  11567                   name="date time"
  11568                                                                                                                                                     
  11569                   select="n1 :serviceEv ent/n1:eff ectiveTime /n1:low" 
  11570                  />
  11571                                                                                                                                    
  11572                 </xsl:call -template>
  11573                                                                                                                                   
  11574                 <xsl:if 
  11575                  test="n1:s erviceEven t/n1:effec tiveTime/n 1:high"
  11576                 >
  11577                                                                                                                                             
  11578                  <xsl:text>
  11579                    to 
  11580                  </xsl:text >
  11581                                                                                                                                             
  11582                  <xsl:call- template 
  11583                   name="show -time"
  11584                  >
  11585                                                                                                                                                      
  11586                   <xsl:with- param 
  11587                    name="date time"
  11588                                                                                                                                                               
  11589                    select="n1 :serviceEv ent/n1:eff ectiveTime /n1:high" 
  11590                   />
  11591                                                                                                                                              
  11592                  </xsl:call -template>
  11593                                                                                                                                    
  11594                 </xsl:if>
  11595                                                                                                                          
  11596                </xsl:when >
  11597                                                                                                                
  11598               </xsl:choo se>
  11599                                                                                                      
  11600              </xsl:if>
  11601                                                                                             
  11602             </td>
  11603                                                                                   
  11604            </tr>
  11605                                                                         
  11606           </xsl:if>
  11607                                                               
  11608          </xsl:if>
  11609                                                              
  11610          <xsl:for-e ach 
  11611           select="n1 :serviceEv ent/n1:per former"
  11612          >
  11613                                                                        
  11614           <xsl:varia ble 
  11615            name="disp layName"
  11616           >
  11617                                                                                  
  11618            <xsl:call- template 
  11619             name="show -participa tionType"
  11620            >
  11621                                                                                            
  11622             <xsl:with- param 
  11623              name="ptyp e" 
  11624              select="@t ypeCode" 
  11625             />
  11626                                                                                   
  11627            </xsl:call -template>
  11628                                                                                  
  11629            <xsl:text>
  11630              
  11631            </xsl:text >
  11632                                                                                  
  11633            <xsl:if 
  11634             test="n1:f unctionCod e/@code"
  11635            >
  11636                                                                                            
  11637             <xsl:call- template 
  11638              name="show -participa tionFuncti on"
  11639             >
  11640                                                                                                     
  11641              <xsl:with- param 
  11642               name="pFun ction" 
  11643               select="n1 :functionC ode/@code"  
  11644              />
  11645                                                                                             
  11646             </xsl:call -template>
  11647                                                                                   
  11648            </xsl:if>
  11649                                                                         
  11650           </xsl:vari able>
  11651                                                                        
  11652           <tr 
  11653            class="tr_ header"
  11654           >
  11655                                                                                  
  11656            <td 
  11657             width="20%
  11658             class="td_ header_lab el"
  11659            >
  11660                                                                                            
  11661             <span 
  11662              class="td_ label"
  11663             >
  11664                                                                                                     
  11665              <xsl:call- template 
  11666               name="firs tCharCaseU p"
  11667              >
  11668                                                                                                               
  11669               <xsl:with- param 
  11670                name="data
  11671                select="$d isplayName
  11672               />
  11673                                                                                                      
  11674              </xsl:call -template>
  11675                                                                                             
  11676             </span>
  11677                                                                                   
  11678            </td>
  11679                                                                                  
  11680            <td 
  11681             width="80%
  11682             colspan="3 "
  11683            >
  11684                                                                                            
  11685             <xsl:call- template 
  11686              name="show -assignedE ntity"
  11687             >
  11688                                                                                                     
  11689              <xsl:with- param 
  11690               name="asgn Entity" 
  11691               select="n1 :assignedE ntity" 
  11692              />
  11693                                                                                             
  11694             </xsl:call -template>
  11695                                                                                   
  11696            </td>
  11697                                                                         
  11698           </tr>
  11699                                                               
  11700          </xsl:for- each>
  11701                                                     
  11702         </xsl:for- each>
  11703                                            
  11704        </tbody>
  11705                                  
  11706       </table>
  11707                        
  11708      </xsl:if>
  11709              
  11710     </xsl:temp late>
  11711             
  11712     <!-- inFul fillmentOf  -->
  11713             
  11714     <xsl:templ ate 
  11715      name="inFu lfillmentO f"
  11716     >
  11717                       
  11718      <xsl:if 
  11719       test="n1:i nfulfillme ntOf"
  11720      >
  11721                                 
  11722       <table 
  11723        class="hea der_table"
  11724       >
  11725                                           
  11726        <tbody>
  11727                                                    
  11728         <xsl:for-e ach 
  11729          select="n1 :inFulfill mentOf"
  11730         >
  11731                                                              
  11732          <tr 
  11733           class="tr_ header"
  11734          >
  11735                                                                        
  11736           <td 
  11737            width="20%
  11738            class="td_ header_lab el"
  11739           >
  11740                                                                                  
  11741            <span 
  11742             class="td_ label"
  11743            >
  11744                                                                                            
  11745             <xsl:text>
  11746              In fulfill ment of
  11747             </xsl:text >
  11748                                                                                   
  11749            </span>
  11750                                                                         
  11751           </td>
  11752                                                                        
  11753           <td 
  11754            width="80% "
  11755           >
  11756                                                                                  
  11757            <xsl:for-e ach 
  11758             select="n1 :order"
  11759            >
  11760                                                                                            
  11761             <xsl:for-e ach 
  11762              select="n1 :id"
  11763             >
  11764                                                                                                     
  11765              <xsl:call- template 
  11766               name="show -id" 
  11767              />
  11768                                                                                             
  11769             </xsl:for- each>
  11770                                                                                            
  11771             <xsl:for-e ach 
  11772              select="n1 :code"
  11773             >
  11774                                                                                                     
  11775              <xsl:text>
  11776               &#160;
  11777              </xsl:text >
  11778                                                                                                     
  11779              <xsl:call- template 
  11780               name="show -code"
  11781              >
  11782                                                                                                               
  11783               <xsl:with- param 
  11784                name="code
  11785                select="."  
  11786               />
  11787                                                                                                      
  11788              </xsl:call -template>
  11789                                                                                             
  11790             </xsl:for- each>
  11791                                                                                            
  11792             <xsl:for-e ach 
  11793              select="n1 :priorityC ode"
  11794             >
  11795                                                                                                     
  11796              <xsl:text>
  11797               &#160;
  11798              </xsl:text >
  11799                                                                                                     
  11800              <xsl:call- template 
  11801               name="show -code"
  11802              >
  11803                                                                                                               
  11804               <xsl:with- param 
  11805                name="code
  11806                select="."  
  11807               />
  11808                                                                                                      
  11809              </xsl:call -template>
  11810                                                                                             
  11811             </xsl:for- each>
  11812                                                                                   
  11813            </xsl:for- each>
  11814                                                                         
  11815           </td>
  11816                                                               
  11817          </tr>
  11818                                                     
  11819         </xsl:for- each>
  11820                                            
  11821        </tbody>
  11822                                  
  11823       </table>
  11824                        
  11825      </xsl:if>
  11826              
  11827     </xsl:temp late>
  11828             
  11829     <!-- infor mant -->
  11830             
  11831     <xsl:templ ate 
  11832      name="info rmant"
  11833     >
  11834                       
  11835      <xsl:if 
  11836       test="n1:i nformant"
  11837      >
  11838                                 
  11839       <table 
  11840        class="hea der_table"
  11841       >
  11842                                           
  11843        <tbody>
  11844                                                    
  11845         <xsl:for-e ach 
  11846          select="n1 :informant "
  11847         >
  11848                                                              
  11849          <tr 
  11850           class="tr_ header"
  11851          >
  11852                                                                        
  11853           <td 
  11854            width="20%
  11855            class="td_ header_lab el"
  11856           >
  11857                                                                                  
  11858            <span 
  11859             class="td_ label"
  11860            >
  11861                                                                                            
  11862             <xsl:text>
  11863              Informant
  11864             </xsl:text >
  11865                                                                                   
  11866            </span>
  11867                                                                         
  11868           </td>
  11869                                                                        
  11870           <td 
  11871            width="80% "
  11872           >
  11873                                                                                  
  11874            <xsl:if 
  11875             test="n1:a ssignedEnt ity"
  11876            >
  11877                                                                                            
  11878             <xsl:call- template 
  11879              name="show -assignedE ntity"
  11880             >
  11881                                                                                                     
  11882              <xsl:with- param 
  11883               name="asgn Entity" 
  11884               select="n1 :assignedE ntity" 
  11885              />
  11886                                                                                             
  11887             </xsl:call -template>
  11888                                                                                   
  11889            </xsl:if>
  11890                                                                                  
  11891            <xsl:if 
  11892             test="n1:r elatedEnti ty"
  11893            >
  11894                                                                                            
  11895             <xsl:call- template 
  11896              name="show -relatedEn tity"
  11897             >
  11898                                                                                                     
  11899              <xsl:with- param 
  11900               name="rela tedEntity"  
  11901               select="n1 :relatedEn tity" 
  11902              />
  11903                                                                                             
  11904             </xsl:call -template>
  11905                                                                                   
  11906            </xsl:if>
  11907                                                                         
  11908           </td>
  11909                                                               
  11910          </tr>
  11911                                                              
  11912          <xsl:choos e>
  11913                                                                        
  11914           <xsl:when
  11915                                                                                 
  11916            test="n1:a ssignedEnt ity/n1:add r | n1:ass ignedEntit y/n1:telec om"
  11917           >
  11918                                                                                  
  11919            <tr 
  11920             class="tr_ header"
  11921            >
  11922                                                                                            
  11923             <td 
  11924              width="20%
  11925              class="td_ header_lab el"
  11926             >
  11927                                                                                                     
  11928              <span 
  11929               class="td_ label"
  11930              >
  11931                                                                                                               
  11932               <xsl:text>
  11933                Contact in fo
  11934               </xsl:text >
  11935                                                                                                      
  11936              </span>
  11937                                                                                             
  11938             </td>
  11939                                                                                            
  11940             <td>
  11941                                                                                                     
  11942              <xsl:if 
  11943               test="n1:a ssignedEnt ity"
  11944              >
  11945                                                                                                               
  11946               <xsl:call- template 
  11947                name="show -contactIn fo"
  11948               >
  11949                                                                                                                         
  11950                <xsl:with- param 
  11951                 name="cont act" 
  11952                 select="n1 :assignedE ntity" 
  11953                />
  11954                                                                                                                
  11955               </xsl:call -template>
  11956                                                                                                      
  11957              </xsl:if>
  11958                                                                                             
  11959             </td>
  11960                                                                                   
  11961            </tr>
  11962                                                                         
  11963           </xsl:when >
  11964                                                                        
  11965           <xsl:when
  11966                                                                                 
  11967            test="n1:r elatedEnti ty/n1:addr  | n1:rela tedEntity/ n1:telecom "
  11968           >
  11969                                                                                  
  11970            <tr 
  11971             class="tr_ header"
  11972            >
  11973                                                                                            
  11974             <td 
  11975              width="20%
  11976              class="td_ header_lab el"
  11977             >
  11978                                                                                                     
  11979              <span 
  11980               class="td_ label"
  11981              >
  11982                                                                                                               
  11983               <xsl:text>
  11984                Contact in fo
  11985               </xsl:text >
  11986                                                                                                      
  11987              </span>
  11988                                                                                             
  11989             </td>
  11990                                                                                            
  11991             <td 
  11992              width="80% "
  11993             >
  11994                                                                                                     
  11995              <xsl:if 
  11996               test="n1:r elatedEnti ty"
  11997              >
  11998                                                                                                               
  11999               <xsl:call- template 
  12000                name="show -contactIn fo"
  12001               >
  12002                                                                                                                         
  12003                <xsl:with- param 
  12004                 name="cont act" 
  12005                 select="n1 :relatedEn tity" 
  12006                />
  12007                                                                                                                
  12008               </xsl:call -template>
  12009                                                                                                      
  12010              </xsl:if>
  12011                                                                                             
  12012             </td>
  12013                                                                                   
  12014            </tr>
  12015                                                                         
  12016           </xsl:when >
  12017                                                               
  12018          </xsl:choo se>
  12019                                                     
  12020         </xsl:for- each>
  12021                                            
  12022        </tbody>
  12023                                  
  12024       </table>
  12025                        
  12026      </xsl:if>
  12027              
  12028     </xsl:temp late>
  12029             
  12030     <!-- infor mantionRec ipient -->
  12031             
  12032     <xsl:templ ate 
  12033      name="info rmationRec ipient"
  12034     >
  12035                       
  12036      <xsl:if 
  12037       test="n1:i nformation Recipient"
  12038      >
  12039                                 
  12040       <table 
  12041        class="hea der_table"
  12042       >
  12043                                           
  12044        <tbody>
  12045                                                    
  12046         <xsl:for-e ach 
  12047          select="n1 :informati onRecipien t"
  12048         >
  12049                                                              
  12050          <tr 
  12051           class="tr_ header"
  12052          >
  12053                                                                        
  12054           <td 
  12055            width="20%
  12056            class="td_ header_lab el"
  12057           >
  12058                                                                                  
  12059            <span 
  12060             class="td_ label"
  12061            >
  12062                                                                                            
  12063             <xsl:text>
  12064              Informatio n recipien t:
  12065             </xsl:text >
  12066                                                                                   
  12067            </span>
  12068                                                                         
  12069           </td>
  12070                                                                        
  12071           <td 
  12072            width="80% "
  12073           >
  12074                                                                                  
  12075            <xsl:choos e>
  12076                                                                                            
  12077             <xsl:when
  12078                                                                                                    
  12079              test="n1:i ntendedRec ipient/n1: informatio nRecipient /n1:name"
  12080             >
  12081                                                                                                     
  12082              <xsl:for-e ach 
  12083               select="n1 :intendedR ecipient/n 1:informat ionRecipie nt"
  12084              >
  12085                                                                                                               
  12086               <xsl:call- template 
  12087                name="show -name"
  12088               >
  12089                                                                                                                         
  12090                <xsl:with- param 
  12091                 name="name
  12092                 select="n1 :name" 
  12093                />
  12094                                                                                                                
  12095               </xsl:call -template>
  12096                                                                                                               
  12097               <xsl:if 
  12098                test="posi tion() !=  last()"
  12099               >
  12100                                                                                                                         
  12101                <br />
  12102                                                                                                                
  12103               </xsl:if>
  12104                                                                                                      
  12105              </xsl:for- each>
  12106                                                                                             
  12107             </xsl:when >
  12108                                                                                            
  12109             <xsl:other wise>
  12110                                                                                                     
  12111              <xsl:for-e ach 
  12112               select="n1 :intendedR ecipient"
  12113              >
  12114                                                                                                               
  12115               <xsl:for-e ach 
  12116                select="n1 :id"
  12117               >
  12118                                                                                                                         
  12119                <xsl:call- template 
  12120                 name="show -id" 
  12121                />
  12122                                                                                                                
  12123               </xsl:for- each>
  12124                                                                                                               
  12125               <xsl:if 
  12126                test="posi tion() !=  last()"
  12127               >
  12128                                                                                                                         
  12129                <br />
  12130                                                                                                                
  12131               </xsl:if>
  12132                                                                                                               
  12133               <br />
  12134                                                                                                      
  12135              </xsl:for- each>
  12136                                                                                             
  12137             </xsl:othe rwise>
  12138                                                                                   
  12139            </xsl:choo se>
  12140                                                                         
  12141           </td>
  12142                                                               
  12143          </tr>
  12144                                                              
  12145          <xsl:if
  12146                                                                       
  12147           test="n1:i ntendedRec ipient/n1: addr | n1: intendedRe cipient/n1 :telecom"
  12148          >
  12149                                                                        
  12150           <tr 
  12151            class="tr_ header"
  12152           >
  12153                                                                                  
  12154            <td 
  12155             width="20%
  12156             class="td_ header_lab el"
  12157            >
  12158                                                                                            
  12159             <span 
  12160              class="td_ label"
  12161             >
  12162                                                                                                     
  12163              <xsl:text>
  12164               Contact in fo
  12165              </xsl:text >
  12166                                                                                             
  12167             </span>
  12168                                                                                   
  12169            </td>
  12170                                                                                  
  12171            <td>
  12172                                                                                            
  12173             <xsl:call- template 
  12174              name="show -contactIn fo"
  12175             >
  12176                                                                                                     
  12177              <xsl:with- param 
  12178               name="cont act" 
  12179               select="n1 :intendedR ecipient" 
  12180              />
  12181                                                                                             
  12182             </xsl:call -template>
  12183                                                                                   
  12184            </td>
  12185                                                                         
  12186           </tr>
  12187                                                               
  12188          </xsl:if>
  12189                                                     
  12190         </xsl:for- each>
  12191                                            
  12192        </tbody>
  12193                                  
  12194       </table>
  12195                        
  12196      </xsl:if>
  12197              
  12198     </xsl:temp late>
  12199             
  12200     <!-- parti cipant -->
  12201             
  12202     <xsl:templ ate 
  12203      name="part icipant"
  12204     >
  12205                       
  12206      <xsl:if 
  12207       test="n1:p articipant "
  12208      >
  12209                                 
  12210       <table 
  12211        class="hea der_table"
  12212       >
  12213                                           
  12214        <tbody>
  12215                                                    
  12216         <xsl:for-e ach 
  12217          select="n1 :participa nt"
  12218         >
  12219                                                              
  12220          <tr 
  12221           class="tr_ header"
  12222          >
  12223                                                                        
  12224           <td 
  12225            width="20%
  12226            class="td_ header_lab el"
  12227           >
  12228                                                                                  
  12229            <xsl:varia ble 
  12230             name="part iciptRole"
  12231            >
  12232                                                                                            
  12233             <xsl:call- template 
  12234              name="tran slateRoleA ssoCode"
  12235             >
  12236                                                                                                     
  12237              <xsl:with- param 
  12238               name="clas sCode"
  12239                                                                                                              
  12240               select="n1 :associate dEntity/@c lassCode" 
  12241              />
  12242                                                                                                     
  12243              <xsl:with- param 
  12244               name="code "
  12245                                                                                                              
  12246               select="n1 :associate dEntity/n1 :code" 
  12247              />
  12248                                                                                             
  12249             </xsl:call -template>
  12250                                                                                   
  12251            </xsl:vari able>
  12252                                                                                  
  12253            <xsl:choos e>
  12254                                                                                            
  12255             <xsl:when 
  12256              test="$par ticiptRole "
  12257             >
  12258                                                                                                     
  12259              <span 
  12260               class="td_ label"
  12261              >
  12262                                                                                                               
  12263               <xsl:call- template 
  12264                name="firs tCharCaseU p"
  12265               >
  12266                                                                                                                         
  12267                <xsl:with- param 
  12268                 name="data
  12269                 select="$p articiptRo le" 
  12270                />
  12271                                                                                                                
  12272               </xsl:call -template>
  12273                                                                                                      
  12274              </span>
  12275                                                                                             
  12276             </xsl:when >
  12277                                                                                            
  12278             <xsl:other wise>
  12279                                                                                                     
  12280              <span 
  12281               class="td_ label"
  12282              >
  12283                                                                                                               
  12284               <xsl:text>
  12285                Participan t
  12286               </xsl:text >
  12287                                                                                                      
  12288              </span>
  12289                                                                                             
  12290             </xsl:othe rwise>
  12291                                                                                   
  12292            </xsl:choo se>
  12293                                                                         
  12294           </td>
  12295                                                                        
  12296           <td 
  12297            width="80% "
  12298           >
  12299                                                                                  
  12300            <xsl:if 
  12301             test="n1:f unctionCod e"
  12302            >
  12303                                                                                            
  12304             <xsl:call- template 
  12305              name="show -code"
  12306             >
  12307                                                                                                     
  12308              <xsl:with- param 
  12309               name="code
  12310               select="n1 :functionC ode" 
  12311              />
  12312                                                                                             
  12313             </xsl:call -template>
  12314                                                                                   
  12315            </xsl:if>
  12316                                                                                  
  12317            <xsl:call- template 
  12318             name="show -associate dEntity"
  12319            >
  12320                                                                                            
  12321             <xsl:with- param 
  12322              name="asso Entity" 
  12323              select="n1 :associate dEntity" 
  12324             />
  12325                                                                                   
  12326            </xsl:call -template>
  12327                                                                                  
  12328            <xsl:if 
  12329             test="n1:t ime"
  12330            >
  12331                                                                                            
  12332             <xsl:if 
  12333              test="n1:t ime/n1:low "
  12334             >
  12335                                                                                                     
  12336              <xsl:text>
  12337                from 
  12338              </xsl:text >
  12339                                                                                                     
  12340              <xsl:call- template 
  12341               name="show -time"
  12342              >
  12343                                                                                                               
  12344               <xsl:with- param 
  12345                name="date time" 
  12346                select="n1 :time/n1:l ow" 
  12347               />
  12348                                                                                                      
  12349              </xsl:call -template>
  12350                                                                                             
  12351             </xsl:if>
  12352                                                                                            
  12353             <xsl:if 
  12354              test="n1:t ime/n1:hig h"
  12355             >
  12356                                                                                                     
  12357              <xsl:text>
  12358                to 
  12359              </xsl:text >
  12360                                                                                                     
  12361              <xsl:call- template 
  12362               name="show -time"
  12363              >
  12364                                                                                                               
  12365               <xsl:with- param 
  12366                name="date time" 
  12367                select="n1 :time/n1:h igh" 
  12368               />
  12369                                                                                                      
  12370              </xsl:call -template>
  12371                                                                                             
  12372             </xsl:if>
  12373                                                                                   
  12374            </xsl:if>
  12375                                                                                  
  12376            <xsl:if 
  12377             test="posi tion() !=  last()"
  12378            >
  12379                                                                                            
  12380             <br />
  12381                                                                                   
  12382            </xsl:if>
  12383                                                                         
  12384           </td>
  12385                                                               
  12386          </tr>
  12387                                                              
  12388          <xsl:if
  12389                                                                       
  12390           test="n1:a ssociatedE ntity/n1:a ddr | n1:a ssociatedE ntity/n1:t elecom"
  12391          >
  12392                                                                        
  12393           <tr 
  12394            class="tr_ header"
  12395           >
  12396                                                                                  
  12397            <td 
  12398             width="20%
  12399             class="td_ header_lab el"
  12400            >
  12401                                                                                            
  12402             <span 
  12403              class="td_ label"
  12404             >
  12405                                                                                                     
  12406              <xsl:text>
  12407               Contact in fo
  12408              </xsl:text >
  12409                                                                                             
  12410             </span>
  12411                                                                                   
  12412            </td>
  12413                                                                                  
  12414            <td 
  12415             width="80% "
  12416            >
  12417                                                                                            
  12418             <xsl:call- template 
  12419              name="show -contactIn fo"
  12420             >
  12421                                                                                                     
  12422              <xsl:with- param 
  12423               name="cont act" 
  12424               select="n1 :associate dEntity" 
  12425              />
  12426                                                                                             
  12427             </xsl:call -template>
  12428                                                                                   
  12429            </td>
  12430                                                                         
  12431           </tr>
  12432                                                               
  12433          </xsl:if>
  12434                                                     
  12435         </xsl:for- each>
  12436                                            
  12437        </tbody>
  12438                                  
  12439       </table>
  12440                        
  12441      </xsl:if>
  12442              
  12443     </xsl:temp late>
  12444             
  12445     <!-- recor dTarget -- >
  12446             
  12447     <xsl:templ ate 
  12448      name="reco rdTarget"
  12449     >
  12450                       
  12451      <table 
  12452       class="hea der_table"
  12453      >
  12454                                 
  12455       <tbody>
  12456                                           
  12457        <xsl:for-e ach 
  12458         select="/n 1:Clinical Document/n 1:recordTa rget/n1:pa tientRole"
  12459        >
  12460                                                    
  12461         <xsl:if 
  12462          test="not( n1:id/@nul lFlavor)"
  12463         >
  12464                                                              
  12465          <tr 
  12466           class="tr_ header"
  12467          >
  12468                                                                        
  12469           <td 
  12470            width="20%
  12471            class="td_ header_lab el"
  12472           >
  12473                                                                                  
  12474            <span 
  12475             class="td_ label"
  12476            >
  12477                                                                                            
  12478             <xsl:text>
  12479              Patient
  12480             </xsl:text >
  12481                                                                                   
  12482            </span>
  12483                                                                         
  12484           </td>
  12485                                                                        
  12486           <td 
  12487            width="80%
  12488            colspan="3 "
  12489           >
  12490                                                                                  
  12491            <xsl:call- template 
  12492             name="show -name"
  12493            >
  12494                                                                                            
  12495             <xsl:with- param 
  12496              name="name
  12497              select="n1 :patient/n 1:name" 
  12498             />
  12499                                                                                   
  12500            </xsl:call -template>
  12501                                                                         
  12502           </td>
  12503                                                               
  12504          </tr>
  12505                                                              
  12506          <tr 
  12507           class="tr_ header"
  12508          >
  12509                                                                        
  12510           <td 
  12511            width="20%
  12512            class="td_ header_lab el"
  12513           >
  12514                                                                                  
  12515            <span 
  12516             class="td_ label"
  12517            >
  12518                                                                                            
  12519             <xsl:text>
  12520              Date of bi rth
  12521             </xsl:text >
  12522                                                                                   
  12523            </span>
  12524                                                                         
  12525           </td>
  12526                                                                        
  12527           <td 
  12528            width="30% "
  12529           >
  12530                                                                                  
  12531            <xsl:call- template 
  12532             name="show -time"
  12533            >
  12534                                                                                            
  12535             <xsl:with- param 
  12536              name="date time" 
  12537              select="n1 :patient/n 1:birthTim e" 
  12538             />
  12539                                                                                   
  12540            </xsl:call -template>
  12541                                                                         
  12542           </td>
  12543                                                                        
  12544           <td 
  12545            width="20%
  12546            class="td_ header_lab el"
  12547           >
  12548                                                                                  
  12549            <span 
  12550             class="td_ label"
  12551            >
  12552                                                                                            
  12553             <xsl:text>
  12554              Sex
  12555             </xsl:text >
  12556                                                                                   
  12557            </span>
  12558                                                                         
  12559           </td>
  12560                                                                        
  12561           <td 
  12562            width="30% "
  12563           >
  12564                                                                                  
  12565            <xsl:for-e ach 
  12566             select="n1 :patient/n 1:administ rativeGend erCode"
  12567            >
  12568                                                                                            
  12569             <xsl:call- template 
  12570              name="show -gender" 
  12571             />
  12572                                                                                   
  12573            </xsl:for- each>
  12574                                                                         
  12575           </td>
  12576                                                               
  12577          </tr>
  12578                                                              
  12579          <xsl:if 
  12580           test="n1:p atient/n1: raceCode |  (n1:patie nt/n1:ethn icGroupCod e)"
  12581          >
  12582                                                                        
  12583           <tr 
  12584            class="tr_ header"
  12585           >
  12586                                                                                  
  12587            <td 
  12588             width="20%
  12589             class="td_ header_lab el"
  12590            >
  12591                                                                                            
  12592             <span 
  12593              class="td_ label"
  12594             >
  12595                                                                                                     
  12596              <xsl:text>
  12597               Race
  12598              </xsl:text >
  12599                                                                                             
  12600             </span>
  12601                                                                                   
  12602            </td>
  12603                                                                                  
  12604            <td 
  12605             width="30% "
  12606            >
  12607                                                                                            
  12608             <xsl:choos e>
  12609                                                                                                     
  12610              <xsl:when 
  12611               test="n1:p atient/n1: raceCode"
  12612              >
  12613                                                                                                               
  12614               <xsl:for-e ach 
  12615                select="n1 :patient/n 1:raceCode "
  12616               >
  12617                                                                                                                         
  12618                <xsl:call- template 
  12619                 name="show -race-ethn icity" 
  12620                />
  12621                                                                                                                
  12622               </xsl:for- each>
  12623                                                                                                      
  12624              </xsl:when >
  12625                                                                                                     
  12626              <xsl:other wise>
  12627                                                                                                               
  12628               <xsl:text>
  12629                Informatio n not avai lable
  12630               </xsl:text >
  12631                                                                                                      
  12632              </xsl:othe rwise>
  12633                                                                                             
  12634             </xsl:choo se>
  12635                                                                                   
  12636            </td>
  12637                                                                                  
  12638            <td 
  12639             width="20%
  12640             class="td_ header_lab el"
  12641            >
  12642                                                                                            
  12643             <span 
  12644              class="td_ label"
  12645             >
  12646                                                                                                     
  12647              <xsl:text>
  12648               Ethnicity
  12649              </xsl:text >
  12650                                                                                             
  12651             </span>
  12652                                                                                   
  12653            </td>
  12654                                                                                  
  12655            <td 
  12656             width="30% "
  12657            >
  12658                                                                                            
  12659             <xsl:choos e>
  12660                                                                                                     
  12661              <xsl:when 
  12662               test="n1:p atient/n1: ethnicGrou pCode"
  12663              >
  12664                                                                                                               
  12665               <xsl:for-e ach 
  12666                select="n1 :patient/n 1:ethnicGr oupCode"
  12667               >
  12668                                                                                                                         
  12669                <xsl:call- template 
  12670                 name="show -race-ethn icity" 
  12671                />
  12672                                                                                                                
  12673               </xsl:for- each>
  12674                                                                                                      
  12675              </xsl:when >
  12676                                                                                                     
  12677              <xsl:other wise>
  12678                                                                                                               
  12679               <xsl:text>
  12680                Informatio n not avai lable
  12681               </xsl:text >
  12682                                                                                                      
  12683              </xsl:othe rwise>
  12684                                                                                             
  12685             </xsl:choo se>
  12686                                                                                   
  12687            </td>
  12688                                                                         
  12689           </tr>
  12690                                                               
  12691          </xsl:if>
  12692                                                              
  12693          <tr 
  12694           class="tr_ header"
  12695          >
  12696                                                                        
  12697           <td 
  12698            width="20%
  12699            class="td_ header_lab el"
  12700           >
  12701                                                                                  
  12702            <span 
  12703             class="td_ label"
  12704            >
  12705                                                                                            
  12706             <xsl:text>
  12707              Contact in fo
  12708             </xsl:text >
  12709                                                                                   
  12710            </span>
  12711                                                                         
  12712           </td>
  12713                                                                        
  12714           <td 
  12715            width="30% "
  12716           >
  12717                                                                                  
  12718            <xsl:call- template 
  12719             name="show -contactIn fo"
  12720            >
  12721                                                                                            
  12722             <xsl:with- param 
  12723              name="cont act" 
  12724              select="."  
  12725             />
  12726                                                                                   
  12727            </xsl:call -template>
  12728                                                                         
  12729           </td>
  12730                                                                        
  12731           <td 
  12732            width="20%
  12733            class="td_ header_lab el"
  12734           >
  12735                                                                                  
  12736            <span 
  12737             class="td_ label"
  12738            >
  12739                                                                                            
  12740             <xsl:text>
  12741              Patient ID s
  12742             </xsl:text >
  12743                                                                                   
  12744            </span>
  12745                                                                         
  12746           </td>
  12747                                                                        
  12748           <td 
  12749            width="30% "
  12750           >
  12751                                                                                  
  12752            <xsl:for-e ach 
  12753             select="n1 :id"
  12754            >
  12755                                                                                            
  12756             <xsl:call- template 
  12757              name="show -id" 
  12758             />
  12759                                                                                            
  12760             <br />
  12761            
  12762                                                                                   
  12763            </xsl:for- each>
  12764                                                                         
  12765           </td>
  12766                                                               
  12767          </tr>
  12768                                                     
  12769         </xsl:if>
  12770                                            
  12771        </xsl:for- each>
  12772                                  
  12773       </tbody>
  12774                        
  12775      </table>
  12776              
  12777     </xsl:temp late>
  12778             
  12779     <!-- relat edDocument  -->
  12780             
  12781     <xsl:templ ate 
  12782      name="rela tedDocumen t"
  12783     >
  12784                       
  12785      <xsl:if 
  12786       test="n1:r elatedDocu ment"
  12787      >
  12788                                 
  12789       <table 
  12790        class="hea der_table"
  12791       >
  12792                                           
  12793        <tbody>
  12794                                                    
  12795         <xsl:for-e ach 
  12796          select="n1 :relatedDo cument"
  12797         >
  12798                                                              
  12799          <tr 
  12800           class="tr_ header"
  12801          >
  12802                                                                        
  12803           <td 
  12804            width="20%
  12805            class="td_ header_lab el"
  12806           >
  12807                                                                                  
  12808            <span 
  12809             class="td_ label"
  12810            >
  12811                                                                                            
  12812             <xsl:text>
  12813              Related do cument
  12814             </xsl:text >
  12815                                                                                   
  12816            </span>
  12817                                                                         
  12818           </td>
  12819                                                                        
  12820           <td 
  12821            width="80% "
  12822           >
  12823                                                                                  
  12824            <xsl:for-e ach 
  12825             select="n1 :parentDoc ument"
  12826            >
  12827                                                                                            
  12828             <xsl:for-e ach 
  12829              select="n1 :id"
  12830             >
  12831                                                                                                     
  12832              <xsl:call- template 
  12833               name="show -id" 
  12834              />
  12835                                                                                                     
  12836              <br />
  12837                                                                                             
  12838             </xsl:for- each>
  12839                                                                                   
  12840            </xsl:for- each>
  12841                                                                         
  12842           </td>
  12843                                                               
  12844          </tr>
  12845                                                     
  12846         </xsl:for- each>
  12847                                            
  12848        </tbody>
  12849                                  
  12850       </table>
  12851                        
  12852      </xsl:if>
  12853              
  12854     </xsl:temp late>
  12855             
  12856     <!-- autho rization ( consent) - ->
  12857             
  12858     <xsl:templ ate 
  12859      name="auth orization"
  12860     >
  12861                       
  12862      <xsl:if 
  12863       test="n1:a uthorizati on"
  12864      >
  12865                                 
  12866       <table 
  12867        class="hea der_table"
  12868       >
  12869                                           
  12870        <tbody>
  12871                                                    
  12872         <xsl:for-e ach 
  12873          select="n1 :authoriza tion"
  12874         >
  12875                                                              
  12876          <tr 
  12877           class="tr_ header"
  12878          >
  12879                                                                        
  12880           <td 
  12881            width="20%
  12882            class="td_ header_lab el"
  12883           >
  12884                                                                                  
  12885            <span 
  12886             class="td_ label"
  12887            >
  12888                                                                                            
  12889             <xsl:text>
  12890              Consent
  12891             </xsl:text >
  12892                                                                                   
  12893            </span>
  12894                                                                         
  12895           </td>
  12896                                                                        
  12897           <td 
  12898            width="80% "
  12899           >
  12900                                                                                  
  12901            <xsl:choos e>
  12902                                                                                            
  12903             <xsl:when 
  12904              test="n1:c onsent/n1: code"
  12905             >
  12906                                                                                                     
  12907              <xsl:call- template 
  12908               name="show -code"
  12909              >
  12910                                                                                                               
  12911               <xsl:with- param 
  12912                name="code
  12913                select="n1 :consent/n 1:code" 
  12914               />
  12915                                                                                                      
  12916              </xsl:call -template>
  12917                                                                                             
  12918             </xsl:when >
  12919                                                                                            
  12920             <xsl:other wise>
  12921                                                                                                     
  12922              <xsl:call- template 
  12923               name="show -code"
  12924              >
  12925                                                                                                               
  12926               <xsl:with- param 
  12927                name="code "
  12928                                                                                                                        
  12929                select="n1 :consent/n 1:statusCo de" 
  12930               />
  12931                                                                                                      
  12932              </xsl:call -template>
  12933                                                                                             
  12934             </xsl:othe rwise>
  12935                                                                                   
  12936            </xsl:choo se>
  12937                                                                                  
  12938            <br />
  12939                                                                         
  12940           </td>
  12941                                                               
  12942          </tr>
  12943                                                     
  12944         </xsl:for- each>
  12945                                            
  12946        </tbody>
  12947                                  
  12948       </table>
  12949                        
  12950      </xsl:if>
  12951              
  12952     </xsl:temp late>
  12953             
  12954     <!-- setAn dVersion - ->
  12955             
  12956     <xsl:templ ate 
  12957      name="setA ndVersion"
  12958     >
  12959                       
  12960      <xsl:if 
  12961       test="n1:s etId and n 1:versionN umber"
  12962      >
  12963                                 
  12964       <table 
  12965        class="hea der_table"
  12966       >
  12967                                           
  12968        <tbody>
  12969                                                    
  12970         <tr>
  12971                                                              
  12972          <td 
  12973           width="20% "
  12974          >
  12975                                                                        
  12976           <xsl:text>
  12977            SetId and  Version
  12978           </xsl:text >
  12979                                                               
  12980          </td>
  12981                                                              
  12982          <td 
  12983           colspan="3 "
  12984          >
  12985                                                                        
  12986           <xsl:text>
  12987            SetId: 
  12988           </xsl:text >
  12989                                                                        
  12990           <xsl:call- template 
  12991            name="show -id"
  12992           >
  12993                                                                                  
  12994            <xsl:with- param 
  12995             name="id" 
  12996             select="n1 :setId" 
  12997            />
  12998                                                                         
  12999           </xsl:call -template>
  13000                                                                        
  13001           <xsl:text>
  13002              Version:  
  13003           </xsl:text >
  13004                                                                        
  13005           <xsl:value -of 
  13006            select="n1 :versionNu mber/@valu e" 
  13007           />
  13008                                                               
  13009          </td>
  13010                                                     
  13011         </tr>
  13012                                            
  13013        </tbody>
  13014                                  
  13015       </table>
  13016                        
  13017      </xsl:if>
  13018              
  13019     </xsl:temp late>
  13020             
  13021     <!-- show  nonXMLBody  -->
  13022             
  13023     <xsl:templ ate 
  13024      match='n1: component/ n1:nonXMLB ody'
  13025     >
  13026                       
  13027      <xsl:choos e>
  13028                                 
  13029       <!-- if th ere is a r eference,  use that i n an IFRAM E -->
  13030                                 
  13031       <xsl:when 
  13032        test='n1:t ext/n1:ref erence'
  13033       >
  13034                                           
  13035        <IFRAME 
  13036         name='nonX MLBody' 
  13037         id='nonXML Body' 
  13038         WIDTH='80%
  13039         HEIGHT='60 0'
  13040                                                   
  13041         src='{n1:t ext/n1:ref erence/@va lue}' 
  13042        />
  13043                                  
  13044       </xsl:when >
  13045                                 
  13046       <!-- Hardc oded link  for suppor ting attac hments - A sha Amritr aj : START  -->
  13047                                 
  13048       <xsl:when 
  13049        test='n1:t ext/@repre sentation= "B64"'
  13050       >
  13051                                           
  13052        <pre>
  13053                                                    
  13054         <!-- TODO:  Asha Amri traj - Har dcoded C62  for now.  Make it ge neric in 
  13055                                                             ne xt release  -->
  13056                                                    
  13057         <a
  13058                                                             
  13059          href="View Attachment .do_sec?me diaType={n 1:text/@me diaType}&a mp;represe ntation={n 1:text/@re presentati on}&amp;do cType=C62"
  13060         >
  13061          View attac hment
  13062         </a>
  13063                                            
  13064        </pre>
  13065                                  
  13066       </xsl:when >
  13067                                 
  13068       <xsl:when 
  13069        test='n1:t ext/@media Type="text /plain"'
  13070       >
  13071                                           
  13072        <pre>
  13073                                                    
  13074         <xsl:value -of 
  13075          select='n1 :text/text ()' 
  13076         />
  13077                                            
  13078        </pre>
  13079                                  
  13080       </xsl:when >
  13081                                 
  13082       <!-- Hardc oded link  for suppor ting attac hments - A sha Amritr aj : END - ->
  13083                                 
  13084       <xsl:other wise>
  13085                                           
  13086        <CENTER>
  13087         Cannot dis play the t ext
  13088        </CENTER>
  13089                                  
  13090       </xsl:othe rwise>
  13091                        
  13092      </xsl:choo se>
  13093              
  13094     </xsl:temp late>
  13095             
  13096     <!-- top l evel compo nent/secti on: displa y title an d text, an d process  any 
  13097                      nest ed compone nt/section s -->
  13098             
  13099     <xsl:templ ate 
  13100      name="sect ion"
  13101     >
  13102                       
  13103      <xsl:call- template 
  13104       name="sect ion-title"
  13105      >
  13106                                 
  13107       <xsl:with- param 
  13108        name="titl e" 
  13109        select="n1 :title" 
  13110       />
  13111                        
  13112      </xsl:call -template>
  13113                       
  13114      <xsl:call- template 
  13115       name="sect ion-author
  13116      />
  13117                       
  13118      <xsl:call- template 
  13119       name="sect ion-text" 
  13120      />
  13121                       
  13122      <xsl:for-e ach 
  13123       select="n1 :component /n1:sectio n"
  13124      >
  13125                                 
  13126       <xsl:call- template 
  13127        name="nest edSection"
  13128       >
  13129                                           
  13130        <xsl:with- param 
  13131         name="marg in" 
  13132         select="2"  
  13133        />
  13134                                  
  13135       </xsl:call -template>
  13136                        
  13137      </xsl:for- each>
  13138              
  13139     </xsl:temp late>
  13140             
  13141     <!-- top l evel secti on title - ->
  13142             
  13143     <xsl:templ ate 
  13144      name="sect ion-title"
  13145     >
  13146                       
  13147      <xsl:param  
  13148       name="titl e" 
  13149      />
  13150                       
  13151      <xsl:choos e>
  13152                                 
  13153       <xsl:when
  13154                                          
  13155        test="coun t(/n1:Clin icalDocume nt/n1:comp onent/n1:s tructuredB ody/n1:com ponent[n1: section])  &gt; 1"
  13156       >
  13157                                           
  13158        <h3>
  13159                                                    
  13160         <a 
  13161          name="{gen erate-id($ title)}" 
  13162          href="#toc "
  13163         >
  13164                                                              
  13165          <xsl:value -of 
  13166           select="$t itle" 
  13167          />
  13168                                                     
  13169         </a>
  13170                                            
  13171        </h3>
  13172                                  
  13173       </xsl:when >
  13174                                 
  13175       <xsl:other wise>
  13176                                           
  13177        <h3>
  13178                                                    
  13179         <xsl:value -of 
  13180          select="$t itle" 
  13181         />
  13182                                            
  13183        </h3>
  13184                                  
  13185       </xsl:othe rwise>
  13186                        
  13187      </xsl:choo se>
  13188              
  13189     </xsl:temp late>
  13190             
  13191     <!-- secti on author  -->
  13192             
  13193     <xsl:templ ate 
  13194      name="sect ion-author "
  13195     >
  13196                       
  13197      <xsl:if 
  13198       test="coun t(n1:autho r)&gt;0"
  13199      >
  13200                                 
  13201       <div 
  13202        style="mar gin-left :  2em;"
  13203       >
  13204                                           
  13205        <b>
  13206                                                    
  13207         <xsl:text>
  13208          Section Au thor: 
  13209         </xsl:text >
  13210                                            
  13211        </b>
  13212                                           
  13213        <xsl:for-e ach 
  13214         select="n1 :author/n1 :assignedA uthor"
  13215        >
  13216                                                    
  13217         <xsl:choos e>
  13218                                                              
  13219          <xsl:when 
  13220           test="n1:a ssignedPer son/n1:nam e"
  13221          >
  13222                                                                        
  13223           <xsl:call- template 
  13224            name="show -name"
  13225           >
  13226                                                                                  
  13227            <xsl:with- param 
  13228             name="name
  13229             select="n1 :assignedP erson/n1:n ame" 
  13230            />
  13231                                                                         
  13232           </xsl:call -template>
  13233                                                                        
  13234           <xsl:if 
  13235            test="n1:r epresented Organizati on"
  13236           >
  13237                                                                                  
  13238            <xsl:text>
  13239            
  13240            </xsl:text >
  13241                                                                                  
  13242            <xsl:call- template 
  13243             name="show -name"
  13244            >
  13245                                                                                            
  13246             <xsl:with- param 
  13247              name="name "
  13248                                                                                                    
  13249              select="n1 :represent edOrganiza tion/n1:na me" 
  13250             />
  13251                                                                                   
  13252            </xsl:call -template>
  13253                                                                         
  13254           </xsl:if>
  13255                                                               
  13256          </xsl:when >
  13257                                                              
  13258          <xsl:when 
  13259           test="n1:a ssignedAut horingDevi ce/n1:soft wareName"
  13260          >
  13261                                                                        
  13262           <xsl:value -of 
  13263            select="n1 :assignedA uthoringDe vice/n1:so ftwareName
  13264           />
  13265                                                               
  13266          </xsl:when >
  13267                                                              
  13268          <xsl:other wise>
  13269                                                                        
  13270           <xsl:for-e ach 
  13271            select="n1 :id"
  13272           >
  13273                                                                                  
  13274            <xsl:call- template 
  13275             name="show -id" 
  13276            />
  13277                                                                                  
  13278            <br />
  13279                                                                         
  13280           </xsl:for- each>
  13281                                                               
  13282          </xsl:othe rwise>
  13283                                                     
  13284         </xsl:choo se>
  13285                                            
  13286        </xsl:for- each>
  13287                                           
  13288        <br />
  13289                                  
  13290       </div>
  13291                        
  13292      </xsl:if>
  13293              
  13294     </xsl:temp late>
  13295             
  13296     <!-- top-l evel secti on Text -- >
  13297             
  13298     <xsl:templ ate 
  13299      name="sect ion-text"
  13300     >
  13301                       
  13302      <div>
  13303                                 
  13304       <xsl:apply -templates  
  13305        select="n1 :text" 
  13306       />
  13307                        
  13308      </div>
  13309              
  13310     </xsl:temp late>
  13311             
  13312     <!-- neste d componen t/section  -->
  13313             
  13314     <xsl:templ ate 
  13315      name="nest edSection"
  13316     >
  13317                       
  13318      <xsl:param  
  13319       name="marg in" 
  13320      />
  13321                       
  13322      <h4 
  13323       style="mar gin-left :  {$margin} em;"
  13324      >
  13325                                 
  13326       <xsl:value -of 
  13327        select="n1 :title" 
  13328       />
  13329                        
  13330      </h4>
  13331                       
  13332      <div 
  13333       style="mar gin-left :  {$margin} em;"
  13334      >
  13335                                 
  13336       <xsl:apply -templates  
  13337        select="n1 :text" 
  13338       />
  13339                        
  13340      </div>
  13341                       
  13342      <xsl:for-e ach 
  13343       select="n1 :component /n1:sectio n"
  13344      >
  13345                                 
  13346       <xsl:call- template 
  13347        name="nest edSection"
  13348       >
  13349                                           
  13350        <xsl:with- param 
  13351         name="marg in" 
  13352         select="2* $margin" 
  13353        />
  13354                                  
  13355       </xsl:call -template>
  13356                        
  13357      </xsl:for- each>
  13358              
  13359     </xsl:temp late>
  13360             
  13361     <!-- parag raph -->
  13362             
  13363     <xsl:templ ate 
  13364      match="n1: paragraph"
  13365     >
  13366                       
  13367      <p>
  13368                                 
  13369       <xsl:apply -templates  />
  13370                        
  13371      </p>
  13372              
  13373     </xsl:temp late>
  13374             
  13375     <!-- pre f ormat -->
  13376             
  13377     <xsl:templ ate 
  13378      match="n1: pre"
  13379     >
  13380                       
  13381      <pre>
  13382                                 
  13383       <xsl:apply -templates  />
  13384                        
  13385      </pre>
  13386              
  13387     </xsl:temp late>
  13388             
  13389     <!-- Conte nt w/ dele ted text i s hidden - ->
  13390             
  13391     <xsl:templ ate 
  13392      match="n1: content[@r evised='de lete']" 
  13393     />
  13394             
  13395     <!-- conte nt -->
  13396             
  13397     <xsl:templ ate 
  13398      match="n1: content"
  13399     >
  13400                       
  13401      <xsl:apply -templates  />
  13402              
  13403     </xsl:temp late>
  13404             
  13405     <!-- line  break -->
  13406             
  13407     <xsl:templ ate 
  13408      match="n1: br"
  13409     >
  13410                       
  13411      <xsl:eleme nt 
  13412       name='br'
  13413      >
  13414                                 
  13415       <xsl:apply -templates  />
  13416                        
  13417      </xsl:elem ent>
  13418              
  13419     </xsl:temp late>
  13420             
  13421     <!-- list  -->
  13422             
  13423     <xsl:templ ate 
  13424      match="n1: list"
  13425     >
  13426                       
  13427      <xsl:if 
  13428       test="n1:c aption"
  13429      >
  13430                                 
  13431       <p>
  13432                                           
  13433        <b>
  13434                                                    
  13435         <xsl:apply -templates  
  13436          select="n1 :caption" 
  13437         />
  13438                                            
  13439        </b>
  13440                                  
  13441       </p>
  13442                        
  13443      </xsl:if>
  13444                       
  13445      <ul>
  13446                                 
  13447       <xsl:for-e ach 
  13448        select="n1 :item"
  13449       >
  13450                                           
  13451        <li>
  13452                                                    
  13453         <xsl:apply -templates  />
  13454                                            
  13455        </li>
  13456                                  
  13457       </xsl:for- each>
  13458                        
  13459      </ul>
  13460              
  13461     </xsl:temp late>
  13462             
  13463     <xsl:templ ate 
  13464      match="n1: list[@list Type='orde red']"
  13465     >
  13466                       
  13467      <xsl:if 
  13468       test="n1:c aption"
  13469      >
  13470                                 
  13471       <span 
  13472        style="fon t-weight:b old; "
  13473       >
  13474                                           
  13475        <xsl:apply -templates  
  13476         select="n1 :caption" 
  13477        />
  13478                                  
  13479       </span>
  13480                        
  13481      </xsl:if>
  13482                       
  13483      <ol>
  13484                                 
  13485       <xsl:for-e ach 
  13486        select="n1 :item"
  13487       >
  13488                                           
  13489        <li>
  13490                                                    
  13491         <xsl:apply -templates  />
  13492                                            
  13493        </li>
  13494                                  
  13495       </xsl:for- each>
  13496                        
  13497      </ol>
  13498              
  13499     </xsl:temp late>
  13500             
  13501     <!-- capti on -->
  13502             
  13503     <xsl:templ ate 
  13504      match="n1: caption"
  13505     >
  13506                       
  13507      <xsl:apply -templates  />
  13508                       
  13509      <xsl:text>
  13510      
  13511      </xsl:text >
  13512              
  13513     </xsl:temp late>
  13514             
  13515     <!-- Table s -->
  13516             
  13517     <xsl:templ ate
  13518                      
  13519      match="n1: table/@*|n 1:thead/@* |n1:tfoot/ @*|n1:tbod y/@*|n1:co lgroup/@*| n1:col/@*| n1:tr/@*|n 1:th/@*|n1 :td/@*"
  13520     >
  13521                       
  13522      <xsl:copy>
  13523                                 
  13524       <xsl:copy- of 
  13525        select="@*
  13526       />
  13527                                 
  13528       <xsl:apply -templates  />
  13529                        
  13530      </xsl:copy >
  13531              
  13532     </xsl:temp late>
  13533             
  13534     <xsl:templ ate 
  13535      match="n1: table"
  13536     >
  13537                       
  13538      <table 
  13539       class="nar r_table"
  13540      >
  13541                                 
  13542       <xsl:copy- of 
  13543        select="@*
  13544       />
  13545                                 
  13546       <xsl:apply -templates  />
  13547                        
  13548      </table>
  13549              
  13550     </xsl:temp late>
  13551             
  13552     <xsl:templ ate 
  13553      match="n1: thead"
  13554     >
  13555                       
  13556      <thead>
  13557                                 
  13558       <xsl:copy- of 
  13559        select="@*
  13560       />
  13561                                 
  13562       <xsl:apply -templates  />
  13563                        
  13564      </thead>
  13565              
  13566     </xsl:temp late>
  13567             
  13568     <xsl:templ ate 
  13569      match="n1: tfoot"
  13570     >
  13571                       
  13572      <tfoot>
  13573                                 
  13574       <xsl:copy- of 
  13575        select="@*
  13576       />
  13577                                 
  13578       <xsl:apply -templates  />
  13579                        
  13580      </tfoot>
  13581              
  13582     </xsl:temp late>
  13583             
  13584     <xsl:templ ate 
  13585      match="n1: tbody"
  13586     >
  13587                       
  13588      <tbody>
  13589                                 
  13590       <xsl:copy- of 
  13591        select="@*
  13592       />
  13593                                 
  13594       <xsl:apply -templates  />
  13595                        
  13596      </tbody>
  13597              
  13598     </xsl:temp late>
  13599             
  13600     <xsl:templ ate 
  13601      match="n1: colgroup"
  13602     >
  13603                       
  13604      <colgroup>
  13605                                 
  13606       <xsl:copy- of 
  13607        select="@*
  13608       />
  13609                                 
  13610       <xsl:apply -templates  />
  13611                        
  13612      </colgroup >
  13613              
  13614     </xsl:temp late>
  13615             
  13616     <xsl:templ ate 
  13617      match="n1: col"
  13618     >
  13619                       
  13620      <col>
  13621                                 
  13622       <xsl:copy- of 
  13623        select="@*
  13624       />
  13625                                 
  13626       <xsl:apply -templates  />
  13627                        
  13628      </col>
  13629              
  13630     </xsl:temp late>
  13631             
  13632     <xsl:templ ate 
  13633      match="n1: tr"
  13634     >
  13635                       
  13636      <tr 
  13637       class="nar r_tr"
  13638      >
  13639                                 
  13640       <xsl:copy- of 
  13641        select="@*
  13642       />
  13643                                 
  13644       <xsl:apply -templates  />
  13645                        
  13646      </tr>
  13647              
  13648     </xsl:temp late>
  13649             
  13650     <xsl:templ ate 
  13651      match="n1: th"
  13652     >
  13653                       
  13654      <th 
  13655       class="nar r_th"
  13656      >
  13657                                 
  13658       <xsl:copy- of 
  13659        select="@*
  13660       />
  13661                                 
  13662       <xsl:apply -templates  />
  13663                        
  13664      </th>
  13665              
  13666     </xsl:temp late>
  13667             
  13668     <xsl:templ ate 
  13669      match="n1: td"
  13670     >
  13671                       
  13672      <td>
  13673                                 
  13674       <xsl:copy- of 
  13675        select="@*
  13676       />
  13677                                 
  13678       <xsl:apply -templates  />
  13679                        
  13680      </td>
  13681              
  13682     </xsl:temp late>
  13683             
  13684     <xsl:templ ate 
  13685      match="n1: table/n1:c aption"
  13686     >
  13687                       
  13688      <span 
  13689       style="fon t-weight:b old; "
  13690      >
  13691                                 
  13692       <xsl:apply -templates  />
  13693                        
  13694      </span>
  13695              
  13696     </xsl:temp late>
  13697    
  13698             
  13699     <!-- Asha  Amritraj:  Attachment  Links - S TART -->
  13700             
  13701     <xsl:templ ate 
  13702      match="n1: observatio nMedia"
  13703     >
  13704                       
  13705      <!-- Hardc oded Link  - TODO: Re place to d ynamic lin k -->
  13706                       
  13707      <pre>
  13708                                 
  13709       <a
  13710                                          
  13711        href="View Attachment .do_sec?me diaType={n 1:value/@m ediaType}& amp;repres entation={ n1:value/@ representa tion}&amp; docType=Pr ivacyConse ntDirectiv e"
  13712       >
  13713        View attac hment
  13714       </a>
  13715                        
  13716      </pre>
  13717              
  13718     </xsl:temp late>
  13719             
  13720     <!-- Asha  Amritraj:  Attachment  Links - E ND -->
  13721    
  13722    
  13723             
  13724     <!-- Rende rMultiMedi a this cur rently onl y handles  GIF's and  JPEG's. It  could, 
  13725                      howe ver, be ex tended by  including  other imag e MIME typ es in the  predicate 
  13726                      and/ or by gene rating <ob ject> or < applet> ta g with the  correct p arams depe nding 
  13727                      on t he media t ype @ID =$ imageRef r eferencedO bject -->
  13728             
  13729     <xsl:templ ate 
  13730      match="n1: renderMult iMedia"
  13731     >
  13732                       
  13733      <xsl:varia ble 
  13734       name="imag eRef" 
  13735       select="@r eferencedO bject" 
  13736      />
  13737                       
  13738      <xsl:choos e>
  13739                                 
  13740       <xsl:when 
  13741        test="//n1 :regionOfI nterest[@I D=$imageRe f]"
  13742       >
  13743                                           
  13744        <!-- Here  is where t he Region  of Interes t image re ferencing  goes -->
  13745                                           
  13746        <xsl:if
  13747                                                   
  13748         test="//n1 :regionOfI nterest[@I D=$imageRe f]//n1:obs ervationMe dia/n1:val ue[@mediaT ype='image /gif' or
  13749          @mediaTyp e='image/j peg']"
  13750        >
  13751                                                    
  13752         <br 
  13753          clear="all
  13754         />
  13755                                                    
  13756         <xsl:eleme nt 
  13757          name="img"
  13758         >
  13759                                                              
  13760          <xsl:attri bute 
  13761           name="src"
  13762          >
  13763           <xsl:value -of
  13764                                                                        
  13765            select="// n1:regionO fInterest[ @ID=$image Ref]//n1:o bservation Media/n1:v alue/n1:re ference/@v alue" 
  13766           />
  13767          </xsl:attr ibute>
  13768                                                     
  13769         </xsl:elem ent>
  13770                                            
  13771        </xsl:if>
  13772                                  
  13773       </xsl:when >
  13774                                 
  13775       <xsl:other wise>
  13776                                           
  13777        <!-- Here  is where t he direct  MultiMedia  image ref erencing g oes -->
  13778                                           
  13779        <xsl:if
  13780                                                   
  13781         test="//n1 :observati onMedia[@I D=$imageRe f]/n1:valu e[@mediaTy pe='image/ gif' or @m ediaType=' image/jpeg ']"
  13782        >
  13783                                                    
  13784         <br 
  13785          clear="all
  13786         />
  13787                                                    
  13788         <xsl:eleme nt 
  13789          name="img"
  13790         >
  13791                                                              
  13792          <xsl:attri bute 
  13793           name="src"
  13794          >
  13795           <xsl:value -of
  13796                                                                        
  13797            select="// n1:observa tionMedia[ @ID=$image Ref]/n1:va lue/n1:ref erence/@va lue" 
  13798           />
  13799          </xsl:attr ibute>
  13800                                                     
  13801         </xsl:elem ent>
  13802                                            
  13803        </xsl:if>
  13804                                  
  13805       </xsl:othe rwise>
  13806                        
  13807      </xsl:choo se>
  13808              
  13809     </xsl:temp late>
  13810             
  13811     <!-- Style code proce ssing Supp orts Bold,  Underline  and Itali cs display  -->
  13812             
  13813     <xsl:templ ate 
  13814      match="//n 1:*[@style Code]"
  13815     >
  13816                       
  13817      <xsl:if 
  13818       test="@sty leCode='Bo ld'"
  13819      >
  13820                                 
  13821       <xsl:eleme nt 
  13822        name="b"
  13823       >
  13824                                           
  13825        <xsl:apply -templates  />
  13826                                  
  13827       </xsl:elem ent>
  13828                        
  13829      </xsl:if>
  13830                       
  13831      <xsl:if 
  13832       test="@sty leCode='It alics'"
  13833      >
  13834                                 
  13835       <xsl:eleme nt 
  13836        name="i"
  13837       >
  13838                                           
  13839        <xsl:apply -templates  />
  13840                                  
  13841       </xsl:elem ent>
  13842                        
  13843      </xsl:if>
  13844                       
  13845      <xsl:if 
  13846       test="@sty leCode='Un derline'"
  13847      >
  13848                                 
  13849       <xsl:eleme nt 
  13850        name="u"
  13851       >
  13852                                           
  13853        <xsl:apply -templates  />
  13854                                  
  13855       </xsl:elem ent>
  13856                        
  13857      </xsl:if>
  13858                       
  13859      <xsl:if
  13860                                
  13861       test="cont ains(@styl eCode,'Bol d') and co ntains(@st yleCode,'I talics') a nd not (co ntains(@st yleCode, ' Underline' ))"
  13862      >
  13863                                 
  13864       <xsl:eleme nt 
  13865        name="b"
  13866       >
  13867                                           
  13868        <xsl:eleme nt 
  13869         name="i"
  13870        >
  13871                                                    
  13872         <xsl:apply -templates  />
  13873                                            
  13874        </xsl:elem ent>
  13875                                  
  13876       </xsl:elem ent>
  13877                        
  13878      </xsl:if>
  13879                       
  13880      <xsl:if
  13881                                
  13882       test="cont ains(@styl eCode,'Bol d') and co ntains(@st yleCode,'U nderline')  and not ( contains(@ styleCode,  'Italics' ))"
  13883      >
  13884                                 
  13885       <xsl:eleme nt 
  13886        name="b"
  13887       >
  13888                                           
  13889        <xsl:eleme nt 
  13890         name="u"
  13891        >
  13892                                                    
  13893         <xsl:apply -templates  />
  13894                                            
  13895        </xsl:elem ent>
  13896                                  
  13897       </xsl:elem ent>
  13898                        
  13899      </xsl:if>
  13900                       
  13901      <xsl:if
  13902                                
  13903       test="cont ains(@styl eCode,'Ita lics') and  contains( @styleCode ,'Underlin e') and no t (contain s(@styleCo de, 'Bold' ))"
  13904      >
  13905                                 
  13906       <xsl:eleme nt 
  13907        name="i"
  13908       >
  13909                                           
  13910        <xsl:eleme nt 
  13911         name="u"
  13912        >
  13913                                                    
  13914         <xsl:apply -templates  />
  13915                                            
  13916        </xsl:elem ent>
  13917                                  
  13918       </xsl:elem ent>
  13919                        
  13920      </xsl:if>
  13921                       
  13922      <xsl:if
  13923                                
  13924       test="cont ains(@styl eCode,'Ita lics') and  contains( @styleCode ,'Underlin e') and co ntains(@st yleCode, ' Bold')"
  13925      >
  13926                                 
  13927       <xsl:eleme nt 
  13928        name="b"
  13929       >
  13930                                           
  13931        <xsl:eleme nt 
  13932         name="i"
  13933        >
  13934                                                    
  13935         <xsl:eleme nt 
  13936          name="u"
  13937         >
  13938                                                              
  13939          <xsl:apply -templates  />
  13940                                                     
  13941         </xsl:elem ent>
  13942                                            
  13943        </xsl:elem ent>
  13944                                  
  13945       </xsl:elem ent>
  13946                        
  13947      </xsl:if>
  13948                       
  13949      <xsl:if
  13950                                
  13951       test="not  (contains( @styleCode ,'Italics' ) or conta ins(@style Code,'Unde rline') or  contains( @styleCode , 'Bold')) "
  13952      >
  13953                                 
  13954       <xsl:apply -templates  />
  13955                        
  13956      </xsl:if>
  13957              
  13958     </xsl:temp late>
  13959             
  13960     <!-- Super script or  Subscript  -->
  13961             
  13962     <xsl:templ ate 
  13963      match="n1: sup"
  13964     >
  13965                       
  13966      <xsl:eleme nt 
  13967       name="sup"
  13968      >
  13969                                 
  13970       <xsl:apply -templates  />
  13971                        
  13972      </xsl:elem ent>
  13973              
  13974     </xsl:temp late>
  13975             
  13976     <xsl:templ ate 
  13977      match="n1: sub"
  13978     >
  13979                       
  13980      <xsl:eleme nt 
  13981       name="sub"
  13982      >
  13983                                 
  13984       <xsl:apply -templates  />
  13985                        
  13986      </xsl:elem ent>
  13987              
  13988     </xsl:temp late>
  13989             
  13990     <!-- show- signature  -->
  13991             
  13992     <xsl:templ ate 
  13993      name="show -sig"
  13994     >
  13995                       
  13996      <xsl:param  
  13997       name="sig"  
  13998      />
  13999                       
  14000      <xsl:choos e>
  14001                                 
  14002       <xsl:when 
  14003        test="$sig /@code =&a pos;S&apos ;"
  14004       >
  14005                                           
  14006        <xsl:text>
  14007         signed
  14008        </xsl:text >
  14009                                  
  14010       </xsl:when >
  14011                                 
  14012       <xsl:when 
  14013        test="$sig /@code=&ap os;I&apos; "
  14014       >
  14015                                           
  14016        <xsl:text>
  14017         intended
  14018        </xsl:text >
  14019                                  
  14020       </xsl:when >
  14021                                 
  14022       <xsl:when 
  14023        test="$sig /@code=&ap os;X&apos; "
  14024       >
  14025                                           
  14026        <xsl:text>
  14027         signature  required
  14028        </xsl:text >
  14029                                  
  14030       </xsl:when >
  14031                        
  14032      </xsl:choo se>
  14033              
  14034     </xsl:temp late>
  14035             
  14036     <!-- show- id -->
  14037             
  14038     <xsl:templ ate 
  14039      name="show -id"
  14040     >
  14041                       
  14042      <xsl:param  
  14043       name="id" 
  14044      />
  14045                       
  14046      <xsl:choos e>
  14047                                 
  14048       <xsl:when 
  14049        test="not( $id)"
  14050       >
  14051                                           
  14052        <xsl:if 
  14053         test="not( @nullFlavo r)"
  14054        >
  14055                                                    
  14056         <xsl:if 
  14057          test="@ext ension"
  14058         >
  14059                                                              
  14060          <xsl:value -of 
  14061           select="@e xtension" 
  14062          />
  14063                                                     
  14064         </xsl:if>
  14065                                                    
  14066         <xsl:text>
  14067          :
  14068         </xsl:text >
  14069                                                    
  14070         <xsl:value -of 
  14071          select="@r oot" 
  14072         />
  14073                                            
  14074        </xsl:if>
  14075                                  
  14076       </xsl:when >
  14077                                 
  14078       <xsl:other wise>
  14079                                           
  14080        <xsl:if 
  14081         test="not( $id/@nullF lavor)"
  14082        >
  14083                                                    
  14084         <xsl:if 
  14085          test="$id/ @extension "
  14086         >
  14087                                                              
  14088          <xsl:value -of 
  14089           select="$i d/@extensi on" 
  14090          />
  14091                                                     
  14092         </xsl:if>
  14093                                                    
  14094         <xsl:text>
  14095          :
  14096         </xsl:text >
  14097                                                    
  14098         <xsl:value -of 
  14099          select="$i d/@root" 
  14100         />
  14101                                            
  14102        </xsl:if>
  14103                                  
  14104       </xsl:othe rwise>
  14105                        
  14106      </xsl:choo se>
  14107              
  14108     </xsl:temp late>
  14109             
  14110     <!-- show- name -->
  14111             
  14112     <xsl:templ ate 
  14113      name="show -name"
  14114     >
  14115                       
  14116      <xsl:param  
  14117       name="name
  14118      />
  14119                       
  14120      <xsl:choos e>
  14121                                 
  14122       <xsl:when 
  14123        test="$nam e/n1:famil y"
  14124       >
  14125                                           
  14126        <xsl:if 
  14127         test="$nam e/n1:prefi x"
  14128        >
  14129                                                    
  14130         <xsl:value -of 
  14131          select="$n ame/n1:pre fix" 
  14132         />
  14133                                                    
  14134         <xsl:text>
  14135           
  14136         </xsl:text >
  14137                                            
  14138        </xsl:if>
  14139                                           
  14140        <xsl:value -of 
  14141         select="$n ame/n1:giv en" 
  14142        />
  14143                                           
  14144        <xsl:text>
  14145          
  14146        </xsl:text >
  14147                                           
  14148        <xsl:value -of 
  14149         select="$n ame/n1:fam ily" 
  14150        />
  14151                                           
  14152        <xsl:if 
  14153         test="$nam e/n1:suffi x"
  14154        >
  14155                                                    
  14156         <xsl:text>
  14157         
  14158         </xsl:text >
  14159                                                    
  14160         <xsl:value -of 
  14161          select="$n ame/n1:suf fix" 
  14162         />
  14163                                            
  14164        </xsl:if>
  14165                                  
  14166       </xsl:when >
  14167                                 
  14168       <xsl:other wise>
  14169                                           
  14170        <xsl:value -of 
  14171         select="$n ame" 
  14172        />
  14173                                  
  14174       </xsl:othe rwise>
  14175                        
  14176      </xsl:choo se>
  14177              
  14178     </xsl:temp late>
  14179             
  14180     <!-- show- gender -->
  14181             
  14182     <xsl:templ ate 
  14183      name="show -gender"
  14184     >
  14185                       
  14186      <xsl:choos e>
  14187                                 
  14188       <xsl:when 
  14189        test="@cod e   = &apo s;M&apos;"
  14190       >
  14191                                           
  14192        <xsl:text>
  14193         Male
  14194        </xsl:text >
  14195                                  
  14196       </xsl:when >
  14197                                 
  14198       <xsl:when 
  14199        test="@cod e  = &apos ;F&apos;"
  14200       >
  14201                                           
  14202        <xsl:text>
  14203         Female
  14204        </xsl:text >
  14205                                  
  14206       </xsl:when >
  14207                                 
  14208       <xsl:when 
  14209        test="@cod e  = &apos ;U&apos;"
  14210       >
  14211                                           
  14212        <xsl:text>
  14213         Undifferen tiated
  14214        </xsl:text >
  14215                                  
  14216       </xsl:when >
  14217                        
  14218      </xsl:choo se>
  14219              
  14220     </xsl:temp late>
  14221             
  14222     <!-- show- race-ethni city -->
  14223             
  14224     <xsl:templ ate 
  14225      name="show -race-ethn icity"
  14226     >
  14227                       
  14228      <xsl:choos e>
  14229                                 
  14230       <xsl:when 
  14231        test="@dis playName"
  14232       >
  14233                                           
  14234        <xsl:value -of 
  14235         select="@d isplayName
  14236        />
  14237                                  
  14238       </xsl:when >
  14239                                 
  14240       <xsl:other wise>
  14241                                           
  14242        <xsl:value -of 
  14243         select="@c ode" 
  14244        />
  14245                                  
  14246       </xsl:othe rwise>
  14247                        
  14248      </xsl:choo se>
  14249              
  14250     </xsl:temp late>
  14251             
  14252     <!-- show- contactInf o -->
  14253             
  14254     <xsl:templ ate 
  14255      name="show -contactIn fo"
  14256     >
  14257                       
  14258      <xsl:param  
  14259       name="cont act" 
  14260      />
  14261                       
  14262      <xsl:call- template 
  14263       name="show -address"
  14264      >
  14265                                 
  14266       <xsl:with- param 
  14267        name="addr ess" 
  14268        select="$c ontact/n1: addr" 
  14269       />
  14270                        
  14271      </xsl:call -template>
  14272                       
  14273      <xsl:call- template 
  14274       name="show -telecom"
  14275      >
  14276                                 
  14277       <xsl:with- param 
  14278        name="tele com" 
  14279        select="$c ontact/n1: telecom" 
  14280       />
  14281                        
  14282      </xsl:call -template>
  14283              
  14284     </xsl:temp late>
  14285             
  14286     <!-- show- address -- >
  14287             
  14288     <xsl:templ ate 
  14289      name="show -address"
  14290     >
  14291                       
  14292      <xsl:param  
  14293       name="addr ess" 
  14294      />
  14295                       
  14296      <xsl:choos e>
  14297                                 
  14298       <xsl:when 
  14299        test="$add ress"
  14300       >
  14301                                           
  14302        <xsl:if 
  14303         test="$add ress/@use"
  14304        >
  14305                                                    
  14306         <xsl:text>
  14307           
  14308         </xsl:text >
  14309                                                    
  14310         <xsl:call- template 
  14311          name="tran slateTelec omCode"
  14312         >
  14313                                                              
  14314          <xsl:with- param 
  14315           name="code
  14316           select="$a ddress/@us e" 
  14317          />
  14318                                                     
  14319         </xsl:call -template>
  14320                                                    
  14321         <xsl:text>
  14322          :
  14323         </xsl:text >
  14324                                                    
  14325         <br />
  14326                                            
  14327        </xsl:if>
  14328                                           
  14329        <xsl:for-e ach 
  14330         select="$a ddress/n1: streetAddr essLine"
  14331        >
  14332                                                    
  14333         <xsl:value -of 
  14334          select="."  
  14335         />
  14336                                                    
  14337         <br />
  14338                                            
  14339        </xsl:for- each>
  14340                                           
  14341        <xsl:if 
  14342         test="$add ress/n1:st reetName"
  14343        >
  14344                                                    
  14345         <xsl:value -of 
  14346          select="$a ddress/n1: streetName
  14347         />
  14348                                                    
  14349         <xsl:text>
  14350           
  14351         </xsl:text >
  14352                                                    
  14353         <xsl:value -of 
  14354          select="$a ddress/n1: houseNumbe r" 
  14355         />
  14356                                                    
  14357         <br />
  14358                                            
  14359        </xsl:if>
  14360                                           
  14361        <xsl:if 
  14362         test="stri ng-length( $address/n 1:city)>0"
  14363        >
  14364                                                    
  14365         <xsl:value -of 
  14366          select="$a ddress/n1: city" 
  14367         />
  14368                                            
  14369        </xsl:if>
  14370                                           
  14371        <xsl:if 
  14372         test="stri ng-length( $address/n 1:state)>0 "
  14373        >
  14374                                                    
  14375         <xsl:text>
  14376          ,&#160;
  14377         </xsl:text >
  14378                                                    
  14379         <xsl:value -of 
  14380          select="$a ddress/n1: state" 
  14381         />
  14382                                            
  14383        </xsl:if>
  14384                                           
  14385        <xsl:if 
  14386         test="stri ng-length( $address/n 1:postalCo de)>0"
  14387        >
  14388                                                    
  14389         <xsl:text>
  14390          &#160;
  14391         </xsl:text >
  14392                                                    
  14393         <xsl:value -of 
  14394          select="$a ddress/n1: postalCode
  14395         />
  14396                                            
  14397        </xsl:if>
  14398                                           
  14399        <xsl:if 
  14400         test="stri ng-length( $address/n 1:country) >0"
  14401        >
  14402                                                    
  14403         <xsl:text>
  14404          ,&#160;
  14405         </xsl:text >
  14406                                                    
  14407         <xsl:value -of 
  14408          select="$a ddress/n1: country" 
  14409         />
  14410                                            
  14411        </xsl:if>
  14412                                  
  14413       </xsl:when >
  14414                                 
  14415       <xsl:other wise>
  14416                                           
  14417        <xsl:text>
  14418         address no t availabl e
  14419        </xsl:text >
  14420                                  
  14421       </xsl:othe rwise>
  14422                        
  14423      </xsl:choo se>
  14424                       
  14425      <br />
  14426              
  14427     </xsl:temp late>
  14428             
  14429     <!-- show- telecom -- >
  14430             
  14431     <xsl:templ ate 
  14432      name="show -telecom"
  14433     >
  14434                       
  14435      <xsl:param  
  14436       name="tele com" 
  14437      />
  14438                       
  14439      <xsl:choos e>
  14440                                 
  14441       <xsl:when 
  14442        test="$tel ecom"
  14443       >
  14444                                           
  14445        <xsl:varia ble 
  14446         name="type "
  14447                                                   
  14448         select="su bstring-be fore($tele com/@value , ':')" 
  14449        />
  14450                                           
  14451        <xsl:varia ble 
  14452         name="valu e"
  14453                                                   
  14454         select="su bstring-af ter($telec om/@value,  ':')" 
  14455        />
  14456                                           
  14457        <xsl:if 
  14458         test="$typ e"
  14459        >
  14460                                                    
  14461         <xsl:call- template 
  14462          name="tran slateTelec omCode"
  14463         >
  14464                                                              
  14465          <xsl:with- param 
  14466           name="code
  14467           select="$t ype" 
  14468          />
  14469                                                     
  14470         </xsl:call -template>
  14471                                                    
  14472         <xsl:if 
  14473          test="@use "
  14474         >
  14475                                                              
  14476          <xsl:text>
  14477            (
  14478          </xsl:text >
  14479                                                              
  14480          <xsl:call- template 
  14481           name="tran slateTelec omCode"
  14482          >
  14483                                                                        
  14484           <xsl:with- param 
  14485            name="code
  14486            select="@u se" 
  14487           />
  14488                                                               
  14489          </xsl:call -template>
  14490                                                              
  14491          <xsl:text>
  14492           )
  14493          </xsl:text >
  14494                                                     
  14495         </xsl:if>
  14496                                                    
  14497         <xsl:text>
  14498         
  14499         </xsl:text >
  14500                                                    
  14501         <xsl:text>
  14502           
  14503         </xsl:text >
  14504                                                    
  14505         <xsl:value -of 
  14506          select="$v alue" 
  14507         />
  14508                                            
  14509        </xsl:if>
  14510                                  
  14511       </xsl:when >
  14512                                 
  14513       <xsl:other wise>
  14514                                           
  14515        <xsl:text>
  14516         Telecom in formation  not availa ble
  14517        </xsl:text >
  14518                                  
  14519       </xsl:othe rwise>
  14520                        
  14521      </xsl:choo se>
  14522                       
  14523      <br />
  14524              
  14525     </xsl:temp late>
  14526             
  14527     <!-- show- recipientT ype -->
  14528             
  14529     <xsl:templ ate 
  14530      name="show -recipient Type"
  14531     >
  14532                       
  14533      <xsl:param  
  14534       name="type Code" 
  14535      />
  14536                       
  14537      <xsl:choos e>
  14538                                 
  14539       <xsl:when 
  14540        test="$typ eCode='PRC P'"
  14541       >
  14542                                           Primary  Recipient:
  14543                                  
  14544       </xsl:when >
  14545                                 
  14546       <xsl:when 
  14547        test="$typ eCode='TRC '"
  14548       >
  14549                                           Secondar y Recipien t:
  14550                                  
  14551       </xsl:when >
  14552                                 
  14553       <xsl:other wise>
  14554                                           Recipien t:
  14555                                  
  14556       </xsl:othe rwise>
  14557                        
  14558      </xsl:choo se>
  14559              
  14560     </xsl:temp late>
  14561             
  14562     <!-- Conve rt Telecom  URL to di splay text  -->
  14563             
  14564     <xsl:templ ate 
  14565      name="tran slateTelec omCode"
  14566     >
  14567                       
  14568      <xsl:param  
  14569       name="code
  14570      />
  14571                       
  14572      <!--xsl:va lue-of sel ect="docum ent('voc.x ml')/syste ms/system[ @root=$cod e/@codeSys tem]/code[ @value=$co de/@code]/ @displayNa me"/ -->
  14573                       
  14574      <!--xsl:va lue-of sel ect="docum ent('codes .xml')/*/c ode[@code= $code]/@di splay"/ -- >
  14575                       
  14576      <xsl:choos e>
  14577                                 
  14578       <!-- looku p table Te lecom URI  -->
  14579                                 
  14580       <xsl:when 
  14581        test="$cod e='tel'"
  14582       >
  14583                                           
  14584        <xsl:text>
  14585         Tel
  14586        </xsl:text >
  14587                                  
  14588       </xsl:when >
  14589                                 
  14590       <xsl:when 
  14591        test="$cod e='fax'"
  14592       >
  14593                                           
  14594        <xsl:text>
  14595         Fax
  14596        </xsl:text >
  14597                                  
  14598       </xsl:when >
  14599                                 
  14600       <xsl:when 
  14601        test="$cod e='http'"
  14602       >
  14603                                           
  14604        <xsl:text>
  14605         Web
  14606        </xsl:text >
  14607                                  
  14608       </xsl:when >
  14609                                 
  14610       <xsl:when 
  14611        test="$cod e='mailto' "
  14612       >
  14613                                           
  14614        <xsl:text>
  14615         Mail
  14616        </xsl:text >
  14617                                  
  14618       </xsl:when >
  14619                                 
  14620       <xsl:when 
  14621        test="$cod e='H'"
  14622       >
  14623                                           
  14624        <xsl:text>
  14625         Home
  14626        </xsl:text >
  14627                                  
  14628       </xsl:when >
  14629                                 
  14630       <xsl:when 
  14631        test="$cod e='HV'"
  14632       >
  14633                                           
  14634        <xsl:text>
  14635         Vacation H ome
  14636        </xsl:text >
  14637                                  
  14638       </xsl:when >
  14639                                 
  14640       <xsl:when 
  14641        test="$cod e='HP'"
  14642       >
  14643                                           
  14644        <xsl:text>
  14645         Pirmary Ho me
  14646        </xsl:text >
  14647                                  
  14648       </xsl:when >
  14649                                 
  14650       <xsl:when 
  14651        test="$cod e='WP'"
  14652       >
  14653                                           
  14654        <xsl:text>
  14655         Work Place
  14656        </xsl:text >
  14657                                  
  14658       </xsl:when >
  14659                                 
  14660       <xsl:when 
  14661        test="$cod e='PUB'"
  14662       >
  14663                                           
  14664        <xsl:text>
  14665         Pub
  14666        </xsl:text >
  14667                                  
  14668       </xsl:when >
  14669                                 
  14670       <xsl:other wise>
  14671                                           
  14672        <xsl:text>
  14673         {$code='
  14674        </xsl:text >
  14675                                           
  14676        <xsl:value -of 
  14677         select="$c ode" 
  14678        />
  14679                                           
  14680        <xsl:text>
  14681         '?}
  14682        </xsl:text >
  14683                                  
  14684       </xsl:othe rwise>
  14685                        
  14686      </xsl:choo se>
  14687              
  14688     </xsl:temp late>
  14689             
  14690     <!-- conve rt RoleCla ssAssociat ive code t o display  text -->
  14691             
  14692     <xsl:templ ate 
  14693      name="tran slateRoleA ssoCode"
  14694     >
  14695                       
  14696      <xsl:param  
  14697       name="clas sCode" 
  14698      />
  14699                       
  14700      <xsl:param  
  14701       name="code
  14702      />
  14703                       
  14704      <xsl:choos e>
  14705                                 
  14706       <xsl:when 
  14707        test="$cla ssCode='AF FL'"
  14708       >
  14709                                           
  14710        <xsl:text>
  14711         affiliate
  14712        </xsl:text >
  14713                                  
  14714       </xsl:when >
  14715                                 
  14716       <xsl:when 
  14717        test="$cla ssCode='AG NT'"
  14718       >
  14719                                           
  14720        <xsl:text>
  14721         agent
  14722        </xsl:text >
  14723                                  
  14724       </xsl:when >
  14725                                 
  14726       <xsl:when 
  14727        test="$cla ssCode='AS SIGNED'"
  14728       >
  14729                                           
  14730        <xsl:text>
  14731         assigned e ntity
  14732        </xsl:text >
  14733                                  
  14734       </xsl:when >
  14735                                 
  14736       <xsl:when 
  14737        test="$cla ssCode='CO MPAR'"
  14738       >
  14739                                           
  14740        <xsl:text>
  14741         commission ing party
  14742        </xsl:text >
  14743                                  
  14744       </xsl:when >
  14745                                 
  14746       <xsl:when 
  14747        test="$cla ssCode='CO N'"
  14748       >
  14749                                           
  14750        <xsl:text>
  14751         contact
  14752        </xsl:text >
  14753                                  
  14754       </xsl:when >
  14755                                 
  14756       <xsl:when 
  14757        test="$cla ssCode='EC ON'"
  14758       >
  14759                                           
  14760        <xsl:text>
  14761         emergency  contact
  14762        </xsl:text >
  14763                                  
  14764       </xsl:when >
  14765                                 
  14766       <xsl:when 
  14767        test="$cla ssCode='NO K'"
  14768       >
  14769                                           
  14770        <xsl:text>
  14771         next of ki n
  14772        </xsl:text >
  14773                                  
  14774       </xsl:when >
  14775                                 
  14776       <xsl:when 
  14777        test="$cla ssCode='SG NOFF'"
  14778       >
  14779                                           
  14780        <xsl:text>
  14781         signing au thority
  14782        </xsl:text >
  14783                                  
  14784       </xsl:when >
  14785                                 
  14786       <xsl:when 
  14787        test="$cla ssCode='GU ARD'"
  14788       >
  14789                                           
  14790        <xsl:text>
  14791         guardian
  14792        </xsl:text >
  14793                                  
  14794       </xsl:when >
  14795                                 
  14796       <xsl:when 
  14797        test="$cla ssCode='GU AR'"
  14798       >
  14799                                           
  14800        <xsl:text>
  14801         guardian
  14802        </xsl:text >
  14803                                  
  14804       </xsl:when >
  14805                                 
  14806       <xsl:when 
  14807        test="$cla ssCode='CI T'"
  14808       >
  14809                                           
  14810        <xsl:text>
  14811         citizen
  14812        </xsl:text >
  14813                                  
  14814       </xsl:when >
  14815                                 
  14816       <xsl:when 
  14817        test="$cla ssCode='CO VPTY'"
  14818       >
  14819                                           
  14820        <xsl:text>
  14821         covered pa rty
  14822        </xsl:text >
  14823                                  
  14824       </xsl:when >
  14825                                 
  14826       <xsl:when 
  14827        test="$cla ssCode='PR S'"
  14828       >
  14829                                           
  14830        <xsl:text>
  14831         personal r elationshi p
  14832        </xsl:text >
  14833                                  
  14834       </xsl:when >
  14835                                 
  14836       <xsl:when 
  14837        test="$cla ssCode='CA REGIVER'"
  14838       >
  14839                                           
  14840        <xsl:text>
  14841         care giver
  14842        </xsl:text >
  14843                                  
  14844       </xsl:when >
  14845                                 
  14846       <xsl:when 
  14847        test="$cla ssCode='PR OV'"
  14848       >
  14849                                           
  14850        <xsl:text>
  14851         healthcare  provider
  14852        </xsl:text >
  14853                                  
  14854       </xsl:when >
  14855                                 
  14856       <xsl:other wise>
  14857                                           
  14858        <xsl:text>
  14859         {$classCod e='
  14860        </xsl:text >
  14861                                           
  14862        <xsl:value -of 
  14863         select="$c lassCode" 
  14864        />
  14865                                           
  14866        <xsl:text>
  14867         '?}
  14868        </xsl:text >
  14869                                  
  14870       </xsl:othe rwise>
  14871                        
  14872      </xsl:choo se>
  14873                       
  14874      <xsl:if
  14875                                
  14876       test="($co de/@code)  and ($code /@codeSyst em='2.16.8 40.1.11388 3.5.111')"
  14877      >
  14878                                 
  14879       <xsl:text>
  14880         
  14881       </xsl:text >
  14882                                 
  14883       <xsl:choos e>
  14884                                           
  14885        <xsl:when 
  14886         test="$cod e/@code='F TH'"
  14887        >
  14888                                                    
  14889         <xsl:text>
  14890          (Father)
  14891         </xsl:text >
  14892                                            
  14893        </xsl:when >
  14894                                           
  14895        <xsl:when 
  14896         test="$cod e/@code='M TH'"
  14897        >
  14898                                                    
  14899         <xsl:text>
  14900          (Mother)
  14901         </xsl:text >
  14902                                            
  14903        </xsl:when >
  14904                                           
  14905        <xsl:when 
  14906         test="$cod e/@code='N PRN'"
  14907        >
  14908                                                    
  14909         <xsl:text>
  14910          (Natural p arent)
  14911         </xsl:text >
  14912                                            
  14913        </xsl:when >
  14914                                           
  14915        <xsl:when 
  14916         test="$cod e/@code='S TPPRN'"
  14917        >
  14918                                                    
  14919         <xsl:text>
  14920          (Step pare nt)
  14921         </xsl:text >
  14922                                            
  14923        </xsl:when >
  14924                                           
  14925        <xsl:when 
  14926         test="$cod e/@code='S ONC'"
  14927        >
  14928                                                    
  14929         <xsl:text>
  14930          (Son)
  14931         </xsl:text >
  14932                                            
  14933        </xsl:when >
  14934                                           
  14935        <xsl:when 
  14936         test="$cod e/@code='D AUC'"
  14937        >
  14938                                                    
  14939         <xsl:text>
  14940          (Daughter)
  14941         </xsl:text >
  14942                                            
  14943        </xsl:when >
  14944                                           
  14945        <xsl:when 
  14946         test="$cod e/@code='C HILD'"
  14947        >
  14948                                                    
  14949         <xsl:text>
  14950          (Child)
  14951         </xsl:text >
  14952                                            
  14953        </xsl:when >
  14954                                           
  14955        <xsl:when 
  14956         test="$cod e/@code='E XT'"
  14957        >
  14958                                                    
  14959         <xsl:text>
  14960          (Extended  family mem ber)
  14961         </xsl:text >
  14962                                            
  14963        </xsl:when >
  14964                                           
  14965        <xsl:when 
  14966         test="$cod e/@code='N BOR'"
  14967        >
  14968                                                    
  14969         <xsl:text>
  14970          (Neighbor)
  14971         </xsl:text >
  14972                                            
  14973        </xsl:when >
  14974                                           
  14975        <xsl:when 
  14976         test="$cod e/@code='S IGOTHR'"
  14977        >
  14978                                                    
  14979         <xsl:text>
  14980          (Significa nt other)
  14981         </xsl:text >
  14982                                            
  14983        </xsl:when >
  14984                                           
  14985        <xsl:when 
  14986         test="$cod e/@code='U NK'"
  14987        >
  14988                                                    
  14989         <xsl:text>
  14990          (Unknown r elation)
  14991         </xsl:text >
  14992                                            
  14993        </xsl:when >
  14994                                           
  14995        <xsl:other wise>
  14996                                                    
  14997         <xsl:text>
  14998          {$code/@co de='
  14999         </xsl:text >
  15000                                                    
  15001         <xsl:value -of 
  15002          select="$c ode/@code"  
  15003         />
  15004                                                    
  15005         <xsl:text>
  15006          '?}
  15007         </xsl:text >
  15008                                            
  15009        </xsl:othe rwise>
  15010                                  
  15011       </xsl:choo se>
  15012                        
  15013      </xsl:if>
  15014              
  15015     </xsl:temp late>
  15016             
  15017     <!-- show  time -->
  15018             
  15019     <xsl:templ ate 
  15020      name="show -time"
  15021     >
  15022                       
  15023      <xsl:param  
  15024       name="date time" 
  15025      />
  15026                       
  15027      <xsl:choos e>
  15028                                 
  15029       <xsl:when 
  15030        test="not( $datetime) "
  15031       >
  15032                                           
  15033        <xsl:call- template 
  15034         name="form atDateTime "
  15035        >
  15036                                                    
  15037         <xsl:with- param 
  15038          name="date
  15039          select="@v alue" 
  15040         />
  15041                                            
  15042        </xsl:call -template>
  15043                                           
  15044        <xsl:text>
  15045          
  15046        </xsl:text >
  15047                                  
  15048       </xsl:when >
  15049                                 
  15050       <xsl:other wise>
  15051                                           
  15052        <xsl:call- template 
  15053         name="form atDateTime "
  15054        >
  15055                                                    
  15056         <xsl:with- param 
  15057          name="date
  15058          select="$d atetime/@v alue" 
  15059         />
  15060                                            
  15061        </xsl:call -template>
  15062                                           
  15063        <xsl:text>
  15064          
  15065        </xsl:text >
  15066                                  
  15067       </xsl:othe rwise>
  15068                        
  15069      </xsl:choo se>
  15070              
  15071     </xsl:temp late>
  15072             
  15073     <!-- patic ipant faci lity and d ate -->
  15074             
  15075     <xsl:templ ate 
  15076      name="faci lityAndDat es"
  15077     >
  15078                       
  15079      <table 
  15080       class="hea der_table"
  15081      >
  15082                                 
  15083       <tbody>
  15084                                           
  15085        <!-- facil ity id -->
  15086                                           
  15087        <tr 
  15088         class="tr_ header"
  15089        >
  15090                                                    
  15091         <td 
  15092          width="20%
  15093          class="td_ header_lab el"
  15094         >
  15095                                                              
  15096          <span 
  15097           class="td_ label"
  15098          >
  15099                                                                        
  15100           <xsl:text>
  15101            Facility I D
  15102           </xsl:text >
  15103                                                               
  15104          </span>
  15105                                                     
  15106         </td>
  15107                                                    
  15108         <td 
  15109          colspan="3 "
  15110         >
  15111                                                              
  15112          <xsl:choos e>
  15113                                                                        
  15114           <xsl:when
  15115                                                                                 
  15116            test="coun t(/n1:Clin icalDocume nt/n1:part icipant
  15117                                                     [@ typeCode=' LOC'][@con textContro lCode='OP' ]
  15118                                                     /n 1:associat edEntity[@ classCode= 'SDLOC']/n 1:id)&gt;0 "
  15119           >
  15120                                                                                  
  15121            <!-- chang e context  node -->
  15122                                                                                  
  15123            <xsl:for-e ach
  15124                                                                                           
  15125             select="/n 1:Clinical Document/n 1:particip ant
  15126                                                      [@ typeCode=' LOC'][@con textContro lCode='OP' ]
  15127                                                      /n 1:associat edEntity[@ classCode= 'SDLOC']/n 1:id"
  15128            >
  15129                                                                                            
  15130             <xsl:call- template 
  15131              name="show -id" 
  15132             />
  15133                                                                                            
  15134             <!-- chang e context  node again , for the  code -->
  15135                                                                                            
  15136             <xsl:for-e ach 
  15137              select=".. /n1:code"
  15138             >
  15139                                                                                                     
  15140              <xsl:text>
  15141                (
  15142              </xsl:text >
  15143                                                                                                     
  15144              <xsl:call- template 
  15145               name="show -code"
  15146              >
  15147                                                                                                               
  15148               <xsl:with- param 
  15149                name="code
  15150                select="."  
  15151               />
  15152                                                                                                      
  15153              </xsl:call -template>
  15154                                                                                                     
  15155              <xsl:text>
  15156               )
  15157              </xsl:text >
  15158                                                                                             
  15159             </xsl:for- each>
  15160                                                                                   
  15161            </xsl:for- each>
  15162                                                                         
  15163           </xsl:when >
  15164                                                                        
  15165           <xsl:other wise>
  15166                                                                                  Not av ailable
  15167                                                                         
  15168           </xsl:othe rwise>
  15169                                                               
  15170          </xsl:choo se>
  15171                                                     
  15172         </td>
  15173                                            
  15174        </tr>
  15175                                           
  15176        <!-- Perio d reported  -->
  15177                                           
  15178        <tr 
  15179         class="tr_ header"
  15180        >
  15181                                                    
  15182         <td 
  15183          width="20%
  15184          class="td_ header_lab el"
  15185         >
  15186                                                              
  15187          <span 
  15188           class="td_ label"
  15189          >
  15190                                                                        
  15191           <xsl:text>
  15192            First day  of period  reported
  15193           </xsl:text >
  15194                                                               
  15195          </span>
  15196                                                     
  15197         </td>
  15198                                                    
  15199         <td 
  15200          width="80%
  15201          colspan="3 "
  15202         >
  15203                                                              
  15204          <xsl:call- template 
  15205           name="show -time"
  15206          >
  15207                                                                        
  15208           <xsl:with- param 
  15209            name="date time"
  15210                                                                                 
  15211            select="/n 1:Clinical Document/n 1:document ationOf
  15212                                                     /n 1:serviceE vent/n1:ef fectiveTim e/n1:low" 
  15213           />
  15214                                                               
  15215          </xsl:call -template>
  15216                                                     
  15217         </td>
  15218                                            
  15219        </tr>
  15220                                           
  15221        <tr 
  15222         class="tr_ header"
  15223        >
  15224                                                    
  15225         <td 
  15226          width="20%
  15227          class="td_ header_lab el"
  15228         >
  15229                                                              
  15230          <span 
  15231           class="td_ label"
  15232          >
  15233                                                                        
  15234           <xsl:text>
  15235            Last day o f period r eported
  15236           </xsl:text >
  15237                                                               
  15238          </span>
  15239                                                     
  15240         </td>
  15241                                                    
  15242         <td 
  15243          width="80%
  15244          colspan="3 "
  15245         >
  15246                                                              
  15247          <xsl:call- template 
  15248           name="show -time"
  15249          >
  15250                                                                        
  15251           <xsl:with- param 
  15252            name="date time"
  15253                                                                                 
  15254            select="/n 1:Clinical Document/n 1:document ationOf
  15255                                                     /n 1:serviceE vent/n1:ef fectiveTim e/n1:high"  
  15256           />
  15257                                                               
  15258          </xsl:call -template>
  15259                                                     
  15260         </td>
  15261                                            
  15262        </tr>
  15263                                  
  15264       </tbody>
  15265                        
  15266      </table>
  15267              
  15268     </xsl:temp late>
  15269             
  15270     <!-- show  assignedEn tity -->
  15271             
  15272     <xsl:templ ate 
  15273      name="show -assignedE ntity"
  15274     >
  15275                       
  15276      <xsl:param  
  15277       name="asgn Entity" 
  15278      />
  15279                       
  15280      <xsl:choos e>
  15281                                 
  15282       <xsl:when 
  15283        test="$asg nEntity/n1 :assignedP erson/n1:n ame"
  15284       >
  15285                                           
  15286        <xsl:call- template 
  15287         name="show -name"
  15288        >
  15289                                                    
  15290         <xsl:with- param 
  15291          name="name "
  15292                                                             
  15293          select="$a sgnEntity/ n1:assigne dPerson/n1 :name" 
  15294         />
  15295                                            
  15296        </xsl:call -template>
  15297                                           
  15298        <xsl:if 
  15299         test="$asg nEntity/n1 :represent edOrganiza tion/n1:na me"
  15300        >
  15301                                                    
  15302         <xsl:text>
  15303           of 
  15304         </xsl:text >
  15305                                                    
  15306         <xsl:value -of 
  15307          select="$a sgnEntity/ n1:represe ntedOrgani zation/n1: name" 
  15308         />
  15309                                            
  15310        </xsl:if>
  15311                                  
  15312       </xsl:when >
  15313                                 
  15314       <xsl:when 
  15315        test="$asg nEntity/n1 :represent edOrganiza tion"
  15316       >
  15317                                           
  15318        <xsl:value -of 
  15319         select="$a sgnEntity/ n1:represe ntedOrgani zation/n1: name" 
  15320        />
  15321                                  
  15322       </xsl:when >
  15323                                 
  15324       <xsl:other wise>
  15325                                           
  15326        <xsl:for-e ach 
  15327         select="$a sgnEntity/ n1:id"
  15328        >
  15329                                                    
  15330         <xsl:call- template 
  15331          name="show -id" 
  15332         />
  15333                                                    
  15334         <xsl:choos e>
  15335                                                              
  15336          <xsl:when 
  15337           test="posi tion()!=la st()"
  15338          >
  15339                                                                        
  15340           <xsl:text>
  15341           
  15342           </xsl:text >
  15343                                                               
  15344          </xsl:when >
  15345                                                              
  15346          <xsl:other wise>
  15347                                                                        
  15348           <br />
  15349                                                               
  15350          </xsl:othe rwise>
  15351                                                     
  15352         </xsl:choo se>
  15353                                            
  15354        </xsl:for- each>
  15355                                  
  15356       </xsl:othe rwise>
  15357                        
  15358      </xsl:choo se>
  15359              
  15360     </xsl:temp late>
  15361             
  15362     <!-- show  relatedEnt ity -->
  15363             
  15364     <xsl:templ ate 
  15365      name="show -relatedEn tity"
  15366     >
  15367                       
  15368      <xsl:param  
  15369       name="rela tedEntity"  
  15370      />
  15371                       
  15372      <xsl:choos e>
  15373                                 
  15374       <xsl:when 
  15375        test="$rel atedEntity /n1:relate dPerson/n1 :name"
  15376       >
  15377                                           
  15378        <xsl:call- template 
  15379         name="show -name"
  15380        >
  15381                                                    
  15382         <xsl:with- param 
  15383          name="name "
  15384                                                             
  15385          select="$r elatedEnti ty/n1:rela tedPerson/ n1:name" 
  15386         />
  15387                                            
  15388        </xsl:call -template>
  15389                                  
  15390       </xsl:when >
  15391                        
  15392      </xsl:choo se>
  15393              
  15394     </xsl:temp late>
  15395             
  15396     <!-- show  associated Entity -->
  15397             
  15398     <xsl:templ ate 
  15399      name="show -associate dEntity"
  15400     >
  15401                       
  15402      <xsl:param  
  15403       name="asso Entity" 
  15404      />
  15405                       
  15406      <xsl:choos e>
  15407                                 
  15408       <xsl:when 
  15409        test="$ass oEntity/n1 :associate dPerson"
  15410       >
  15411                                           
  15412        <xsl:for-e ach 
  15413         select="$a ssoEntity/ n1:associa tedPerson/ n1:name"
  15414        >
  15415                                                    
  15416         <xsl:call- template 
  15417          name="show -name"
  15418         >
  15419                                                              
  15420          <xsl:with- param 
  15421           name="name
  15422           select="."  
  15423          />
  15424                                                     
  15425         </xsl:call -template>
  15426                                                    
  15427         <br />
  15428                                            
  15429        </xsl:for- each>
  15430                                  
  15431       </xsl:when >
  15432                                 
  15433       <xsl:when 
  15434        test="$ass oEntity/n1 :scopingOr ganization "
  15435       >
  15436                                           
  15437        <xsl:for-e ach 
  15438         select="$a ssoEntity/ n1:scoping Organizati on"
  15439        >
  15440                                                    
  15441         <xsl:if 
  15442          test="n1:n ame"
  15443         >
  15444                                                              
  15445          <xsl:call- template 
  15446           name="show -name"
  15447          >
  15448                                                                        
  15449           <xsl:with- param 
  15450            name="name
  15451            select="n1 :name" 
  15452           />
  15453                                                               
  15454          </xsl:call -template>
  15455                                                              
  15456          <br />
  15457                                                     
  15458         </xsl:if>
  15459                                                    
  15460         <xsl:if 
  15461          test="n1:s tandardInd ustryClass Code"
  15462         >
  15463                                                              
  15464          <xsl:value -of 
  15465           select="n1 :standardI ndustryCla ssCode/@di splayName"  
  15466          />
  15467                                                              
  15468          <xsl:text>
  15469            code:
  15470          </xsl:text >
  15471                                                              
  15472          <xsl:value -of 
  15473           select="n1 :standardI ndustryCla ssCode/@co de" 
  15474          />
  15475                                                     
  15476         </xsl:if>
  15477                                            
  15478        </xsl:for- each>
  15479                                  
  15480       </xsl:when >
  15481                                 
  15482       <xsl:when 
  15483        test="$ass oEntity/n1 :code"
  15484       >
  15485                                           
  15486        <xsl:call- template 
  15487         name="show -code"
  15488        >
  15489                                                    
  15490         <xsl:with- param 
  15491          name="code
  15492          select="$a ssoEntity/ n1:code" 
  15493         />
  15494                                            
  15495        </xsl:call -template>
  15496                                  
  15497       </xsl:when >
  15498                                 
  15499       <xsl:when 
  15500        test="$ass oEntity/n1 :id"
  15501       >
  15502                                           
  15503        <xsl:value -of 
  15504         select="$a ssoEntity/ n1:id/@ext ension" 
  15505        />
  15506                                           
  15507        <xsl:text>
  15508          
  15509        </xsl:text >
  15510                                           
  15511        <xsl:value -of 
  15512         select="$a ssoEntity/ n1:id/@roo t" 
  15513        />
  15514                                  
  15515       </xsl:when >
  15516                        
  15517      </xsl:choo se>
  15518              
  15519     </xsl:temp late>
  15520             
  15521     <!-- show  code if or iginalText  present,  return it,  otherwise , check an
  15522                      retu rn attribu te: displa y name -->
  15523             
  15524     <xsl:templ ate 
  15525      name="show -code"
  15526     >
  15527                       
  15528      <xsl:param  
  15529       name="code
  15530      />
  15531                       
  15532      <xsl:varia ble 
  15533       name="this -codeSyste m"
  15534      >
  15535                                 
  15536       <xsl:value -of 
  15537        select="$c ode/@codeS ystem" 
  15538       />
  15539                        
  15540      </xsl:vari able>
  15541                       
  15542      <xsl:varia ble 
  15543       name="this -code"
  15544      >
  15545                                 
  15546       <xsl:value -of 
  15547        select="$c ode/@code"  
  15548       />
  15549                        
  15550      </xsl:vari able>
  15551                       
  15552      <xsl:choos e>
  15553                                 
  15554       <xsl:when 
  15555        test="$cod e/n1:origi nalText"
  15556       >
  15557                                           
  15558        <xsl:value -of 
  15559         select="$c ode/n1:ori ginalText"  
  15560        />
  15561                                  
  15562       </xsl:when >
  15563                                 
  15564       <xsl:when 
  15565        test="$cod e/@display Name"
  15566       >
  15567                                           
  15568        <xsl:value -of 
  15569         select="$c ode/@displ ayName" 
  15570        />
  15571                                  
  15572       </xsl:when >
  15573                                 
  15574       <!-- <xsl: when test= "$the-valu esets/*/vo c:system[@ root=$this -codeSyste m]/voc:cod e[@value=$ this-code] /@displayN ame"> 
  15575                                          <xsl:val ue-of sele ct="$the-v aluesets/* /voc:syste m[@root=$t his-codeSy stem]/voc: code[@valu e=$this-co de]/@displ ayName"/> 
  15576                                          </xsl:wh en> -->
  15577                                 
  15578       <xsl:other wise>
  15579                                           
  15580        <xsl:value -of 
  15581         select="$t his-code" 
  15582        />
  15583                                  
  15584       </xsl:othe rwise>
  15585                        
  15586      </xsl:choo se>
  15587              
  15588     </xsl:temp late>
  15589             
  15590     <!-- show  classCode  -->
  15591             
  15592     <xsl:templ ate 
  15593      name="show -actClassC ode"
  15594     >
  15595                       
  15596      <xsl:param  
  15597       name="clsC ode" 
  15598      />
  15599                       
  15600      <xsl:choos e>
  15601                                 
  15602       <xsl:when 
  15603        test=" $cl sCode = 'A CT' "
  15604       >
  15605                                           
  15606        <xsl:text>
  15607         healthcare  service
  15608        </xsl:text >
  15609                                  
  15610       </xsl:when >
  15611                                 
  15612       <xsl:when 
  15613        test=" $cl sCode = 'A CCM' "
  15614       >
  15615                                           
  15616        <xsl:text>
  15617         accommodat ion
  15618        </xsl:text >
  15619                                  
  15620       </xsl:when >
  15621                                 
  15622       <xsl:when 
  15623        test=" $cl sCode = 'A CCT' "
  15624       >
  15625                                           
  15626        <xsl:text>
  15627         account
  15628        </xsl:text >
  15629                                  
  15630       </xsl:when >
  15631                                 
  15632       <xsl:when 
  15633        test=" $cl sCode = 'A CSN' "
  15634       >
  15635                                           
  15636        <xsl:text>
  15637         accession
  15638        </xsl:text >
  15639                                  
  15640       </xsl:when >
  15641                                 
  15642       <xsl:when 
  15643        test=" $cl sCode = 'A DJUD' "
  15644       >
  15645                                           
  15646        <xsl:text>
  15647         financial  adjudicati on
  15648        </xsl:text >
  15649                                  
  15650       </xsl:when >
  15651                                 
  15652       <xsl:when 
  15653        test=" $cl sCode = 'C ONS' "
  15654       >
  15655                                           
  15656        <xsl:text>
  15657         consent
  15658        </xsl:text >
  15659                                  
  15660       </xsl:when >
  15661                                 
  15662       <xsl:when 
  15663        test=" $cl sCode = 'C ONTREG' "
  15664       >
  15665                                           
  15666        <xsl:text>
  15667         container  registrati on
  15668        </xsl:text >
  15669                                  
  15670       </xsl:when >
  15671                                 
  15672       <xsl:when 
  15673        test=" $cl sCode = 'C TTEVENT' "
  15674       >
  15675                                           
  15676        <xsl:text>
  15677         clinical t rial timep oint event
  15678        </xsl:text >
  15679                                  
  15680       </xsl:when >
  15681                                 
  15682       <xsl:when 
  15683        test=" $cl sCode = 'D ISPACT' "
  15684       >
  15685                                           
  15686        <xsl:text>
  15687         disciplina ry action
  15688        </xsl:text >
  15689                                  
  15690       </xsl:when >
  15691                                 
  15692       <xsl:when 
  15693        test=" $cl sCode = 'E NC' "
  15694       >
  15695                                           
  15696        <xsl:text>
  15697         encounter
  15698        </xsl:text >
  15699                                  
  15700       </xsl:when >
  15701                                 
  15702       <xsl:when 
  15703        test=" $cl sCode = 'I NC' "
  15704       >
  15705                                           
  15706        <xsl:text>
  15707         incident
  15708        </xsl:text >
  15709                                  
  15710       </xsl:when >
  15711                                 
  15712       <xsl:when 
  15713        test=" $cl sCode = 'I NFRM' "
  15714       >
  15715                                           
  15716        <xsl:text>
  15717         inform
  15718        </xsl:text >
  15719                                  
  15720       </xsl:when >
  15721                                 
  15722       <xsl:when 
  15723        test=" $cl sCode = 'I NVE' "
  15724       >
  15725                                           
  15726        <xsl:text>
  15727         invoice el ement
  15728        </xsl:text >
  15729                                  
  15730       </xsl:when >
  15731                                 
  15732       <xsl:when 
  15733        test=" $cl sCode = 'L IST' "
  15734       >
  15735                                           
  15736        <xsl:text>
  15737         working li st
  15738        </xsl:text >
  15739                                  
  15740       </xsl:when >
  15741                                 
  15742       <xsl:when 
  15743        test=" $cl sCode = 'M PROT' "
  15744       >
  15745                                           
  15746        <xsl:text>
  15747         monitoring  program
  15748        </xsl:text >
  15749                                  
  15750       </xsl:when >
  15751                                 
  15752       <xsl:when 
  15753        test=" $cl sCode = 'P CPR' "
  15754       >
  15755                                           
  15756        <xsl:text>
  15757         care provi sion
  15758        </xsl:text >
  15759                                  
  15760       </xsl:when >
  15761                                 
  15762       <xsl:when 
  15763        test=" $cl sCode = 'P ROC' "
  15764       >
  15765                                           
  15766        <xsl:text>
  15767         procedure
  15768        </xsl:text >
  15769                                  
  15770       </xsl:when >
  15771                                 
  15772       <xsl:when 
  15773        test=" $cl sCode = 'R EG' "
  15774       >
  15775                                           
  15776        <xsl:text>
  15777         registrati on
  15778        </xsl:text >
  15779                                  
  15780       </xsl:when >
  15781                                 
  15782       <xsl:when 
  15783        test=" $cl sCode = 'R EV' "
  15784       >
  15785                                           
  15786        <xsl:text>
  15787         review
  15788        </xsl:text >
  15789                                  
  15790       </xsl:when >
  15791                                 
  15792       <xsl:when 
  15793        test=" $cl sCode = 'S BADM' "
  15794       >
  15795                                           
  15796        <xsl:text>
  15797         substance  administra tion
  15798        </xsl:text >
  15799                                  
  15800       </xsl:when >
  15801                                 
  15802       <xsl:when 
  15803        test=" $cl sCode = 'S PCTRT' "
  15804       >
  15805                                           
  15806        <xsl:text>
  15807         speciment  treatment
  15808        </xsl:text >
  15809                                  
  15810       </xsl:when >
  15811                                 
  15812       <xsl:when 
  15813        test=" $cl sCode = 'S UBST' "
  15814       >
  15815                                           
  15816        <xsl:text>
  15817         substituti on
  15818        </xsl:text >
  15819                                  
  15820       </xsl:when >
  15821                                 
  15822       <xsl:when 
  15823        test=" $cl sCode = 'T RNS' "
  15824       >
  15825                                           
  15826        <xsl:text>
  15827         transporta tion
  15828        </xsl:text >
  15829                                  
  15830       </xsl:when >
  15831                                 
  15832       <xsl:when 
  15833        test=" $cl sCode = 'V ERIF' "
  15834       >
  15835                                           
  15836        <xsl:text>
  15837         verificati on
  15838        </xsl:text >
  15839                                  
  15840       </xsl:when >
  15841                                 
  15842       <xsl:when 
  15843        test=" $cl sCode = 'X ACT' "
  15844       >
  15845                                           
  15846        <xsl:text>
  15847         financial  transactio n
  15848        </xsl:text >
  15849                                  
  15850       </xsl:when >
  15851                        
  15852      </xsl:choo se>
  15853              
  15854     </xsl:temp late>
  15855             
  15856     <!-- show  participat ionType -- >
  15857             
  15858     <xsl:templ ate 
  15859      name="show -participa tionType"
  15860     >
  15861                       
  15862      <xsl:param  
  15863       name="ptyp e" 
  15864      />
  15865                       
  15866      <xsl:choos e>
  15867                                 
  15868       <xsl:when 
  15869        test=" $pt ype='PPRF'  "
  15870       >
  15871                                           
  15872        <xsl:text>
  15873         primary pe rformer
  15874        </xsl:text >
  15875                                  
  15876       </xsl:when >
  15877                                 
  15878       <xsl:when 
  15879        test=" $pt ype='PRF'  "
  15880       >
  15881                                           
  15882        <xsl:text>
  15883         performer
  15884        </xsl:text >
  15885                                  
  15886       </xsl:when >
  15887                                 
  15888       <xsl:when 
  15889        test=" $pt ype='VRF'  "
  15890       >
  15891                                           
  15892        <xsl:text>
  15893         verifier
  15894        </xsl:text >
  15895                                  
  15896       </xsl:when >
  15897                                 
  15898       <xsl:when 
  15899        test=" $pt ype='SPRF'  "
  15900       >
  15901                                           
  15902        <xsl:text>
  15903         secondary  performer
  15904        </xsl:text >
  15905                                  
  15906       </xsl:when >
  15907                        
  15908      </xsl:choo se>
  15909              
  15910     </xsl:temp late>
  15911             
  15912     <!-- show  participat ionFunctio n -->
  15913             
  15914     <xsl:templ ate 
  15915      name="show -participa tionFuncti on"
  15916     >
  15917                       
  15918      <xsl:param  
  15919       name="pFun ction" 
  15920      />
  15921                       
  15922      <xsl:choos e>
  15923                                 
  15924       <!-- From  the HL7 v3  Participa tionFuncti on code sy stem -->
  15925                                 
  15926       <xsl:when 
  15927        test=" $pF unction =  'ADMPHYS'  "
  15928       >
  15929                                           
  15930        <xsl:text>
  15931         (admitting  physician )
  15932        </xsl:text >
  15933                                  
  15934       </xsl:when >
  15935                                 
  15936       <xsl:when 
  15937        test=" $pF unction =  'ANEST' "
  15938       >
  15939                                           
  15940        <xsl:text>
  15941         (anesthesi st)
  15942        </xsl:text >
  15943                                  
  15944       </xsl:when >
  15945                                 
  15946       <xsl:when 
  15947        test=" $pF unction =  'ANRS' "
  15948       >
  15949                                           
  15950        <xsl:text>
  15951         (anesthesi a nurse)
  15952        </xsl:text >
  15953                                  
  15954       </xsl:when >
  15955                                 
  15956       <xsl:when 
  15957        test=" $pF unction =  'ATTPHYS'  "
  15958       >
  15959                                           
  15960        <xsl:text>
  15961         (attending  physician )
  15962        </xsl:text >
  15963                                  
  15964       </xsl:when >
  15965                                 
  15966       <xsl:when 
  15967        test=" $pF unction =  'DISPHYS'  "
  15968       >
  15969                                           
  15970        <xsl:text>
  15971         (dischargi ng physici an)
  15972        </xsl:text >
  15973                                  
  15974       </xsl:when >
  15975                                 
  15976       <xsl:when 
  15977        test=" $pF unction =  'FASST' "
  15978       >
  15979                                           
  15980        <xsl:text>
  15981         (first ass istant sur geon)
  15982        </xsl:text >
  15983                                  
  15984       </xsl:when >
  15985                                 
  15986       <xsl:when 
  15987        test=" $pF unction =  'MDWF' "
  15988       >
  15989                                           
  15990        <xsl:text>
  15991         (midwife)
  15992        </xsl:text >
  15993                                  
  15994       </xsl:when >
  15995                                 
  15996       <xsl:when 
  15997        test=" $pF unction =  'NASST' "
  15998       >
  15999                                           
  16000        <xsl:text>
  16001         (nurse ass istant)
  16002        </xsl:text >
  16003                                  
  16004       </xsl:when >
  16005                                 
  16006       <xsl:when 
  16007        test=" $pF unction =  'PCP' "
  16008       >
  16009                                           
  16010        <xsl:text>
  16011         (primary c are physic ian)
  16012        </xsl:text >
  16013                                  
  16014       </xsl:when >
  16015                                 
  16016       <xsl:when 
  16017        test=" $pF unction =  'PRISURG'  "
  16018       >
  16019                                           
  16020        <xsl:text>
  16021         (primary s urgeon)
  16022        </xsl:text >
  16023                                  
  16024       </xsl:when >
  16025                                 
  16026       <xsl:when 
  16027        test=" $pF unction =  'RNDPHYS'  "
  16028       >
  16029                                           
  16030        <xsl:text>
  16031         (rounding  physician)
  16032        </xsl:text >
  16033                                  
  16034       </xsl:when >
  16035                                 
  16036       <xsl:when 
  16037        test=" $pF unction =  'SASST' "
  16038       >
  16039                                           
  16040        <xsl:text>
  16041         (second as sistant su rgeon)
  16042        </xsl:text >
  16043                                  
  16044       </xsl:when >
  16045                                 
  16046       <xsl:when 
  16047        test=" $pF unction =  'SNRS' "
  16048       >
  16049                                           
  16050        <xsl:text>
  16051         (scrub nur se)
  16052        </xsl:text >
  16053                                  
  16054       </xsl:when >
  16055                                 
  16056       <xsl:when 
  16057        test=" $pF unction =  'TASST' "
  16058       >
  16059                                           
  16060        <xsl:text>
  16061         (third ass istant)
  16062        </xsl:text >
  16063                                  
  16064       </xsl:when >
  16065                                 
  16066       <!-- From  the HL7 v2  Provider  Role code  system (2. 16.840.1.1 13883.12.4 43) 
  16067                                          which is  used by H ITSP -->
  16068                                 
  16069       <xsl:when 
  16070        test=" $pF unction =  'CP' "
  16071       >
  16072                                           
  16073        <xsl:text>
  16074         (consultin g provider )
  16075        </xsl:text >
  16076                                  
  16077       </xsl:when >
  16078                                 
  16079       <xsl:when 
  16080        test=" $pF unction =  'PP' "
  16081       >
  16082                                           
  16083        <xsl:text>
  16084         (primary c are provid er)
  16085        </xsl:text >
  16086                                  
  16087       </xsl:when >
  16088                                 
  16089       <xsl:when 
  16090        test=" $pF unction =  'RP' "
  16091       >
  16092                                           
  16093        <xsl:text>
  16094         (referring  provider)
  16095        </xsl:text >
  16096                                  
  16097       </xsl:when >
  16098                                 
  16099       <xsl:when 
  16100        test=" $pF unction =  'MP' "
  16101       >
  16102                                           
  16103        <xsl:text>
  16104         (medical h ome provid er)
  16105        </xsl:text >
  16106                                  
  16107       </xsl:when >
  16108                        
  16109      </xsl:choo se>
  16110              
  16111     </xsl:temp late>
  16112             
  16113     <xsl:templ ate 
  16114      name="form atDateTime "
  16115     >
  16116                       
  16117      <xsl:param  
  16118       name="date
  16119      />
  16120                       
  16121      <!-- month  -->
  16122                       
  16123      <xsl:varia ble 
  16124       name="mont h" 
  16125       select="su bstring ($ date, 5, 2 )" 
  16126      />
  16127                       
  16128      <xsl:choos e>
  16129                                 
  16130       <xsl:when 
  16131        test="$mon th='01'"
  16132       >
  16133                                           
  16134        <xsl:text>
  16135         January 
  16136        </xsl:text >
  16137                                  
  16138       </xsl:when >
  16139                                 
  16140       <xsl:when 
  16141        test="$mon th='02'"
  16142       >
  16143                                           
  16144        <xsl:text>
  16145         February 
  16146        </xsl:text >
  16147                                  
  16148       </xsl:when >
  16149                                 
  16150       <xsl:when 
  16151        test="$mon th='03'"
  16152       >
  16153                                           
  16154        <xsl:text>
  16155         March 
  16156        </xsl:text >
  16157                                  
  16158       </xsl:when >
  16159                                 
  16160       <xsl:when 
  16161        test="$mon th='04'"
  16162       >
  16163                                           
  16164        <xsl:text>
  16165         April 
  16166        </xsl:text >
  16167                                  
  16168       </xsl:when >
  16169                                 
  16170       <xsl:when 
  16171        test="$mon th='05'"
  16172       >
  16173                                           
  16174        <xsl:text>
  16175         May 
  16176        </xsl:text >
  16177                                  
  16178       </xsl:when >
  16179                                 
  16180       <xsl:when 
  16181        test="$mon th='06'"
  16182       >
  16183                                           
  16184        <xsl:text>
  16185         June 
  16186        </xsl:text >
  16187                                  
  16188       </xsl:when >
  16189                                 
  16190       <xsl:when 
  16191        test="$mon th='07'"
  16192       >
  16193                                           
  16194        <xsl:text>
  16195         July 
  16196        </xsl:text >
  16197                                  
  16198       </xsl:when >
  16199                                 
  16200       <xsl:when 
  16201        test="$mon th='08'"
  16202       >
  16203                                           
  16204        <xsl:text>
  16205         August 
  16206        </xsl:text >
  16207                                  
  16208       </xsl:when >
  16209                                 
  16210       <xsl:when 
  16211        test="$mon th='09'"
  16212       >
  16213                                           
  16214        <xsl:text>
  16215         September 
  16216        </xsl:text >
  16217                                  
  16218       </xsl:when >
  16219                                 
  16220       <xsl:when 
  16221        test="$mon th='10'"
  16222       >
  16223                                           
  16224        <xsl:text>
  16225         October 
  16226        </xsl:text >
  16227                                  
  16228       </xsl:when >
  16229                                 
  16230       <xsl:when 
  16231        test="$mon th='11'"
  16232       >
  16233                                           
  16234        <xsl:text>
  16235         November 
  16236        </xsl:text >
  16237                                  
  16238       </xsl:when >
  16239                                 
  16240       <xsl:when 
  16241        test="$mon th='12'"
  16242       >
  16243                                           
  16244        <xsl:text>
  16245         December 
  16246        </xsl:text >
  16247                                  
  16248       </xsl:when >
  16249                        
  16250      </xsl:choo se>
  16251                       
  16252      <!-- day - ->
  16253                       
  16254      <xsl:choos e>
  16255                                 
  16256       <xsl:when 
  16257        test='subs tring ($da te, 7, 1)= "0"'
  16258       >
  16259                                           
  16260        <xsl:value -of 
  16261         select="su bstring ($ date, 8, 1 )" 
  16262        />
  16263                                           
  16264        <xsl:text>
  16265        
  16266        </xsl:text >
  16267                                  
  16268       </xsl:when >
  16269                                 
  16270       <xsl:other wise>
  16271                                           
  16272        <xsl:value -of 
  16273         select="su bstring ($ date, 7, 2 )" 
  16274        />
  16275                                           
  16276        <xsl:text>
  16277        
  16278        </xsl:text >
  16279                                  
  16280       </xsl:othe rwise>
  16281                        
  16282      </xsl:choo se>
  16283                       
  16284      <!-- year  -->
  16285                       
  16286      <xsl:value -of 
  16287       select="su bstring ($ date, 1, 4 )" 
  16288      />
  16289                       
  16290      <!-- time  and US tim ezone -->
  16291                       
  16292      <xsl:if 
  16293       test="stri ng-length( $date) > 8 "
  16294      >
  16295                                 
  16296       <xsl:text>
  16297       
  16298       </xsl:text >
  16299                                 
  16300       <!-- time  -->
  16301                                 
  16302       <xsl:varia ble 
  16303        name="time "
  16304       >
  16305                                           
  16306        <xsl:value -of 
  16307         select="su bstring($d ate,9,6)" 
  16308        />
  16309                                  
  16310       </xsl:vari able>
  16311                                 
  16312       <xsl:varia ble 
  16313        name="hh"
  16314       >
  16315                                           
  16316        <xsl:value -of 
  16317         select="su bstring($t ime,1,2)" 
  16318        />
  16319                                  
  16320       </xsl:vari able>
  16321                                 
  16322       <xsl:varia ble 
  16323        name="mm"
  16324       >
  16325                                           
  16326        <xsl:value -of 
  16327         select="su bstring($t ime,3,2)" 
  16328        />
  16329                                  
  16330       </xsl:vari able>
  16331                                 
  16332       <xsl:varia ble 
  16333        name="ss"
  16334       >
  16335                                           
  16336        <xsl:value -of 
  16337         select="su bstring($t ime,5,2)" 
  16338        />
  16339                                  
  16340       </xsl:vari able>
  16341                                 
  16342       <xsl:if 
  16343        test="stri ng-length( $hh)&gt;1"
  16344       >
  16345                                           
  16346        <xsl:value -of 
  16347         select="$h h" 
  16348        />
  16349                                           
  16350        <xsl:if
  16351                                                   
  16352         test="stri ng-length( $mm)&gt;1  and not(co ntains($mm ,'-')) and  not (cont ains($mm,' +'))"
  16353        >
  16354                                                    
  16355         <xsl:text>
  16356          :
  16357         </xsl:text >
  16358                                                    
  16359         <xsl:value -of 
  16360          select="$m m" 
  16361         />
  16362                                                    
  16363         <xsl:if
  16364                                                             
  16365          test="stri ng-length( $ss)&gt;1  and not(co ntains($ss ,'-')) and  not (cont ains($ss,' +'))"
  16366         >
  16367                                                              
  16368          <xsl:text>
  16369           :
  16370          </xsl:text >
  16371                                                              
  16372          <xsl:value -of 
  16373           select="$s s" 
  16374          />
  16375                                                     
  16376         </xsl:if>
  16377                                            
  16378        </xsl:if>
  16379                                  
  16380       </xsl:if>
  16381                                 
  16382       <!-- time  zone -->
  16383                                 
  16384       <xsl:varia ble 
  16385        name="tzon "
  16386       >
  16387                                           
  16388        <xsl:choos e>
  16389                                                    
  16390         <xsl:when 
  16391          test="cont ains($date ,'+')"
  16392         >
  16393                                                              
  16394          <xsl:text>
  16395           +
  16396          </xsl:text >
  16397                                                              
  16398          <xsl:value -of 
  16399           select="su bstring-af ter($date,  '+')" 
  16400          />
  16401                                                     
  16402         </xsl:when >
  16403                                                    
  16404         <xsl:when 
  16405          test="cont ains($date ,'-')"
  16406         >
  16407                                                              
  16408          <xsl:text>
  16409           -
  16410          </xsl:text >
  16411                                                              
  16412          <xsl:value -of 
  16413           select="su bstring-af ter($date,  '-')" 
  16414          />
  16415                                                     
  16416         </xsl:when >
  16417                                            
  16418        </xsl:choo se>
  16419                                  
  16420       </xsl:vari able>
  16421                                 
  16422       <xsl:choos e>
  16423                                           
  16424        <!-- refer ence: http ://www.tim eanddate.c om/library /abbreviat ions/timez ones/na/ - ->
  16425                                           
  16426        <xsl:when 
  16427         test="$tzo n = '-0500 ' "
  16428        >
  16429                                                    
  16430         <xsl:text>
  16431          , EST
  16432         </xsl:text >
  16433                                            
  16434        </xsl:when >
  16435                                           
  16436        <xsl:when 
  16437         test="$tzo n = '-0600 ' "
  16438        >
  16439                                                    
  16440         <xsl:text>
  16441          , CST
  16442         </xsl:text >
  16443                                            
  16444        </xsl:when >
  16445                                           
  16446        <xsl:when 
  16447         test="$tzo n = '-0700 ' "
  16448        >
  16449                                                    
  16450         <xsl:text>
  16451          , MST
  16452         </xsl:text >
  16453                                            
  16454        </xsl:when >
  16455                                           
  16456        <xsl:when 
  16457         test="$tzo n = '-0800 ' "
  16458        >
  16459                                                    
  16460         <xsl:text>
  16461          , PST
  16462         </xsl:text >
  16463                                            
  16464        </xsl:when >
  16465                                           
  16466        <xsl:other wise>
  16467                                                    
  16468         <xsl:text>
  16469           
  16470         </xsl:text >
  16471                                                    
  16472         <xsl:value -of 
  16473          select="$t zon" 
  16474         />
  16475                                            
  16476        </xsl:othe rwise>
  16477                                  
  16478       </xsl:choo se>
  16479                        
  16480      </xsl:if>
  16481              
  16482     </xsl:temp late>
  16483             
  16484     <!-- conve rt to lowe r case -->
  16485             
  16486     <xsl:templ ate 
  16487      name="case Down"
  16488     >
  16489                       
  16490      <xsl:param  
  16491       name="data
  16492      />
  16493                       
  16494      <xsl:if 
  16495       test="$dat a"
  16496      >
  16497                                 
  16498       <xsl:value -of
  16499                                          
  16500        select="tr anslate($d ata, 'ABCD EFGHIJKLMN OPQRSTUVWX YZ','abcde fghijklmno pqrstuvwxy z')" 
  16501       />
  16502                        
  16503      </xsl:if>
  16504              
  16505     </xsl:temp late>
  16506             
  16507     <!-- conve rt to uppe r case -->
  16508             
  16509     <xsl:templ ate 
  16510      name="case Up"
  16511     >
  16512                       
  16513      <xsl:param  
  16514       name="data
  16515      />
  16516                       
  16517      <xsl:if 
  16518       test="$dat a"
  16519      >
  16520                                 
  16521       <xsl:value -of
  16522                                          
  16523        select="tr anslate($d ata,'abcde fghijklmno pqrstuvwxy z', 'ABCDE FGHIJKLMNO PQRSTUVWXY Z')" 
  16524       />
  16525                        
  16526      </xsl:if>
  16527              
  16528     </xsl:temp late>
  16529             
  16530     <!-- conve rt first c haracter t o upper ca se -->
  16531             
  16532     <xsl:templ ate 
  16533      name="firs tCharCaseU p"
  16534     >
  16535                       
  16536      <xsl:param  
  16537       name="data
  16538      />
  16539                       
  16540      <xsl:if 
  16541       test="$dat a"
  16542      >
  16543                                 
  16544       <xsl:call- template 
  16545        name="case Up"
  16546       >
  16547                                           
  16548        <xsl:with- param 
  16549         name="data
  16550         select="su bstring($d ata,1,1)" 
  16551        />
  16552                                  
  16553       </xsl:call -template>
  16554                                 
  16555       <xsl:value -of 
  16556        select="su bstring($d ata,2)" 
  16557       />
  16558                        
  16559      </xsl:if>
  16560              
  16561     </xsl:temp late>
  16562             
  16563     <!-- show- noneFlavor  -->
  16564             
  16565     <xsl:templ ate 
  16566      name="show -noneFlavo r"
  16567     >
  16568                       
  16569      <xsl:param  
  16570       name="nf" 
  16571      />
  16572                       
  16573      <xsl:choos e>
  16574                                 
  16575       <xsl:when 
  16576        test=" $nf  = 'NI' "
  16577       >
  16578                                           
  16579        <xsl:text>
  16580         no informa tion
  16581        </xsl:text >
  16582                                  
  16583       </xsl:when >
  16584                                 
  16585       <xsl:when 
  16586        test=" $nf  = 'INV' "
  16587       >
  16588                                           
  16589        <xsl:text>
  16590         invalid
  16591        </xsl:text >
  16592                                  
  16593       </xsl:when >
  16594                                 
  16595       <xsl:when 
  16596        test=" $nf  = 'MSK' "
  16597       >
  16598                                           
  16599        <xsl:text>
  16600         masked
  16601        </xsl:text >
  16602                                  
  16603       </xsl:when >
  16604                                 
  16605       <xsl:when 
  16606        test=" $nf  = 'NA' "
  16607       >
  16608                                           
  16609        <xsl:text>
  16610         not applic able
  16611        </xsl:text >
  16612                                  
  16613       </xsl:when >
  16614                                 
  16615       <xsl:when 
  16616        test=" $nf  = 'UNK' "
  16617       >
  16618                                           
  16619        <xsl:text>
  16620         unknown
  16621        </xsl:text >
  16622                                  
  16623       </xsl:when >
  16624                                 
  16625       <xsl:when 
  16626        test=" $nf  = 'OTH' "
  16627       >
  16628                                           
  16629        <xsl:text>
  16630         other
  16631        </xsl:text >
  16632                                  
  16633       </xsl:when >
  16634                        
  16635      </xsl:choo se>
  16636              
  16637     </xsl:temp late>
  16638    
  16639    
  16640             
  16641     <!-- Forma t first(gi ven) and l ast (famil y) names - ->
  16642             
  16643     <xsl:templ ate 
  16644      name="form atProvider Name"
  16645     >
  16646                       
  16647      <xsl:param  
  16648       name="row"  
  16649      />
  16650                       
  16651      <xsl:param  
  16652       name="firs t" 
  16653      />
  16654                       
  16655      <xsl:param  
  16656       name="last
  16657      />
  16658                       
  16659      <xsl:choos e>
  16660                                 
  16661       <xsl:when 
  16662        test="$fir st and $la st"
  16663       >
  16664                                           
  16665        <xsl:value -of 
  16666         select="$l ast" 
  16667        />
  16668                                           
  16669        <text>
  16670        
  16671        </text>
  16672                                           
  16673        <xsl:value -of 
  16674         select="$f irst" 
  16675        />
  16676                                  
  16677       </xsl:when >
  16678                                 
  16679       <xsl:other wise />
  16680                        
  16681      </xsl:choo se>
  16682              
  16683     </xsl:temp late>
  16684    
  16685             
  16686     <xsl:templ ate 
  16687      name="form atComments "
  16688     >
  16689                       
  16690      <xsl:param  
  16691       name="comm ents" 
  16692      />
  16693                       
  16694      <div>
  16695                                 
  16696       <table 
  16697        class="com ments"
  16698       >
  16699                                           
  16700        <tbody>
  16701                                                    
  16702         <tr>
  16703                                                              
  16704          <td>
  16705                                                                        
  16706           <img 
  16707            src="res/C 32_notice. jpg" 
  16708            alt="NOTE:
  16709           />
  16710                                                                        
  16711           <xsl:value -of 
  16712            select="$c omments" 
  16713           />
  16714                                                               
  16715          </td>
  16716                                                     
  16717         </tr>
  16718                                            
  16719        </tbody>
  16720                                  
  16721       </table>
  16722                                 
  16723       <br />
  16724                        
  16725      </div>
  16726              
  16727     </xsl:temp late>
  16728    
  16729             
  16730     <xsl:templ ate 
  16731      name="form atDate"
  16732     >
  16733                       
  16734      <xsl:param  
  16735       name="date
  16736      />
  16737                       
  16738      <xsl:if 
  16739       test="stri ng-length( $date)>0"
  16740      >
  16741                                 
  16742       <xsl:varia ble 
  16743        name="mont h" 
  16744        select="su bstring ($ date, 5, 2 )" 
  16745       />
  16746                                 
  16747       <xsl:choos e>
  16748                                           
  16749        <xsl:when 
  16750         test="$mon th='01'"
  16751        >
  16752                                                    
  16753         <xsl:text>
  16754          Jan 
  16755         </xsl:text >
  16756                                            
  16757        </xsl:when >
  16758                                           
  16759        <xsl:when 
  16760         test="$mon th='02'"
  16761        >
  16762                                                    
  16763         <xsl:text>
  16764          Feb 
  16765         </xsl:text >
  16766                                            
  16767        </xsl:when >
  16768                                           
  16769        <xsl:when 
  16770         test="$mon th='03'"
  16771        >
  16772                                                    
  16773         <xsl:text>
  16774          Mar 
  16775         </xsl:text >
  16776                                            
  16777        </xsl:when >
  16778                                           
  16779        <xsl:when 
  16780         test="$mon th='04'"
  16781        >
  16782                                                    
  16783         <xsl:text>
  16784          Apr 
  16785         </xsl:text >
  16786                                            
  16787        </xsl:when >
  16788                                           
  16789        <xsl:when 
  16790         test="$mon th='05'"
  16791        >
  16792                                                    
  16793         <xsl:text>
  16794          May 
  16795         </xsl:text >
  16796                                            
  16797        </xsl:when >
  16798                                           
  16799        <xsl:when 
  16800         test="$mon th='06'"
  16801        >
  16802                                                    
  16803         <xsl:text>
  16804          Jun 
  16805         </xsl:text >
  16806                                            
  16807        </xsl:when >
  16808                                           
  16809        <xsl:when 
  16810         test="$mon th='07'"
  16811        >
  16812                                                    
  16813         <xsl:text>
  16814          Jul 
  16815         </xsl:text >
  16816                                            
  16817        </xsl:when >
  16818                                           
  16819        <xsl:when 
  16820         test="$mon th='08'"
  16821        >
  16822                                                    
  16823         <xsl:text>
  16824          Aug 
  16825         </xsl:text >
  16826                                            
  16827        </xsl:when >
  16828                                           
  16829        <xsl:when 
  16830         test="$mon th='09'"
  16831        >
  16832                                                    
  16833         <xsl:text>
  16834          Sep 
  16835         </xsl:text >
  16836                                            
  16837        </xsl:when >
  16838                                           
  16839        <xsl:when 
  16840         test="$mon th='10'"
  16841        >
  16842                                                    
  16843         <xsl:text>
  16844          Oct 
  16845         </xsl:text >
  16846                                            
  16847        </xsl:when >
  16848                                           
  16849        <xsl:when 
  16850         test="$mon th='11'"
  16851        >
  16852                                                    
  16853         <xsl:text>
  16854          Nov 
  16855         </xsl:text >
  16856                                            
  16857        </xsl:when >
  16858                                           
  16859        <xsl:when 
  16860         test="$mon th='12'"
  16861        >
  16862                                                    
  16863         <xsl:text>
  16864          Dec 
  16865         </xsl:text >
  16866                                            
  16867        </xsl:when >
  16868                                  
  16869       </xsl:choo se>
  16870                                 
  16871       <xsl:choos e>
  16872                                           
  16873        <xsl:when 
  16874         test='subs tring ($da te, 7, 1)= "0"'
  16875        >
  16876                                                    
  16877         <xsl:value -of 
  16878          select="su bstring ($ date, 8, 1 )" 
  16879         />
  16880                                                    
  16881         <xsl:text>
  16882         
  16883         </xsl:text >
  16884                                            
  16885        </xsl:when >
  16886                                           
  16887        <xsl:other wise>
  16888                                                    
  16889         <xsl:value -of 
  16890          select="su bstring ($ date, 7, 2 )" 
  16891         />
  16892                                                    
  16893         <xsl:text>
  16894         
  16895         </xsl:text >
  16896                                            
  16897        </xsl:othe rwise>
  16898                                  
  16899       </xsl:choo se>
  16900                                 
  16901       <xsl:value -of 
  16902        select="su bstring ($ date, 3, 2 )" 
  16903       />
  16904                        
  16905      </xsl:if>
  16906              
  16907     </xsl:temp late>
  16908    
  16909             
  16910     <!-- Forma t Date out puts a dat e in Month  Day, Year  form e.g. , 19991207  ==> 
  16911                      Dece mber 07, 1 999 -->
  16912             
  16913     <xsl:templ ate 
  16914      name="form atDateFull "
  16915     >
  16916                       
  16917      <xsl:param  
  16918       name="date
  16919      />
  16920                       
  16921      <xsl:varia ble 
  16922       name="mont h" 
  16923       select="su bstring ($ date, 5, 2 )" 
  16924      />
  16925                       
  16926      <xsl:choos e>
  16927                                 
  16928       <xsl:when 
  16929        test="$mon th='01'"
  16930       >
  16931                                           
  16932        <xsl:text>
  16933         January 
  16934        </xsl:text >
  16935                                  
  16936       </xsl:when >
  16937                                 
  16938       <xsl:when 
  16939        test="$mon th='02'"
  16940       >
  16941                                           
  16942        <xsl:text>
  16943         February 
  16944        </xsl:text >
  16945                                  
  16946       </xsl:when >
  16947                                 
  16948       <xsl:when 
  16949        test="$mon th='03'"
  16950       >
  16951                                           
  16952        <xsl:text>
  16953         March 
  16954        </xsl:text >
  16955                                  
  16956       </xsl:when >
  16957                                 
  16958       <xsl:when 
  16959        test="$mon th='04'"
  16960       >
  16961                                           
  16962        <xsl:text>
  16963         April 
  16964        </xsl:text >
  16965                                  
  16966       </xsl:when >
  16967                                 
  16968       <xsl:when 
  16969        test="$mon th='05'"
  16970       >
  16971                                           
  16972        <xsl:text>
  16973         May 
  16974        </xsl:text >
  16975                                  
  16976       </xsl:when >
  16977                                 
  16978       <xsl:when 
  16979        test="$mon th='06'"
  16980       >
  16981                                           
  16982        <xsl:text>
  16983         June 
  16984        </xsl:text >
  16985                                  
  16986       </xsl:when >
  16987                                 
  16988       <xsl:when 
  16989        test="$mon th='07'"
  16990       >
  16991                                           
  16992        <xsl:text>
  16993         July 
  16994        </xsl:text >
  16995                                  
  16996       </xsl:when >
  16997                                 
  16998       <xsl:when 
  16999        test="$mon th='08'"
  17000       >
  17001                                           
  17002        <xsl:text>
  17003         August 
  17004        </xsl:text >
  17005                                  
  17006       </xsl:when >
  17007                                 
  17008       <xsl:when 
  17009        test="$mon th='09'"
  17010       >
  17011                                           
  17012        <xsl:text>
  17013         September 
  17014        </xsl:text >
  17015                                  
  17016       </xsl:when >
  17017                                 
  17018       <xsl:when 
  17019        test="$mon th='10'"
  17020       >
  17021                                           
  17022        <xsl:text>
  17023         October 
  17024        </xsl:text >
  17025                                  
  17026       </xsl:when >
  17027                                 
  17028       <xsl:when 
  17029        test="$mon th='11'"
  17030       >
  17031                                           
  17032        <xsl:text>
  17033         November 
  17034        </xsl:text >
  17035                                  
  17036       </xsl:when >
  17037                                 
  17038       <xsl:when 
  17039        test="$mon th='12'"
  17040       >
  17041                                           
  17042        <xsl:text>
  17043         December 
  17044        </xsl:text >
  17045                                  
  17046       </xsl:when >
  17047                        
  17048      </xsl:choo se>
  17049                       
  17050      <xsl:choos e>
  17051                                 
  17052       <xsl:when 
  17053        test='subs tring ($da te, 7, 1)= "0"'
  17054       >
  17055                                           
  17056        <xsl:value -of 
  17057         select="su bstring ($ date, 8, 1 )" 
  17058        />
  17059                                           
  17060        <xsl:text>
  17061        
  17062        </xsl:text >
  17063                                  
  17064       </xsl:when >
  17065                                 
  17066       <xsl:other wise>
  17067                                           
  17068        <xsl:value -of 
  17069         select="su bstring ($ date, 7, 2 )" 
  17070        />
  17071                                           
  17072        <xsl:text>
  17073        
  17074        </xsl:text >
  17075                                  
  17076       </xsl:othe rwise>
  17077                        
  17078      </xsl:choo se>
  17079                       
  17080      <xsl:value -of 
  17081       select="su bstring ($ date, 1, 4 )" 
  17082      />
  17083              
  17084     </xsl:temp late>
  17085   </xsl:styl esheet>