Index: /ccr2ccd-xslt/trunk/make/M1-ccr_qrda.xsl
===================================================================
--- /ccr2ccd-xslt/trunk/make/M1-ccr_qrda.xsl	(revision 998)
+++ /ccr2ccd-xslt/trunk/make/M1-ccr_qrda.xsl	(revision 999)
@@ -524,4 +524,117 @@
                   </section>
                 </component>
+                    <xsl:if test="a:ContinuityOfCareRecord/a:Body/a:Problems">
+                        <component>
+                            <section>
+                                <templateId root="2.16.840.1.113883.3.88.11.83.103" assigningAuthorityName="HITSP/C83"/>
+                                <templateId root="1.3.6.1.4.1.19376.1.5.3.1.3.6" assigningAuthorityName="IHE PCC"/>
+                                <templateId root="2.16.840.1.113883.10.20.1.11" assigningAuthorityName="HL7 CCD"/>
+                                <code code="11450-4" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC" displayName="Problem list"/>
+                                <title>Problems</title>
+                                <text>
+                                    <table>
+                                        <tbody>
+                                            <tr>
+                                                <th>Type</th>
+                                                <th>Date</th>
+                                                <th>Code</th>
+                                                <th>Description</th>
+                                                <th>Status</th>
+                                                <th>Source</th>
+                                            </tr>
+                                            <xsl:for-each select="/a:ContinuityOfCareRecord/a:Body/a:Problems/a:Problem">
+                                                <tr>
+                                                    <td>
+                                                        <xsl:value-of select="a:Type/a:Text"/>
+                                                    </td>
+                                                    <td>
+                                                        <table>
+                                                            <tbody>
+                                                                <xsl:apply-templates select="a:DateTime"/>
+                                                            </tbody>
+                                                        </table>
+                                                    </td>
+                                                    <td>
+                                                        <xsl:apply-templates select="a:Description/a:Code"/>
+                                                    </td>
+                                                    <td>
+														<xsl:attribute name="ID">
+															<xsl:value-of select="a:CCRDataObjectID"></xsl:value-of>
+														</xsl:attribute>
+                                                        <xsl:value-of select="a:Description/a:Text"/>
+                                                    </td>
+                                                    <td>
+                                                        <xsl:value-of select="a:Status/a:Text"/>
+                                                    </td>
+                                                    <td>
+                                                        <xsl:call-template name="actorName">
+                                                            <xsl:with-param name="objID" select="a:Source/a:Actor/a:ActorID"/>
+                                                        </xsl:call-template>
+                                                    </td>
+                                                </tr>
+                                            </xsl:for-each>
+                                        </tbody>
+                                    </table>
+                                </text>
+                                <xsl:for-each select="/a:ContinuityOfCareRecord/a:Body/a:Problems/a:Problem">
+                                    <entry typeCode="DRIV">
+                                        <act classCode="ACT" moodCode="EVN">
+                                            <templateId root="2.16.840.1.113883.10.20.1.27"/>
+                                            <!-- Problem act template -->
+
+                                            <!-- <id> -->
+                                            <xsl:call-template name="ccdID">
+                                                <xsl:with-param name="ccrObjectID" select="a:CCRDataObjectID"/>
+                                            </xsl:call-template>
+
+                                            <code nullFlavor="NA"/>
+
+                                            <xsl:call-template name="ccdPerformer">
+                                                <xsl:with-param name="ccrActorReference" select="a:Source/a:Actor"/>
+                                            </xsl:call-template>
+
+                                            <entryRelationship typeCode="SUBJ">
+                                                <observation classCode="OBS" moodCode="EVN">
+                                                    <templateId root="2.16.840.1.113883.10.20.1.28" assigningAuthorityName="CCD"/>
+                                                    <!--Problem observation template-->
+						    <templateId root="2.16.840.1.113883.3.249.11.100.8"/>	
+
+                                                    <!-- <id> -->
+                                                    <xsl:call-template name="ccdID">
+                                                        <xsl:with-param name="ccrObjectID" select="a:CCRDataObjectID"/>
+                                                        <xsl:with-param name="suffix"></xsl:with-param>
+                                                    </xsl:call-template>
+
+                                                    <code code="55607006" displayName="Problem" codeSystem="2.16.840.1.113883.6.96" codeSystemName="SNOMED-CT"/>
+                                                    <statusCode code="completed"/>
+                                                    <text>
+                                                        <reference>
+                                                            <xsl:attribute name="value">
+                                                                <xsl:text>#</xsl:text>
+                                                                <xsl:value-of select="a:CCRDataObjectID"/>
+                                                            </xsl:attribute>
+                                                        </reference>
+                                                    </text>
+
+                                                     <xsl:call-template name="ccdDateTime">
+                                                        <xsl:with-param name="dt" select="a:DateTime"/>
+                                                    </xsl:call-template>
+
+                                                    <xsl:call-template name="ccdCodedValue">
+                                                        <xsl:with-param name="ccrCodedDescription" select="a:Description"/>
+                                                    </xsl:call-template>
+
+                                                    <xsl:call-template name="ccdStatus">
+                                                        <xsl:with-param name="ccrStatus" select="a:Status"/>
+                                                    </xsl:call-template>
+                                                </observation>
+                                            </entryRelationship>
+
+                                        </act>
+                                    </entry>
+                                </xsl:for-each>
+                            </section>
+                        </component>
+                    </xsl:if>
                     <xsl:if test="a:ContinuityOfCareRecord/a:Body/a:Procedures">
                         <component>
Index: /ccr2ccd-xslt/trunk/make/M1-make-qrda-M1.sh
===================================================================
--- /ccr2ccd-xslt/trunk/make/M1-make-qrda-M1.sh	(revision 998)
+++ /ccr2ccd-xslt/trunk/make/M1-make-qrda-M1.sh	(revision 999)
@@ -3,5 +3,5 @@
 #cat ccd-purpose.xsl >> M1-ccr_qrda.xsl
 #cat ccd-alerts.xsl >> M1-ccr_qrda.xsl
-#cat ccd-problems.xsl >> M1-ccr_qrda.xsl
+cat ccd-problems.xsl >> M1-ccr_qrda.xsl
 cat ccd-procedures.xsl >> M1-ccr_qrda.xsl
 cat PayersSectionMedicareTemplate.xml >> M1-ccr_qrda.xsl
Index: /ccr2ccd-xslt/trunk/make/M1-qrda2-xalan.sh
===================================================================
--- /ccr2ccd-xslt/trunk/make/M1-qrda2-xalan.sh	(revision 999)
+++ /ccr2ccd-xslt/trunk/make/M1-qrda2-xalan.sh	(revision 999)
@@ -0,0 +1,13 @@
+#!/bin/bash
+#!/bin/bash
+xalan -in /home/vademo4-09/CCR/M1_100146_CCR_V1_0_0.xml -xsl M1-ccr_qrda.xsl -out /home/vademo4-09/QRDA/M1-PAT_100146_QRDA_V1_0_0.xml
+xalan -in /home/vademo4-09/CCR/M1_100676_CCR_V1_0_0.xml -xsl M1-ccr_qrda.xsl -out /home/vademo4-09/QRDA/M1-PAT_100676_QRDA_V1_0_0.xml
+xalan -in /home/vademo4-09/CCR/M1_100839_CCR_V1_0_0.xml -xsl M1-ccr_qrda.xsl -out /home/vademo4-09/QRDA/M1-PAT_100839_QRDA_V1_0_0.xml
+xalan -in /home/vademo4-09/CCR/M1_100846_CCR_V1_0_0.xml -xsl M1-ccr_qrda.xsl -out /home/vademo4-09/QRDA/M1-PAT_100846_QRDA_V1_0_0.xml
+xalan -in /home/vademo4-09/CCR/M1_100847_CCR_V1_0_0.xml -xsl M1-ccr_qrda.xsl -out /home/vademo4-09/QRDA/M1-PAT_100847_QRDA_V1_0_0.xml
+xalan -in /home/vademo4-09/CCR/M1_100848_CCR_V1_0_0.xml -xsl M1-ccr_qrda.xsl -out /home/vademo4-09/QRDA/M1-PAT_100848_QRDA_V1_0_0.xml
+xalan -in /home/vademo4-09/CCR/M1_100849_CCR_V1_0_0.xml -xsl M1-ccr_qrda.xsl -out /home/vademo4-09/QRDA/M1-PAT_100849_QRDA_V1_0_0.xml
+xalan -in /home/vademo4-09/CCR/M1_100850_CCR_V1_0_0.xml -xsl M1-ccr_qrda.xsl -out /home/vademo4-09/QRDA/M1-PAT_100850_QRDA_V1_0_0.xml
+xalan -in /home/vademo4-09/CCR/M1_100852_CCR_V1_0_0.xml -xsl M1-ccr_qrda.xsl -out /home/vademo4-09/QRDA/M1-PAT_100852_QRDA_V1_0_0.xml
+xalan -in /home/vademo4-09/CCR/M1_100855_CCR_V1_0_0.xml -xsl M1-ccr_qrda.xsl -out /home/vademo4-09/QRDA/M1-PAT_100855_QRDA_V1_0_0.xml
+xalan -in /home/vademo4-09/CCR/M1_100858_CCR_V1_0_0.xml -xsl M1-ccr_qrda.xsl -out /home/vademo4-09/QRDA/M1-PAT_100858_QRDA_V1_0_0.xml
Index: /ccr2ccd-xslt/trunk/make/M1-qrda2.sh
===================================================================
--- /ccr2ccd-xslt/trunk/make/M1-qrda2.sh	(revision 998)
+++ /ccr2ccd-xslt/trunk/make/M1-qrda2.sh	(revision 999)
@@ -1,13 +1,12 @@
 #!/bin/bash
-#!/bin/bash
-xalan -in /home/vademo4-09/CCR/M1_100146_CCR_V1_0_0.xml -xsl M1-ccr_qrda.xsl -out /home/vademo4-09/QRDA/M1-PAT_100146_QRDA_V1_0_0.xml
-xalan -in /home/vademo4-09/CCR/M1_100676_CCR_V1_0_0.xml -xsl M1-ccr_qrda.xsl -out /home/vademo4-09/QRDA/M1-PAT_100676_QRDA_V1_0_0.xml
-xalan -in /home/vademo4-09/CCR/M1_100839_CCR_V1_0_0.xml -xsl M1-ccr_qrda.xsl -out /home/vademo4-09/QRDA/M1-PAT_100839_QRDA_V1_0_0.xml
-xalan -in /home/vademo4-09/CCR/M1_100846_CCR_V1_0_0.xml -xsl M1-ccr_qrda.xsl -out /home/vademo4-09/QRDA/M1-PAT_100846_QRDA_V1_0_0.xml
-xalan -in /home/vademo4-09/CCR/M1_100847_CCR_V1_0_0.xml -xsl M1-ccr_qrda.xsl -out /home/vademo4-09/QRDA/M1-PAT_100847_QRDA_V1_0_0.xml
-xalan -in /home/vademo4-09/CCR/M1_100848_CCR_V1_0_0.xml -xsl M1-ccr_qrda.xsl -out /home/vademo4-09/QRDA/M1-PAT_100848_QRDA_V1_0_0.xml
-xalan -in /home/vademo4-09/CCR/M1_100849_CCR_V1_0_0.xml -xsl M1-ccr_qrda.xsl -out /home/vademo4-09/QRDA/M1-PAT_100849_QRDA_V1_0_0.xml
-xalan -in /home/vademo4-09/CCR/M1_100850_CCR_V1_0_0.xml -xsl M1-ccr_qrda.xsl -out /home/vademo4-09/QRDA/M1-PAT_100850_QRDA_V1_0_0.xml
-xalan -in /home/vademo4-09/CCR/M1_100852_CCR_V1_0_0.xml -xsl M1-ccr_qrda.xsl -out /home/vademo4-09/QRDA/M1-PAT_100852_QRDA_V1_0_0.xml
-xalan -in /home/vademo4-09/CCR/M1_100855_CCR_V1_0_0.xml -xsl M1-ccr_qrda.xsl -out /home/vademo4-09/QRDA/M1-PAT_100855_QRDA_V1_0_0.xml
-xalan -in /home/vademo4-09/CCR/M1_100858_CCR_V1_0_0.xml -xsl M1-ccr_qrda.xsl -out /home/vademo4-09/QRDA/M1-PAT_100858_QRDA_V1_0_0.xml
+java -jar /usr/share/java/saxon.jar -o /home/vademo4-09/QRDA/M1-PAT_100146_QRDA_V1_0_0.xml /home/vademo4-09/CCR/M1_100146_CCR_V1_0_0.xml M1-ccr_qrda.xsl
+java -jar /usr/share/java/saxon.jar -o /home/vademo4-09/QRDA/M1-PAT_100676_QRDA_V1_0_0.xml /home/vademo4-09/CCR/M1_100676_CCR_V1_0_0.xml M1-ccr_qrda.xsl
+java -jar /usr/share/java/saxon.jar -o /home/vademo4-09/QRDA/M1-PAT_100839_QRDA_V1_0_0.xml /home/vademo4-09/CCR/M1_100839_CCR_V1_0_0.xml M1-ccr_qrda.xsl
+java -jar /usr/share/java/saxon.jar -o /home/vademo4-09/QRDA/M1-PAT_100846_QRDA_V1_0_0.xml /home/vademo4-09/CCR/M1_100846_CCR_V1_0_0.xml M1-ccr_qrda.xsl
+java -jar /usr/share/java/saxon.jar -o /home/vademo4-09/QRDA/M1-PAT_100847_QRDA_V1_0_0.xml /home/vademo4-09/CCR/M1_100847_CCR_V1_0_0.xml M1-ccr_qrda.xsl
+java -jar /usr/share/java/saxon.jar -o /home/vademo4-09/QRDA/M1-PAT_100848_QRDA_V1_0_0.xml /home/vademo4-09/CCR/M1_100848_CCR_V1_0_0.xml M1-ccr_qrda.xsl
+java -jar /usr/share/java/saxon.jar -o /home/vademo4-09/QRDA/M1-PAT_100849_QRDA_V1_0_0.xml /home/vademo4-09/CCR/M1_100849_CCR_V1_0_0.xml M1-ccr_qrda.xsl
+java -jar /usr/share/java/saxon.jar -o /home/vademo4-09/QRDA/M1-PAT_100850_QRDA_V1_0_0.xml /home/vademo4-09/CCR/M1_100850_CCR_V1_0_0.xml M1-ccr_qrda.xsl
+java -jar /usr/share/java/saxon.jar -o /home/vademo4-09/QRDA/M1-PAT_100852_QRDA_V1_0_0.xml /home/vademo4-09/CCR/M1_100852_CCR_V1_0_0.xml M1-ccr_qrda.xsl
+java -jar /usr/share/java/saxon.jar -o /home/vademo4-09/QRDA/M1-PAT_100855_QRDA_V1_0_0.xml /home/vademo4-09/CCR/M1_100855_CCR_V1_0_0.xml M1-ccr_qrda.xsl
+java -jar /usr/share/java/saxon.jar -o /home/vademo4-09/QRDA/M1-PAT_100858_QRDA_V1_0_0.xml /home/vademo4-09/CCR/M1_100858_CCR_V1_0_0.xml M1-ccr_qrda.xsl
Index: /ccr2ccd-xslt/trunk/make/M1_100839_QRDA_V1_0_0Ver4.xml
===================================================================
--- /ccr2ccd-xslt/trunk/make/M1_100839_QRDA_V1_0_0Ver4.xml	(revision 999)
+++ /ccr2ccd-xslt/trunk/make/M1_100839_QRDA_V1_0_0Ver4.xml	(revision 999)
@@ -0,0 +1,494 @@
+<?xml version="1.0" encoding="utf-8"?>
+<ClinicalDocument xmlns="urn:hl7-org:v3" xmlns:voc="urn:hl7-org:v3/voc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:hl7-org:v3 CDA.xsd">
+   <realmCode code="US"/>
+   <typeId root="2.16.840.1.113883.1.3" extension="POCD_HD000040"/>
+   <templateId root="2.16.840.1.113883.10.20.12"/>
+   <templateId root="2.16.840.1.113883.3.249.11.100.1"/>
+   <id root="2.16.840.1.113883.3.543" extension="@@@UUID-DOC@@@"/>
+   <code code="55182-0" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC" displayName="Quality Measure Report"/>
+   <title>QRDA Incidence Report</title>
+   <effectiveTime value="20100703"/>
+   <confidentialityCode codeSystem="2.16.840.1.113883.5.25" code="N"/>
+   <languageCode code="en-US"/>
+   <setId root="2.16.840.1.113883.3.543" extension="@@@UUID-SET@@@"/>
+   <versionNumber value="1"/>
+   <recordTarget>
+      <patientRole>
+         <id extension="002030004" root="SSN"/>
+         <addr use="H">
+            <streetAddressLine/>
+            <city/>
+            <state/>
+            <postalCode/>
+         </addr>
+         <telecom/>
+         <patient>
+            <name>
+               <given>JODY</given>
+               <given>JEAN</given>
+               <family>JONES</family>
+            </name>
+            <administrativeGenderCode displayName="FEMALE" code="F" codeSystemName="HL7 AdministrativeGender" codeSystem=""/>
+            <birthTime value="19450101120000"/>
+         </patient>
+      </patientRole>
+   </recordTarget>
+   <author>
+      <time value="20100703"/>
+      <assignedAuthor>
+         <id root="2.16.840.1.113883.3.249.6" extension="100001"/>
+         <assignedPerson>
+            <name>
+               <given>Nancy</given>
+               <family>Anthracite</family>
+               <suffix>MD</suffix>
+            </name>
+         </assignedPerson>
+         <representedOrganization>
+            <id root="2.16.840.1.113883.3.543" extension="1558574526"/>
+            <name>WorldVistA Test Clinic</name>
+         </representedOrganization>
+      </assignedAuthor>
+   </author>
+   <informant>
+      <assignedEntity>
+         <id nullFlavor="NA"/>
+         <representedOrganization>
+            <id root="2.16.840.1.113883.3.543" extension="1558574526"/>
+            <name>World VistA Test Clinic</name>
+         </representedOrganization>
+      </assignedEntity>
+   </informant>
+   <custodian>
+      <assignedCustodian>
+         <representedCustodianOrganization>
+            <id root="2.16.840.1.113883.3.543" extension="1558574526"/>
+            <name>WorldVistA Test Clinic</name>
+         </representedCustodianOrganization>
+      </assignedCustodian>
+   </custodian>
+   <legalAuthenticator>
+      <time value="20100703"/>
+      <signatureCode code="S"/>
+      <assignedEntity>
+         <id root="2.16.840.1.113883.3.543" extension="111111"/>
+         <assignedPerson>
+            <name>
+               <given>Nancy</given>
+               <family>Anthracite</family>
+               <suffix>MD</suffix>
+            </name>
+         </assignedPerson>
+         <representedOrganization>
+            <id root="2.16.840.1.113883.3.543" extension="1558574526"/>
+            <name>WorldVistA Test Clinic</name>
+         </representedOrganization>
+      </assignedEntity>
+   </legalAuthenticator>
+   <participant typeCode="PRF">
+      <functionCode code="PCP" codeSystem="2.16.840.1.113883.5.88"/>
+      <associatedEntity classCode="PROV">
+         <id root="2.16.840.1.113883.3.249.6" extension="111111"/>
+         <associatedPerson>
+            <name>
+               <prefix>Dr.</prefix>
+               <given>Nancy</given>
+               <family>Anthracite</family>
+            </name>
+         </associatedPerson>
+      </associatedEntity>
+   </participant>
+   <component>
+      <structuredBody>
+         <component>
+            <section>
+               <templateId root="2.16.840.1.113883.3.249.11.50"/>
+               <code code="55185-3" codeSystem="2.16.840.1.113883.6.1"/>
+               <title>Measure set: CMS EHR Measure Set</title>
+               <text>2010 Measures Set Measures</text>
+               <component>
+                  <section>
+                     <templateId root="2.16.840.1.113883.3.249.11.2"/>
+                     <code code="55186-1" codeSystem="2.16.840.1.113883.6.1"/>
+                     <title>Measure Section</title>
+                     <text>
+                        <list>
+                           <item>CMS Measure #1: Diabetes Mellitus: Hemoglobin A1c Poor Control in Diabetes Mellitus</item>
+                        </list>
+                     </text>
+                     <entry typeCode="DRIV">
+                        <act classCode="ACT" moodCode="DEF">
+                           <id root="2.16.840.1.113883.3.249.11.2"/>
+                           <code code="PQRI-1" codeSystem="2.16.840.1.113883.3.249.12" displayName="Hemoglobin A1c Poor Control in Diabetes Mellitus"/>
+                           <text>Percentage of patients 18 through 75 years with diabetes mellitus who had most recent hemoglobin A1C greater than 9.0%</text>
+                           <statusCode code="completed"/>
+                        </act>
+                     </entry>
+                     <component>
+                        <section>
+                           <code code="55187-9" codeSystem="2.16.840.1.113883.6.1"/>
+                           <title>Reporting Parameters</title>
+                           <text>
+                              <list>
+                                 <item>Reporting Period Jan 1, 2010 to Dec 31, 2010</item>
+                              </list>
+                           </text>
+                           <entry>
+                              <act classCode="ACT" moodCode="EVN">
+                                 <code code="252116004" codeSystem="2.16.840.1.113883.6.96" displayName="Observation Parameters"/>
+                                 <effectiveTime>
+                                    <low value="20100101"/>
+                                    <high value="20101231"/>
+                                 </effectiveTime>
+                              </act>
+                           </entry>
+                        </section>
+                     </component>
+                     <component>
+                        <section>
+                           <code code="55188-7" codeSystem="2.16.840.1.113883.6.1"/>
+                           <title>Patient Data</title>
+                        </section>
+                     </component>
+                     <component>
+                        <section>
+                           <templateId root="2.16.840.1.113883.10.20.1.12"/>
+                           <code code="47519-4" codeSystem="2.16.840.1.113883.6.1"/>
+                           <title>Procedures</title>
+                           <text>
+                              <table>
+                                 <tbody>
+                                    <tr>
+                                       <th>Type</th>
+                                       <th>Date</th>
+                                       <th>Code</th>
+                                       <th>Description</th>
+                                       <th>Location</th>
+                                       <th>Substance</th>
+                                       <th>Method</th>
+                                       <th>Position</th>
+                                       <th>Site</th>
+                                       <th>Status</th>
+                                       <th>Source</th>
+                                    </tr>
+                                    <tr id="PROCEDURE_4056_27">
+                                       <td/>
+                                       <table>
+                                          <tbody>
+                                             <tr xmlns="">
+                                                <td>Procedure Date:
+          </td>
+                                                <td>Sep 04, 2010</td>
+                                             </tr>
+                                          </tbody>
+                                       </table>
+                                       <td>99213 (CPT-4)
+		</td>
+                                       <td>INTERMEDIATE (15min)</td>
+                                       <td/>
+                                       <td/>
+                                       <td/>
+                                       <td/>
+                                       <td/>
+                                       <td>Completed</td>
+                                       <td>SYSTEM  MANAGER   </td>
+                                    </tr>
+                                    <tr id="PROCEDURE_4055_24">
+                                       <td/>
+                                       <table>
+                                          <tbody>
+                                             <tr xmlns="">
+                                                <td>Procedure Date:
+          </td>
+                                                <td>Aug 28, 2010</td>
+                                             </tr>
+                                          </tbody>
+                                       </table>
+                                       <td>99202 (CPT-4)
+		</td>
+                                       <td>EXPANDED, HX &amp; EXAM</td>
+                                       <td/>
+                                       <td/>
+                                       <td/>
+                                       <td/>
+                                       <td/>
+                                       <td>Completed</td>
+                                       <td>SYSTEM  MANAGER   </td>
+                                    </tr>
+                                    <tr id="PROCEDURE_4047_14">
+                                       <td/>
+                                       <table>
+                                          <tbody>
+                                             <tr xmlns="">
+                                                <td>Procedure Date:
+          </td>
+                                                <td>Jul 31, 2010</td>
+                                             </tr>
+                                          </tbody>
+                                       </table>
+                                       <td>99213 (CPT-4)
+		</td>
+                                       <td>Office/Outpatient Visit of an Established Patient requiring (2 of 3) an Expanded History, an Exam and Medical Decision Making of Low Complexity (CPT-4 99213)</td>
+                                       <td/>
+                                       <td/>
+                                       <td/>
+                                       <td/>
+                                       <td/>
+                                       <td>Completed</td>
+                                       <td>SYSTEM  MANAGER   </td>
+                                    </tr>
+                                    <tr id="PROCEDURE_4046_7">
+                                       <td/>
+                                       <table>
+                                          <tbody>
+                                             <tr xmlns="">
+                                                <td>Procedure Date:
+          </td>
+                                                <td>Jul 05, 2010</td>
+                                             </tr>
+                                          </tbody>
+                                       </table>
+                                       <td>99214 (CPT-4)
+		</td>
+                                       <td>Office/Outpatient Visit of an Established Patient requiring (2 of 3) a Detailed History, an Exam and Medical Decision Making of Moderate Complexity (CPT-4 99214)</td>
+                                       <td/>
+                                       <td/>
+                                       <td/>
+                                       <td/>
+                                       <td/>
+                                       <td>Completed</td>
+                                       <td>EIGHT  PROVIDER  Scholar Extraordinaire </td>
+                                    </tr>
+                                    <tr id="PROCEDURE_4046_8">
+                                       <td/>
+                                       <table>
+                                          <tbody>
+                                             <tr xmlns="">
+                                                <td>Procedure Date:
+          </td>
+                                                <td>Jul 05, 2010</td>
+                                             </tr>
+                                          </tbody>
+                                       </table>
+                                       <td>83036 (CPT-4)
+		</td>
+                                       <td>Hemoglobin; Glycosylated (A1c) (CPT-4 83036)</td>
+                                       <td/>
+                                       <td/>
+                                       <td/>
+                                       <td/>
+                                       <td/>
+                                       <td>Completed</td>
+                                       <td>EIGHT  PROVIDER  Scholar Extraordinaire </td>
+                                    </tr>
+                                    <tr id="PROCEDURE_4046_9">
+                                       <td/>
+                                       <table>
+                                          <tbody>
+                                             <tr xmlns="">
+                                                <td>Procedure Date:
+          </td>
+                                                <td>Jul 05, 2010</td>
+                                             </tr>
+                                          </tbody>
+                                       </table>
+                                       <td>83704 (CPT-4)
+		</td>
+                                       <td>Lipoprotein, Blood; Quantitation of Lipoprotein particle Numbers and Lipoprotein particle Subclasses (Eg, by Nuclear Magnetic Resonance Spectroscopy) (CPT-4 83704)</td>
+                                       <td/>
+                                       <td/>
+                                       <td/>
+                                       <td/>
+                                       <td/>
+                                       <td>Completed</td>
+                                       <td>EIGHT  PROVIDER  Scholar Extraordinaire </td>
+                                    </tr>
+                                    <tr id="PROCEDURE_4046_10">
+                                       <td/>
+                                       <table>
+                                          <tbody>
+                                             <tr xmlns="">
+                                                <td>Procedure Date:
+          </td>
+                                                <td>Jul 05, 2010</td>
+                                             </tr>
+                                          </tbody>
+                                       </table>
+                                       <td>78414 (CPT-4)
+		</td>
+                                       <td>Determination of Central C-V Hemodynamics (Non-Imaging) (CPT-4 78414)</td>
+                                       <td/>
+                                       <td/>
+                                       <td/>
+                                       <td/>
+                                       <td/>
+                                       <td>Completed</td>
+                                       <td>EIGHT  PROVIDER  Scholar Extraordinaire </td>
+                                    </tr>
+                                 </tbody>
+                              </table>
+                           </text>
+                           <entry typeCode="DRIV">
+                              <procedure classCode="PROC" moodCode="EVN">
+                                 <templateId root="2.16.840.1.113883.3.88.11.83.17" assigningAuthorityName="HITSP C83"/>
+                                 <templateId root="2.16.840.1.113883.10.20.1.29" assigningAuthorityName="CCD"/>
+                                 <templateId root="1.3.6.1.4.1.19376.1.5.3.1.4.19" assigningAuthorityName="IHE PCC"/>
+                                 <id root="PROCEDURE_4056_27" extension="CCRObjectID"/>
+                                 <code displayName="INTERMEDIATE (15min)" code="99213" codeSystemName="CPT-4" codeSystem="2.16.840.1.113883.6.12"/>
+                                 <text>
+                                    <reference value="#PROCEDURE_4056_27"/>
+                                 </text>
+                                 <statusCode code="completed"/>
+                                 <effectiveTime>
+                                    <low value="20100904"/>
+                                    <high nullFlavor="UNK"/>
+                                 </effectiveTime>
+                              </procedure>
+                           </entry>
+                           <entry typeCode="DRIV">
+                              <procedure classCode="PROC" moodCode="EVN">
+                                 <templateId root="2.16.840.1.113883.3.88.11.83.17" assigningAuthorityName="HITSP C83"/>
+                                 <templateId root="2.16.840.1.113883.10.20.1.29" assigningAuthorityName="CCD"/>
+                                 <templateId root="1.3.6.1.4.1.19376.1.5.3.1.4.19" assigningAuthorityName="IHE PCC"/>
+                                 <id root="PROCEDURE_4055_24" extension="CCRObjectID"/>
+                                 <code displayName="EXPANDED, HX &amp; EXAM" code="99202" codeSystemName="CPT-4" codeSystem="2.16.840.1.113883.6.12"/>
+                                 <text>
+                                    <reference value="#PROCEDURE_4055_24"/>
+                                 </text>
+                                 <statusCode code="completed"/>
+                                 <effectiveTime>
+                                    <low value="20100828"/>
+                                    <high nullFlavor="UNK"/>
+                                 </effectiveTime>
+                              </procedure>
+                           </entry>
+                           <entry typeCode="DRIV">
+                              <procedure classCode="PROC" moodCode="EVN">
+                                 <templateId root="2.16.840.1.113883.3.88.11.83.17" assigningAuthorityName="HITSP C83"/>
+                                 <templateId root="2.16.840.1.113883.10.20.1.29" assigningAuthorityName="CCD"/>
+                                 <templateId root="1.3.6.1.4.1.19376.1.5.3.1.4.19" assigningAuthorityName="IHE PCC"/>
+                                 <id root="PROCEDURE_4047_14" extension="CCRObjectID"/>
+                                 <code displayName="Office/Outpatient Visit of an Established Patient requiring (2 of 3) an Expanded History, an Exam and Medical Decision Making of Low Complexity (CPT-4 99213)" code="99213" codeSystemName="CPT-4" codeSystem="2.16.840.1.113883.6.12"/>
+                                 <text>
+                                    <reference value="#PROCEDURE_4047_14"/>
+                                 </text>
+                                 <statusCode code="completed"/>
+                                 <effectiveTime>
+                                    <low value="20100731"/>
+                                    <high nullFlavor="UNK"/>
+                                 </effectiveTime>
+                              </procedure>
+                           </entry>
+                           <entry typeCode="DRIV">
+                              <procedure classCode="PROC" moodCode="EVN">
+                                 <templateId root="2.16.840.1.113883.3.88.11.83.17" assigningAuthorityName="HITSP C83"/>
+                                 <templateId root="2.16.840.1.113883.10.20.1.29" assigningAuthorityName="CCD"/>
+                                 <templateId root="1.3.6.1.4.1.19376.1.5.3.1.4.19" assigningAuthorityName="IHE PCC"/>
+                                 <id root="PROCEDURE_4046_7" extension="CCRObjectID"/>
+                                 <code displayName="Office/Outpatient Visit of an Established Patient requiring (2 of 3) a Detailed History, an Exam and Medical Decision Making of Moderate Complexity (CPT-4 99214)" code="99214" codeSystemName="CPT-4" codeSystem="2.16.840.1.113883.6.12"/>
+                                 <text>
+                                    <reference value="#PROCEDURE_4046_7"/>
+                                 </text>
+                                 <statusCode code="completed"/>
+                                 <effectiveTime>
+                                    <low value="20100705"/>
+                                    <high nullFlavor="UNK"/>
+                                 </effectiveTime>
+                              </procedure>
+                           </entry>
+                           <entry typeCode="DRIV">
+                              <procedure classCode="PROC" moodCode="EVN">
+                                 <templateId root="2.16.840.1.113883.3.88.11.83.17" assigningAuthorityName="HITSP C83"/>
+                                 <templateId root="2.16.840.1.113883.10.20.1.29" assigningAuthorityName="CCD"/>
+                                 <templateId root="1.3.6.1.4.1.19376.1.5.3.1.4.19" assigningAuthorityName="IHE PCC"/>
+                                 <id root="PROCEDURE_4046_8" extension="CCRObjectID"/>
+                                 <code displayName="Hemoglobin; Glycosylated (A1c) (CPT-4 83036)" code="83036" codeSystemName="CPT-4" codeSystem="2.16.840.1.113883.6.12"/>
+                                 <text>
+                                    <reference value="#PROCEDURE_4046_8"/>
+                                 </text>
+                                 <statusCode code="completed"/>
+                                 <effectiveTime>
+                                    <low value="20100705"/>
+                                    <high nullFlavor="UNK"/>
+                                 </effectiveTime>
+                              </procedure>
+                           </entry>
+                           <entry typeCode="DRIV">
+                              <procedure classCode="PROC" moodCode="EVN">
+                                 <templateId root="2.16.840.1.113883.3.88.11.83.17" assigningAuthorityName="HITSP C83"/>
+                                 <templateId root="2.16.840.1.113883.10.20.1.29" assigningAuthorityName="CCD"/>
+                                 <templateId root="1.3.6.1.4.1.19376.1.5.3.1.4.19" assigningAuthorityName="IHE PCC"/>
+                                 <id root="PROCEDURE_4046_9" extension="CCRObjectID"/>
+                                 <code displayName="Lipoprotein, Blood; Quantitation of Lipoprotein particle Numbers and Lipoprotein particle Subclasses (Eg, by Nuclear Magnetic Resonance Spectroscopy) (CPT-4 83704)" code="83704" codeSystemName="CPT-4" codeSystem="2.16.840.1.113883.6.12"/>
+                                 <text>
+                                    <reference value="#PROCEDURE_4046_9"/>
+                                 </text>
+                                 <statusCode code="completed"/>
+                                 <effectiveTime>
+                                    <low value="20100705"/>
+                                    <high nullFlavor="UNK"/>
+                                 </effectiveTime>
+                              </procedure>
+                           </entry>
+                           <entry typeCode="DRIV">
+                              <procedure classCode="PROC" moodCode="EVN">
+                                 <templateId root="2.16.840.1.113883.3.88.11.83.17" assigningAuthorityName="HITSP C83"/>
+                                 <templateId root="2.16.840.1.113883.10.20.1.29" assigningAuthorityName="CCD"/>
+                                 <templateId root="1.3.6.1.4.1.19376.1.5.3.1.4.19" assigningAuthorityName="IHE PCC"/>
+                                 <id root="PROCEDURE_4046_10" extension="CCRObjectID"/>
+                                 <code displayName="Determination of Central C-V Hemodynamics (Non-Imaging) (CPT-4 78414)" code="78414" codeSystemName="CPT-4" codeSystem="2.16.840.1.113883.6.12"/>
+                                 <text>
+                                    <reference value="#PROCEDURE_4046_10"/>
+                                 </text>
+                                 <statusCode code="completed"/>
+                                 <effectiveTime>
+                                    <low value="20100705"/>
+                                    <high nullFlavor="UNK"/>
+                                 </effectiveTime>
+                              </procedure>
+                           </entry>
+                        </section>
+                     </component>
+                     <component>
+                        <section>
+                           <templateId root="2.16.840.1.113883.10.20.1.9"/>
+                           <code code="48768-6" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC" displayName="Payment Sources"/>
+                           <title>Payers</title>
+                           <text/>
+                           <entry typeCode="DRIV">
+                              <act classCode="ACT" moodCode="DEF">
+                                 <templateId root="2.16.840.1.113883.10.20.1.20"/>
+                                 <id root="2.16.840.1.113883.3.543" extension="@@@UUID-PAYER@@@"/>
+                                 <code code="48768-6" codeSystem="2.16.840.1.113883.6.1" displayName="Payment sources"/>
+                                 <statusCode code="completed"/>
+                                 <entryRelationship typeCode="COMP">
+                                    <act classCode="ACT" moodCode="EVN">
+                                       <templateId root="2.16.840.1.113883.10.20.1.26"/>
+                                       <templateId root="2.16.840.1.113883.3.249.11.100.7"/>
+                                       <id root="dbbb6311-8a4d-11df-a4ee-0800200c9c66"/>
+                                       <code code="PUBLICPOL" codeSystem="2.16.840.1.113883.5.4" displayName="Public Healthcare"/>
+                                       <statusCode code="completed"/>
+                                       <performer typeCode="PRF">
+                                          <assignedEntity>
+                                             <id root="2.16.840.1.113883.12.86" extension="MC"/>
+                                          </assignedEntity>
+                                       </performer>
+                                       <participant typeCode="COV">
+                                          <participantRole>
+                                             <id root="2.16.840.1.113883.4.1" extension="@@SSN@@"/>
+                                             <code code="SELF" codeSystem="2.16.840.1.113883.5.111" displayName="Self"/>
+                                          </participantRole>
+                                       </participant>
+                                    </act>
+                                 </entryRelationship>
+                              </act>
+                           </entry>
+                        </section>
+                     </component>
+                  </section>
+               </component>
+            </section>
+         </component>
+      </structuredBody>
+   </component>
+</ClinicalDocument>
Index: /ccr2ccd-xslt/trunk/make/Nancy-ccd-payers.xslBU
===================================================================
--- /ccr2ccd-xslt/trunk/make/Nancy-ccd-payers.xslBU	(revision 999)
+++ /ccr2ccd-xslt/trunk/make/Nancy-ccd-payers.xslBU	(revision 999)
@@ -0,0 +1,104 @@
+                    <xsl:if test="a:ContinuityOfCareRecord/a:Body/a:Payers">
+                        <component>
+                            <section>
+                                <templateId root="2.16.840.1.113883.10.20.1.9"/>
+                                <code code="48768-6" codeSystem="2.16.840.1.113883.6.1"/>
+                                <title>Insurance</title>
+                                <text>
+                                    <table>
+                                        <tbody>
+                                            <tr>
+                                                <th>Type</th>
+                                                <th>Date</th>
+                                                <th>Identification Numbers</th>
+                                                <th>Payment Provider</th>
+                                                <th>Subscriber</th>
+                                                <th>Source</th>
+                                            </tr>
+                                            <xsl:for-each select="/a:ContinuityOfCareRecord/a:Body/a:Payers/a:Payer">
+                                                <tr>
+                                                    <td>
+                                                        <xsl:value-of select="a:Type/a:Text"/>
+                                                    </td>
+                                                    <td>
+                                                        <xsl:call-template name="date:format-date">
+                                                            <xsl:with-param name="date-time" select="a:DateTime/a:ExactDateTime"/>
+                                                        </xsl:call-template>
+                                                    </td>
+                                                    <td>
+                                                        <xsl:for-each select="a:IDs">
+                                                            <xsl:value-of select="a:Type/a:Text"/>:<xsl:text xml:space="preserve"> </xsl:text><xsl:value-of select="a:ID"/><br/>
+                                                        </xsl:for-each>
+                                                    </td>
+                                                    <td>
+                                                        <xsl:call-template name="actorName">
+                                                            <xsl:with-param name="objID" select="a:PaymentProvider/a:ActorID"/>
+                                                        </xsl:call-template>
+                                                    </td>
+                                                    <td>
+                                                        <xsl:call-template name="actorName">
+                                                            <xsl:with-param name="objID" select="a:Subscriber/a:ActorID"/>
+                                                        </xsl:call-template>
+                                                    </td>
+                                                    <td>
+                                                        <xsl:call-template name="actorName">
+                                                            <xsl:with-param name="objID" select="a:Source/a:Actor/a:ActorID"/>
+                                                        </xsl:call-template>
+                                                    </td>
+                                                </tr>
+                                            </xsl:for-each>
+                                        </tbody>
+                                    </table>
+                                </text>
+                                <xsl:for-each select="/a:ContinuityOfCareRecord/a:Body/a:Payers/a:Payer">
+                                    <entry typeCode="DRIV">
+                                        <act classCode="ACT" moodCode="DEF">
+                                            <templateId root="1.3.6.1.4.1.19376.1.5.3.1.4.17" assigningAuthorityName="IHE PCC"/>
+                                            <templateId root="2.16.840.1.113883.10.20.1.20" assigningAuthorityName="CCD"/>
+                                            <!-- Coverage entry template -->
+                                            <!-- <id> -->
+                                            <xsl:call-template name="ccdID">
+                                                <xsl:with-param name="ccrObjectID" select="a:CCRDataObjectID"/>
+                                            </xsl:call-template>
+                                            <code code="48768-6" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC" displayName="Payment sources"/>
+                                            <statusCode code="completed"/>
+                                            <entryRelationship typeCode="COMP">
+                                                <act classCode="ACT" moodCode="EVN">
+                                                    <templateId root="2.16.840.1.113883.3.88.11.83.5" assigningAuthorityName="HITSP C83"/>
+                                                    <templateId root="2.16.840.1.113883.10.20.1.26" assigningAuthorityName="CCD"/>
+                                                    <templateId root="1.3.6.1.4.1.19376.1.5.3.1.4.18" assigningAuthorityName="IHE PCC"/>
+                                                    <!--Insurance provider template -->
+                                                    <id>
+                                                        <xsl:attribute name="root">
+                                                            <xsl:value-of select="a:IDs[1]/a:ID"/>
+                                                        </xsl:attribute>
+                                                        <xsl:attribute name="extension">
+                                                            <xsl:value-of select="a:IDs[1]/a:Type/a:Text"/>
+                                                        </xsl:attribute>
+                                                    </id>
+
+                                                    <!-- <code> -->
+                                                    <xsl:call-template name="ccdCodedValue">
+                                                        <xsl:with-param name="ccrCodedDescription" select="a:Description"/>
+                                                        <xsl:with-param name="nodeName" select="'code'"/>
+                                                    </xsl:call-template>
+
+                                                    <statusCode code="completed"/>
+
+                                                    <xsl:call-template name="ccdPerformer">
+                                                        <xsl:with-param name="ccrActorReference" select="a:PaymentProvider"/>
+                                                    </xsl:call-template>
+
+                                                    <participant typeCode="HLD">
+                                                        <xsl:call-template name="ccdParticipantRoleActor">
+                                                            <xsl:with-param name="ccrActorReference" select="a:Subscriber"/>
+                                                        </xsl:call-template>
+                                                    </participant>
+                                                </act>
+                                            </entryRelationship>
+                                        </act>
+                                    </entry>
+                                </xsl:for-each>
+                            </section>
+                        </component>
+                    </xsl:if>
Index: /ccr2ccd-xslt/trunk/make/ccd-problems.xsl
===================================================================
--- /ccr2ccd-xslt/trunk/make/ccd-problems.xsl	(revision 998)
+++ /ccr2ccd-xslt/trunk/make/ccd-problems.xsl	(revision 999)
@@ -73,4 +73,5 @@
                                                     <templateId root="2.16.840.1.113883.10.20.1.28" assigningAuthorityName="CCD"/>
                                                     <!--Problem observation template-->
+						    <templateId root="2.16.840.1.113883.3.249.11.100.8"/>	
 
                                                     <!-- <id> -->
@@ -80,7 +81,8 @@
                                                     </xsl:call-template>
 
-                                                    <code code="55607006" displayName="Problem" codeSystem="2.16.840.1.113883.6.96" codeSystemName="SNOMED-CT"/>
+                                                    <code xsi:type="CE"code="55607006" displayName="Problem" codeSystem="2.16.840.1.113883.6.96" 
+codeSystemName="SNOMED-CT"/>
                                                     <statusCode code="completed"/>
-                                                    <text>
+                                                  < !-- <text>
                                                         <reference>
                                                             <xsl:attribute name="value">
@@ -89,5 +91,5 @@
                                                             </xsl:attribute>
                                                         </reference>
-                                                    </text>
+                                                    </text>-->
 
                                                      <xsl:call-template name="ccdDateTime">
Index: /ccr2ccd-xslt/trunk/make/ccd-problems.xslBU
===================================================================
--- /ccr2ccd-xslt/trunk/make/ccd-problems.xslBU	(revision 999)
+++ /ccr2ccd-xslt/trunk/make/ccd-problems.xslBU	(revision 999)
@@ -0,0 +1,114 @@
+                    <xsl:if test="a:ContinuityOfCareRecord/a:Body/a:Problems">
+                        <component>
+                            <section>
+                                <templateId root="2.16.840.1.113883.3.88.11.83.103" assigningAuthorityName="HITSP/C83"/>
+                                <templateId root="1.3.6.1.4.1.19376.1.5.3.1.3.6" assigningAuthorityName="IHE PCC"/>
+                                <templateId root="2.16.840.1.113883.10.20.1.11" assigningAuthorityName="HL7 CCD"/>
+                                <code code="11450-4" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC" displayName="Problem list"/>
+                                <title>Problems</title>
+                                <text>
+                                    <table>
+                                        <tbody>
+                                            <tr>
+                                                <th>Type</th>
+                                                <th>Date</th>
+                                                <th>Code</th>
+                                                <th>Description</th>
+                                                <th>Status</th>
+                                                <th>Source</th>
+                                            </tr>
+                                            <xsl:for-each select="/a:ContinuityOfCareRecord/a:Body/a:Problems/a:Problem">
+                                                <tr>
+                                                    <td>
+                                                        <xsl:value-of select="a:Type/a:Text"/>
+                                                    </td>
+                                                    <td>
+                                                        <table>
+                                                            <tbody>
+                                                                <xsl:apply-templates select="a:DateTime"/>
+                                                            </tbody>
+                                                        </table>
+                                                    </td>
+                                                    <td>
+                                                        <xsl:apply-templates select="a:Description/a:Code"/>
+                                                    </td>
+                                                    <td>
+														<xsl:attribute name="ID">
+															<xsl:value-of select="a:CCRDataObjectID"></xsl:value-of>
+														</xsl:attribute>
+                                                        <xsl:value-of select="a:Description/a:Text"/>
+                                                    </td>
+                                                    <td>
+                                                        <xsl:value-of select="a:Status/a:Text"/>
+                                                    </td>
+                                                    <td>
+                                                        <xsl:call-template name="actorName">
+                                                            <xsl:with-param name="objID" select="a:Source/a:Actor/a:ActorID"/>
+                                                        </xsl:call-template>
+                                                    </td>
+                                                </tr>
+                                            </xsl:for-each>
+                                        </tbody>
+                                    </table>
+                                </text>
+                                <xsl:for-each select="/a:ContinuityOfCareRecord/a:Body/a:Problems/a:Problem">
+                                    <entry typeCode="DRIV">
+                                        <act classCode="ACT" moodCode="EVN">
+                                            <templateId root="2.16.840.1.113883.10.20.1.27"/>
+                                            <!-- Problem act template -->
+
+                                            <!-- <id> -->
+                                            <xsl:call-template name="ccdID">
+                                                <xsl:with-param name="ccrObjectID" select="a:CCRDataObjectID"/>
+                                            </xsl:call-template>
+
+                                            <code nullFlavor="NA"/>
+
+                                            <xsl:call-template name="ccdPerformer">
+                                                <xsl:with-param name="ccrActorReference" select="a:Source/a:Actor"/>
+                                            </xsl:call-template>
+
+                                            <entryRelationship typeCode="SUBJ">
+                                                <observation classCode="OBS" moodCode="EVN">
+                                                    <templateId root="2.16.840.1.113883.10.20.1.28" assigningAuthorityName="CCD"/>
+                                                    <!--Problem observation template-->
+
+                                                    <!-- <id> -->
+                                                    <xsl:call-template name="ccdID">
+                                                        <xsl:with-param name="ccrObjectID" select="a:CCRDataObjectID"/>
+                                                        <xsl:with-param name="suffix"></xsl:with-param>
+                                                    </xsl:call-template>
+
+                                                    <code code="55607006" displayName="Problem" codeSystem="2.16.840.1.113883.6.96" codeSystemName="SNOMED-CT"/>
+
+                                                    <text>
+                                                        <reference>
+                                                            <xsl:attribute name="value">
+                                                                <xsl:text>#</xsl:text>
+                                                                <xsl:value-of select="a:CCRDataObjectID"/>
+                                                            </xsl:attribute>
+                                                        </reference>
+                                                    </text>
+
+                                                    <statusCode code="completed"/>
+
+                                                    <xsl:call-template name="ccdDateTime">
+                                                        <xsl:with-param name="dt" select="a:DateTime"/>
+                                                    </xsl:call-template>
+
+                                                    <xsl:call-template name="ccdCodedValue">
+                                                        <xsl:with-param name="ccrCodedDescription" select="a:Description"/>
+                                                    </xsl:call-template>
+
+                                                    <xsl:call-template name="ccdStatus">
+                                                        <xsl:with-param name="ccrStatus" select="a:Status"/>
+                                                    </xsl:call-template>
+                                                </observation>
+                                            </entryRelationship>
+
+                                        </act>
+                                    </entry>
+                                </xsl:for-each>
+                            </section>
+                        </component>
+                    </xsl:if>
Index: /ccr2ccd-xslt/trunk/make/cda.xsl
===================================================================
--- /ccr2ccd-xslt/trunk/make/cda.xsl	(revision 999)
+++ /ccr2ccd-xslt/trunk/make/cda.xsl	(revision 999)
@@ -0,0 +1,2011 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:n1="urn:hl7-org:v3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+	<xsl:output method="html" indent="yes" version="4.01" encoding="ISO-8859-1" doctype-system="http://www.w3.org/TR/html4/strict.dtd" doctype-public="-//W3C//DTD HTML 4.01//EN"/>
+	<!-- global variable title -->
+	<xsl:variable name="title">
+		<xsl:choose>
+			<xsl:when test="string-length(/n1:ClinicalDocument/n1:title)  &gt;= 1">
+				<xsl:value-of select="/n1:ClinicalDocument/n1:title"/>
+			</xsl:when>
+			<xsl:when test="/n1:ClinicalDocument/n1:code/@displayName">
+				<xsl:value-of select="/n1:ClinicalDocument/n1:code/@displayName"/>
+			</xsl:when>
+			<xsl:otherwise>
+				<xsl:text>Clinical Document</xsl:text>
+			</xsl:otherwise>
+		</xsl:choose>
+	</xsl:variable>
+	<!-- Main -->
+	<xsl:template match="/">
+		<xsl:apply-templates select="n1:ClinicalDocument"/>
+	</xsl:template>
+	<!-- produce browser rendered, human readable clinical document	-->
+	<xsl:template match="n1:ClinicalDocument">
+		<html>
+			<xsl:comment>
+					Do not edit this HTML directly, it was generated by an XSLT transformation from a source CDA document. 
+					The stylesheet which produced this display of the CDA document was most recently updated by Jingdong Li, AALLC, on November 13, 2008. 
+					The current version and documentation are always available at www.alschulerassociates.com/cda/?topic=cda-tools. We welcome feedback to jdli@alschulerassociates.com
+					The stylesheet is the cumulative work of several developers; the most significant prior milestones were the foundation work from HL7 Finland
+(Tyylitiedosto) and HL7 US (Calvin Beebe), and the presentation approach from [[the Swiss]].
+			</xsl:comment>
+			<head>
+				<xsl:comment> Do NOT edit this HTML directly: it was generated via an XSLT transformation from a CDA Release 2 XML document. </xsl:comment>
+				<title>
+					<xsl:value-of select="$title"/>
+				</title>
+				<!-- <link rel="stylesheet" type="text/css" href="cda.css"/> -->
+				<style type="text/css">
+					<xsl:text>
+body {
+	color: #003366;
+	background-color: #FFFFFF;
+	font-family: Verdana, Tahoma, sans-serif;
+	font-size: 11px;
+}
+
+a {
+	color: #003366;
+	background-color: #FFFFFF;
+}
+
+h1 {
+	font-size: 12pt;
+	font-weight: bold;
+}
+
+h2 {
+	font-size: 11pt;
+	font-weight: bold;
+}
+
+h3 {
+	font-size: 10pt;
+	font-weight: bold;
+}
+
+h4 {
+	font-size: 8pt;
+	font-weight: bold;
+}
+
+div {
+	width: 80%;
+}
+
+table {
+	line-height: 10pt;
+	width: 80%;
+}
+
+tr {
+	background-color: #ccccff;
+}
+
+td {
+	padding: 0.1cm 0.2cm;
+	vertical-align: top;
+}
+
+.h1center {
+	font-size: 12pt;
+	font-weight: bold;
+	text-align: center;
+	width: 80%;
+}
+
+.header_table{
+	border: 1pt inset #00008b;
+}
+
+.narr_table {
+	width: 100%;
+}
+
+.narr_tr {
+	background-color: #ffffcc;
+}
+
+.narr_th {
+	background-color: #ffd700;
+}
+
+.td_label{
+	font-weight: bold;
+	color: white;
+}
+					</xsl:text>
+				</style>
+			</head>
+			<body>
+				<h1 class="h1center">
+					<xsl:value-of select="$title"/>
+				</h1>
+				<!-- START display top portion of clinical document -->
+				<xsl:call-template name="recordTarget"/>
+				<xsl:call-template name="documentGeneral"/>
+				<xsl:call-template name="documentationOf"/>
+				<xsl:call-template name="author"/>
+				<!-- END display top portion of clinical document -->
+				<!-- produce table of contents -->
+				<xsl:call-template name="make-tableofcontents"/>
+				<hr align="left" color="teal" size="2" width="80%"/>
+				<!-- produce human readable document content -->
+				<xsl:apply-templates select="n1:component/n1:structuredBody|n1:component/n1:nonXMLBody"/>
+				<br/>
+				<hr align="left" color="teal" size="2" width="80%"/>
+				<br/>
+				<!-- START display bottom portion of clinical document -->
+				<xsl:call-template name="componentof"/>
+				<xsl:call-template name="custodian"/>
+				<xsl:call-template name="participant"/>
+				<xsl:call-template name="dataEnterer"/>
+				<xsl:call-template name="authenticator"/>
+				<xsl:call-template name="informant"/>
+				<xsl:call-template name="informationRecipient"/>
+				<xsl:call-template name="legalAuthenticator"/>
+				<!-- END display bottom portion of clinical document -->
+			</body>
+		</html>
+	</xsl:template>
+	<!-- generate table of contents -->
+	<xsl:template name="make-tableofcontents">
+		<h2>
+			<a name="toc">Table of Contents</a>
+		</h2>
+		<ul>
+			<xsl:for-each select="n1:component/n1:structuredBody/n1:component/n1:section/n1:title">
+				<li>
+					<a href="#{generate-id(.)}">
+						<xsl:value-of select="."/>
+					</a>
+				</li>
+			</xsl:for-each>
+		</ul>
+	</xsl:template>
+	<!-- header elements -->
+	<xsl:template name="documentGeneral">
+		<table class="header_table">
+			<tbody>
+				<tr>
+					<td width="20%" bgcolor="#3399ff">
+						<span class="td_label">
+							<xsl:text>Document Id</xsl:text>
+						</span>
+					</td>
+					<td width="80%">
+						<xsl:call-template name="show-id">
+							<xsl:with-param name="id" select="n1:id"/>
+						</xsl:call-template>
+					</td>
+				</tr>
+				<tr>
+					<td width="20%" bgcolor="#3399ff">
+						<span class="td_label">
+							<xsl:text>Document Created:</xsl:text>
+						</span>
+					</td>
+					<td width="80%">
+						<xsl:call-template name="show-time">
+							<xsl:with-param name="datetime" select="n1:effectiveTime"/>
+						</xsl:call-template>
+					</td>
+				</tr>
+			</tbody>
+		</table>
+	</xsl:template>
+	<!-- confidentiality -->
+	<xsl:template name="confidentiality">
+		<table class="header_table">
+			<tbody>
+				<td width="20%" bgcolor="#3399ff">
+					<xsl:text>Confidentiality</xsl:text>
+				</td>
+				<td width="80%">
+					<xsl:choose>
+						<xsl:when test="n1:confidentialityCode/@code  = &apos;N&apos;">
+							<xsl:text>Normal</xsl:text>
+						</xsl:when>
+						<xsl:when test="n1:confidentialityCode/@code  = &apos;R&apos;">
+							<xsl:text>Restricted</xsl:text>
+						</xsl:when>
+						<xsl:when test="n1:confidentialityCode/@code  = &apos;V&apos;">
+							<xsl:text>Very restricted</xsl:text>
+						</xsl:when>
+					</xsl:choose>
+					<xsl:if test="n1:confidentialityCode/n1:originalText">
+						<xsl:text> </xsl:text>
+						<xsl:value-of select="n1:confidentialityCode/n1:originalText"/>
+					</xsl:if>
+				</td>
+			</tbody>
+		</table>
+	</xsl:template>
+	<!-- author -->
+	<xsl:template name="author">
+		<table class="header_table">
+			<tbody>
+				<xsl:for-each select="n1:author/n1:assignedAuthor">
+					<tr>
+						<td width="20%" bgcolor="#3399ff">
+							<span class="td_label">
+								<xsl:text>Author</xsl:text>
+							</span>
+						</td>
+						<td width="80%">
+							<xsl:choose>
+								<xsl:when test="n1:assignedPerson/n1:name">
+									<xsl:call-template name="show-name">
+										<xsl:with-param name="name" select="n1:assignedPerson/n1:name"/>
+									</xsl:call-template>
+									<xsl:if test="n1:representedOrganization">
+										<xsl:text>, </xsl:text>
+										<xsl:call-template name="show-name">
+											<xsl:with-param name="name" select="n1:representedOrganization/n1:name"/>
+										</xsl:call-template>
+									</xsl:if>
+								</xsl:when>
+								<xsl:when test="n1:assignedAuthoringDevice/n1:softwareName">
+									<xsl:value-of select="n1:assignedAuthoringDevice/n1:softwareName"/>
+								</xsl:when>
+								<xsl:when test="n1:representedOrganization">
+									<xsl:call-template name="show-name">
+											<xsl:with-param name="name" select="n1:representedOrganization/n1:name"/>
+									</xsl:call-template>
+								</xsl:when>
+								<xsl:otherwise>
+									<xsl:for-each select="n1:id">
+										<xsl:call-template name="show-id"/>
+										<br/>
+									</xsl:for-each>
+								</xsl:otherwise>
+							</xsl:choose>
+						</td>
+					</tr>
+					<xsl:if test="n1:addr | n1:telecom">
+						<tr>
+							<td bgcolor="#3399ff">
+								<span class="td_label">
+									<xsl:text>Contact info</xsl:text>
+								</span>
+							</td>
+							<td>
+								<xsl:call-template name="show-contactInfo">
+									<xsl:with-param name="contact" select="."/>
+								</xsl:call-template>
+							</td>
+						</tr>
+					</xsl:if>
+				</xsl:for-each>
+			</tbody>
+		</table>
+	</xsl:template>
+	<!-- 	authenticator -->
+	<xsl:template name="authenticator">
+		<xsl:if test="n1:authenticator">
+			<table class="header_table">
+				<tbody>
+					<tr>
+						<xsl:for-each select="n1:authenticator">
+							<tr>
+								<td width="20%" bgcolor="#3399ff">
+									<span class="td_label">
+										<xsl:text>Signed </xsl:text>
+									</span>
+								</td>
+								<td width="80%">
+									<xsl:call-template name="show-name">
+										<xsl:with-param name="name" select="n1:assignedEntity/n1:assignedPerson/n1:name"/>
+									</xsl:call-template>
+									<xsl:text> at </xsl:text>
+									<xsl:call-template name="show-time">
+										<xsl:with-param name="date" select="n1:time"/>
+									</xsl:call-template>
+								</td>
+							</tr>
+							<xsl:if test="n1:assignedEntity/n1:addr | n1:assignedEntity/n1:telecom">
+								<tr>
+									<td bgcolor="#3399ff">
+										<span class="td_label">
+											<xsl:text>Contact info</xsl:text>
+										</span>
+									</td>
+									<td width="80%">
+										<xsl:call-template name="show-contactInfo">
+											<xsl:with-param name="contact" select="n1:assignedEntity"/>
+										</xsl:call-template>
+									</td>
+								</tr>
+							</xsl:if>
+						</xsl:for-each>
+					</tr>
+				</tbody>
+			</table>
+		</xsl:if>
+	</xsl:template>
+	<!-- legalAuthenticator -->
+	<xsl:template name="legalAuthenticator">
+		<xsl:if test="n1:legalAuthenticator">
+			<table class="header_table">
+				<tbody>
+					<tr>
+						<td width="20%" bgcolor="#3399ff">
+							<span class="td_label">
+								<xsl:text>Legal authenticator</xsl:text>
+							</span>
+						</td>
+						<td width="80%">
+							<xsl:call-template name="show-assignedEntity">
+								<xsl:with-param name="asgnEntity" select="n1:legalAuthenticator/n1:assignedEntity"/>
+							</xsl:call-template>
+							<xsl:text> </xsl:text>
+							<xsl:call-template name="show-sig">
+								<xsl:with-param name="sig" select="n1:legalAuthenticator/n1:signatureCode"/>
+							</xsl:call-template>
+							<xsl:if test="n1:legalAuthenticator/n1:time/@value">
+								<xsl:text> at </xsl:text>
+								<xsl:call-template name="show-time">
+									<xsl:with-param name="datetime" select="n1:legalAuthenticator/n1:time"/>
+								</xsl:call-template>
+							</xsl:if>
+						</td>
+					</tr>
+					<xsl:if test="n1:legalAuthenticator/n1:assignedEntity/n1:addr | n1:legalAuthenticator/n1:assignedEntity/n1:telecom">
+						<tr>
+							<td bgcolor="#3399ff">
+								<span class="td_label">
+									<xsl:text>Contact info</xsl:text>
+								</span>
+							</td>
+							<td>
+								<xsl:call-template name="show-contactInfo">
+									<xsl:with-param name="contact" select="n1:legalAuthenticator/n1:assignedEntity"/>
+								</xsl:call-template>
+							</td>
+						</tr>
+					</xsl:if>
+				</tbody>
+			</table>
+		</xsl:if>
+	</xsl:template>
+	<!-- dataEnterer -->
+	<xsl:template name="dataEnterer">
+		<xsl:if test="n1:dataEnterer">
+			<table class="header_table">
+				<tbody>
+					<tr>
+						<td width="20%" bgcolor="#3399ff">
+							<span class="td_label">
+								<xsl:text>Entered by</xsl:text>
+							</span>
+						</td>
+						<td width="80%">
+							<xsl:call-template name="show-assignedEntity">
+								<xsl:with-param name="asgnEntity" select="n1:dataEnterer/n1:assignedEntity"/>
+							</xsl:call-template>
+						</td>
+					</tr>
+					<xsl:if test="n1:dataEnterer/n1:assignedEntity/n1:addr | n1:dataEnterer/n1:assignedEntity/n1:telecom">
+						<tr>
+							<td bgcolor="#3399ff">
+								<span class="td_label">
+									<xsl:text>Contact info</xsl:text>
+								</span>
+							</td>
+							<td>
+								<xsl:call-template name="show-contactInfo">
+									<xsl:with-param name="contact" select="n1:dataEnterer/n1:assignedEntity"/>
+								</xsl:call-template>
+							</td>
+						</tr>
+					</xsl:if>
+				</tbody>
+			</table>
+		</xsl:if>
+	</xsl:template>
+	<!-- componentOf -->
+	<xsl:template name="componentof">
+		<xsl:if test="n1:componentOf">
+			<table class="header_table">
+				<tbody>
+					<xsl:for-each select="n1:componentOf/n1:encompassingEncounter">
+						<xsl:if test="n1:location/n1:healthCareFacility">
+							<tr>
+								<td width="20%" bgcolor="#3399ff">
+									<span class="td_label">
+										<xsl:text>Encounter Location</xsl:text>
+									</span>
+								</td>
+								<td width="80%">
+									<xsl:choose>
+										<xsl:when test="n1:location/n1:healthCareFacility/n1:location/n1:name">
+											<xsl:call-template name="show-name">
+												<xsl:with-param name="name" select="n1:location/n1:healthCareFacility/n1:location/n1:name"/>
+											</xsl:call-template>
+											<xsl:for-each select="n1:location/n1:healthCareFacility/n1:serviceProviderOrganization/n1:name">
+												<xsl:text> of </xsl:text>
+												<xsl:call-template name="show-name">
+													<xsl:with-param name="name" select="n1:location/n1:healthCareFacility/n1:serviceProviderOrganization/n1:name"/>
+												</xsl:call-template>
+											</xsl:for-each>
+										</xsl:when>
+										<xsl:when test="n1:location/n1:healthCareFacility/n1:code">
+											<xsl:call-template name="show-code">
+												<xsl:with-param name="code" select="n1:location/n1:healthCareFacility/n1:code"/>
+											</xsl:call-template>
+										</xsl:when>
+										<xsl:otherwise>
+											<xsl:if test="n1:location/n1:healthCareFacility/n1:id">
+												<xsl:text>id: </xsl:text>
+												<xsl:for-each select="n1:location/n1:healthCareFacility/n1:id">
+													<xsl:call-template name="show-id">
+														<xsl:with-param name="id" select="."/>
+													</xsl:call-template>
+												</xsl:for-each>
+											</xsl:if>
+										</xsl:otherwise>
+									</xsl:choose>
+								</td>
+							</tr>
+						</xsl:if>
+						<xsl:if test="n1:responsibleParty">
+							<tr>
+								<td bgcolor="#3399ff">
+									<span class="td_label">
+										<xsl:text>Responsible party</xsl:text>
+									</span>
+								</td>
+								<td width="80%">
+									<xsl:call-template name="show-assignedEntity">
+										<xsl:with-param name="asgnEntity" select="n1:responsibleParty/n1:assignedEntity"/>
+									</xsl:call-template>
+								</td>
+							</tr>
+						</xsl:if>
+						<xsl:if test="n1:responsibleParty/n1:assignedEntity/n1:addr | n1:responsibleParty/n1:assignedEntity/n1:telecom">
+							<tr>
+								<td bgcolor="#3399ff">
+									<span class="td_label">
+										<xsl:text>Contact info</xsl:text>
+									</span>
+								</td>
+								<td>
+									<xsl:call-template name="show-contactInfo">
+										<xsl:with-param name="contact" select="n1:responsibleParty/n1:assignedEntity"/>
+									</xsl:call-template>
+								</td>
+							</tr>
+						</xsl:if>
+					</xsl:for-each>
+				</tbody>
+			</table>
+		</xsl:if>
+	</xsl:template>
+	<!-- custodian -->
+	<xsl:template name="custodian">
+		<table class="header_table">
+			<tbody>
+				<tr>
+					<td width="20%" bgcolor="#3399ff">
+						<span class="td_label">
+							<xsl:text>Document maintained by</xsl:text>
+						</span>
+					</td>
+					<td width="80%">
+						<xsl:choose>
+							<xsl:when test="n1:custodian/n1:assignedCustodian/n1:representedCustodianOrganization/n1:name">
+								<xsl:call-template name="show-name">
+									<xsl:with-param name="name" select="n1:custodian/n1:assignedCustodian/n1:representedCustodianOrganization/n1:name"/>
+								</xsl:call-template>
+							</xsl:when>
+							<xsl:otherwise>
+								<xsl:for-each select="n1:custodian/n1:assignedCustodian/n1:representedCustodianOrganization/n1:id">
+									<xsl:call-template name="show-id"/>
+									<xsl:if test="position()!=last()">
+										<br/>
+									</xsl:if>
+								</xsl:for-each>
+							</xsl:otherwise>
+						</xsl:choose>
+					</td>
+				</tr>
+				<xsl:if test="n1:custodian/n1:assignedCustodian/n1:representedCustodianOrganization/n1:addr | 						n1:custodian/n1:assignedCustodian/n1:representedCustodianOrganization/n1:telecom">
+					<tr>
+						<td bgcolor="#3399ff">
+							<span class="td_label">
+								<xsl:text>Contact info</xsl:text>
+							</span>
+						</td>
+						<td width="80%">
+							<xsl:call-template name="show-contactInfo">
+								<xsl:with-param name="contact" select="n1:custodian/n1:assignedCustodian/n1:representedCustodianOrganization"/>
+							</xsl:call-template>
+						</td>
+					</tr>
+				</xsl:if>
+			</tbody>
+		</table>
+	</xsl:template>
+	<!-- documentationOf -->
+	<xsl:template name="documentationOf">
+		<xsl:if test="n1:documentationOf">
+			<table class="header_table">
+				<tbody>
+					<xsl:for-each select="n1:documentationOf">
+						<xsl:if test="n1:serviceEvent/@classCode and n1:serviceEvent/n1:code">
+							<xsl:variable name="displayName">
+								<xsl:call-template name="show-actClassCode">
+									<xsl:with-param name="clsCode" select="n1:serviceEvent/@classCode"/>
+								</xsl:call-template>
+							</xsl:variable>
+							<xsl:if test="$displayName">
+								<tr>
+									<td width="20%" bgcolor="#3399ff">
+										<span class="td_label">
+											<xsl:call-template name="firstCharCaseUp">
+												<xsl:with-param name="data" select="$displayName"/>
+											</xsl:call-template>
+										</span>
+									</td>
+									<td width="80%" colspan="3">
+										<xsl:call-template name="show-code">
+											<xsl:with-param name="code" select="n1:serviceEvent/n1:code"/>
+										</xsl:call-template>
+										<xsl:if test="n1:serviceEvent/n1:effectiveTime">
+											<xsl:choose>
+												<xsl:when test="n1:serviceEvent/n1:effectiveTime/@value">
+													<xsl:text>&#160;at&#160;</xsl:text>
+													<xsl:call-template name="show-time">
+														<xsl:with-param name="datetime" select="n1:serviceEvent/n1:effectiveTime"/>
+													</xsl:call-template>
+												</xsl:when>
+												<xsl:when test="n1:serviceEvent/n1:effectiveTime/n1:low">
+													<xsl:text>&#160;from&#160;</xsl:text>
+													<xsl:call-template name="show-time">
+														<xsl:with-param name="datetime" select="n1:serviceEvent/n1:effectiveTime/n1:low"/>
+													</xsl:call-template>
+													<xsl:if test="n1:serviceEvent/n1:effectiveTime/n1:high">
+														<xsl:text> to </xsl:text>
+														<xsl:call-template name="show-time">
+															<xsl:with-param name="datetime" select="n1:serviceEvent/n1:effectiveTime/n1:high"/>
+														</xsl:call-template>
+													</xsl:if>
+												</xsl:when>
+											</xsl:choose>
+										</xsl:if>
+									</td>
+								</tr>
+							</xsl:if>
+						</xsl:if>
+						<xsl:for-each select="n1:serviceEvent/n1:performer">
+							<xsl:variable name="displayName">
+								<xsl:call-template name="show-participationType">
+									<xsl:with-param name="ptype" select="@typeCode"/>
+								</xsl:call-template>
+								<xsl:text> </xsl:text>
+								<xsl:if test="n1:functionCode/@code">
+									<xsl:text>(</xsl:text>
+									<xsl:call-template name="show-participationFunction">
+										<xsl:with-param name="pFunction" select="n1:functionCode/@code"/>
+									</xsl:call-template>
+									<xsl:text>)</xsl:text>
+								</xsl:if>
+							</xsl:variable>
+							<tr>
+								<td width="20%" bgcolor="#3399ff">
+									<span class="td_label">
+										<xsl:call-template name="firstCharCaseUp">
+											<xsl:with-param name="data" select="$displayName"/>
+										</xsl:call-template>
+									</span>
+								</td>
+								<td width="80%" colspan="3">
+									<xsl:call-template name="show-assignedEntity">
+										<xsl:with-param name="asgnEntity" select="n1:assignedEntity"/>
+									</xsl:call-template>
+								</td>
+							</tr>
+						</xsl:for-each>
+					</xsl:for-each>
+				</tbody>
+			</table>
+		</xsl:if>
+	</xsl:template>
+	<!-- inFulfillmentOf -->
+	<xsl:template name="inFulfillmentOf">
+		<xsl:if test="n1:infulfillmentOf">
+			<table class="header_table">
+				<tbody>
+					<xsl:for-each select="n1:inFulfillmentOf">
+						<tr>
+							<td width="20%" bgcolor="#3399ff">
+								<span class="td_label">
+									<xsl:text>In fulfillment of</xsl:text>
+								</span>
+							</td>
+							<td width="80%">
+								<xsl:for-each select="n1:order">
+									<xsl:for-each select="n1:id">
+										<xsl:call-template name="show-id"/>
+									</xsl:for-each>
+									<xsl:for-each select="n1:code">
+										<xsl:text>&#160;</xsl:text>
+										<xsl:call-template name="show-code">
+											<xsl:with-param name="code" select="."/>
+										</xsl:call-template>
+									</xsl:for-each>
+									<xsl:for-each select="n1:priorityCode">
+										<xsl:text>&#160;</xsl:text>
+										<xsl:call-template name="show-code">
+											<xsl:with-param name="code" select="."/>
+										</xsl:call-template>
+									</xsl:for-each>
+								</xsl:for-each>
+							</td>
+						</tr>
+					</xsl:for-each>
+				</tbody>
+			</table>
+		</xsl:if>
+	</xsl:template>
+	<!-- informant -->
+	<xsl:template name="informant">
+		<xsl:if test="n1:informant">
+			<table class="header_table">
+				<tbody>
+					<xsl:for-each select="n1:informant">
+						<tr>
+							<td width="20%" bgcolor="#3399ff">
+								<span class="td_label">
+									<xsl:text>Informant</xsl:text>
+								</span>
+							</td>
+							<td width="80%">
+								<xsl:if test="n1:assignedEntity">
+									<xsl:call-template name="show-assignedEntity">
+								      <xsl:with-param name="asgnEntity" select="n1:assignedEntity"/>
+									</xsl:call-template>
+								</xsl:if>
+								<xsl:if test="n1:relatedEntity">
+									<xsl:call-template name="show-relatedEntity">
+								      <xsl:with-param name="relatedEntity" select="n1:relatedEntity"/>
+									</xsl:call-template>
+								</xsl:if>
+							</td>
+						</tr>
+						<xsl:choose>
+							<xsl:when test="n1:assignedEntity/n1:addr | n1:assignedEntity/n1:telecom">
+							<tr>
+								<td bgcolor="#3399ff">
+									<span class="td_label">
+										<xsl:text>Contact info</xsl:text>
+									</span>
+								</td>
+								<td>
+									<xsl:if test="n1:assignedEntity">
+										<xsl:call-template name="show-contactInfo">
+										<xsl:with-param name="contact" select="n1:assignedEntity"/>
+									</xsl:call-template>
+									</xsl:if>
+								</td>
+							</tr>
+							</xsl:when>
+							<xsl:when test="n1:relatedEntity/n1:addr | n1:relatedEntity/n1:telecom">
+							<tr>
+								<td bgcolor="#3399ff">
+									<span class="td_label">
+										<xsl:text>Contact info</xsl:text>
+									</span>
+								</td>
+								<td>
+									<xsl:if test="n1:relatedEntity">
+										<xsl:call-template name="show-contactInfo">
+										<xsl:with-param name="contact" select="n1:relatedEntity"/>
+									</xsl:call-template>
+									</xsl:if>
+								</td>
+							</tr>
+							</xsl:when>
+						</xsl:choose>
+					</xsl:for-each>
+				</tbody>
+			</table>
+		</xsl:if>
+	</xsl:template>
+	<!-- informantionRecipient -->
+	<xsl:template name="informationRecipient">
+		<xsl:if test="n1:informationRecipient">
+			<table class="header_table">
+				<tbody>
+					<xsl:for-each select="n1:informationRecipient">
+						<tr>
+							<td width="20%" bgcolor="#3399ff">
+								<span class="td_label">
+									<xsl:text>Information recipient:</xsl:text>
+								</span>
+							</td>
+							<td width="80%">
+								<xsl:choose>
+									<xsl:when test="n1:intendedRecipient/n1:informationRecipient/n1:name">
+										<xsl:for-each select="n1:intendedRecipient/n1:informationRecipient">
+											<xsl:call-template name="show-name">
+												<xsl:with-param name="name" select="n1:name"/>
+											</xsl:call-template>
+											<xsl:if test="position() != last()">
+												<br/>
+											</xsl:if>
+										</xsl:for-each>
+									</xsl:when>
+									<xsl:otherwise>
+										<xsl:for-each select="n1:intendedRecipient">
+											<xsl:for-each select="n1:id">
+												<xsl:call-template name="show-id"/>
+											</xsl:for-each>
+											<xsl:if test="position() != last()">
+												<br/>
+											</xsl:if>
+											<br/>
+										</xsl:for-each>
+									</xsl:otherwise>
+								</xsl:choose>
+							</td>
+						</tr>
+						<xsl:if test="n1:intendedRecipient/n1:addr | n1:intendedRecipient/n1:telecom">
+							<tr>
+								<td bgcolor="#3399ff">
+									<span class="td_label">
+										<xsl:text>Contact info</xsl:text>
+									</span>
+								</td>
+								<td>
+									<xsl:call-template name="show-contactInfo">
+										<xsl:with-param name="contact" select="n1:intendedRecipient"/>
+									</xsl:call-template>
+								</td>
+							</tr>
+						</xsl:if>
+					</xsl:for-each>
+				</tbody>
+			</table>
+		</xsl:if>
+	</xsl:template>
+	<!-- participant -->
+	<xsl:template name="participant">
+		<xsl:if test="n1:participant">
+			<table class="header_table">
+				<tbody>
+					<xsl:for-each select="n1:participant">
+						<tr>
+							<td width="20%" bgcolor="#3399ff">
+								<xsl:variable name="participtRole">
+									<xsl:call-template name="translateRoleAssoCode">
+										<xsl:with-param name="code" select="n1:associatedEntity/@classCode"/>
+									</xsl:call-template>
+								</xsl:variable>
+								<xsl:choose>
+									<xsl:when test="$participtRole">
+										<span class="td_label">
+											<xsl:call-template name="firstCharCaseUp">
+												<xsl:with-param name="data" select="$participtRole"/>
+											</xsl:call-template>
+										</span>
+									</xsl:when>
+									<xsl:otherwise>
+										<span class="td_label">
+											<xsl:text>Participant</xsl:text>
+										</span>
+									</xsl:otherwise>
+								</xsl:choose>
+							</td>
+							<td width="80%">
+								<xsl:if test="n1:functionCode">
+									<xsl:call-template name="show-code">
+										<xsl:with-param name="code" select="n1:functionCode"/>
+									</xsl:call-template>
+								</xsl:if>
+								<xsl:call-template name="show-associatedEntity">
+									<xsl:with-param name="assoEntity" select="n1:associatedEntity"/>
+								</xsl:call-template>
+								<xsl:if test="n1:time">
+									<xsl:if test="n1:time/n1:low">
+										<xsl:text> from </xsl:text>
+										<xsl:call-template name="show-time">
+											<xsl:with-param name="datetime" select="n1:time/n1:low"/>
+										</xsl:call-template>
+									</xsl:if>
+									<xsl:if test="n1:time/n1:high">
+										<xsl:text> to </xsl:text>
+										<xsl:call-template name="show-time">
+											<xsl:with-param name="datetime" select="n1:time/n1:high"/>
+										</xsl:call-template>
+									</xsl:if>
+								</xsl:if>
+								<xsl:if test="position() != last()">
+									<br/>
+								</xsl:if>
+							</td>
+						</tr>
+						<xsl:if test="n1:associatedEntity/n1:addr | n1:associatedEntity/n1:telecom">
+							<tr>
+								<td bgcolor="#3399ff">
+									<span class="td_label">
+										<xsl:text>Contact info</xsl:text>
+									</span>
+								</td>
+								<td>
+									<xsl:call-template name="show-contactInfo">
+										<xsl:with-param name="contact" select="n1:associatedEntity"/>
+									</xsl:call-template>
+								</td>
+							</tr>
+						</xsl:if>
+					</xsl:for-each>
+				</tbody>
+			</table>
+		</xsl:if>
+	</xsl:template>
+	<!-- recordTarget -->
+	<xsl:template name="recordTarget">
+		<table class="header_table">
+			<tbody>
+				<xsl:for-each select="/n1:ClinicalDocument/n1:recordTarget/n1:patientRole">
+					<xsl:if test="not(n1:id/@nullFlavor)">
+					<tr>
+						<td width="20%" bgcolor="#3399ff">
+							<span class="td_label">
+								<xsl:text>Patient</xsl:text>
+							</span>
+						</td>
+						<td colspan="3">
+							<xsl:call-template name="show-name">
+								<xsl:with-param name="name" select="n1:patient/n1:name"/>
+							</xsl:call-template>
+						</td>
+					</tr>
+					<tr>
+						<td width="20%" bgcolor="#3399ff">
+							<span class="td_label">
+								<xsl:text>Date of birth</xsl:text>
+							</span>
+						</td>
+						<td width="30%">
+							<xsl:call-template name="show-time">
+								<xsl:with-param name="datetime" select="n1:patient/n1:birthTime"/>
+							</xsl:call-template>
+						</td>
+						<td width="10%" bgcolor="#3399ff">
+							<span class="td_label">
+								<xsl:text>Sex</xsl:text>
+							</span>
+						</td>
+						<td>
+							<xsl:for-each select="n1:patient/n1:administrativeGenderCode">
+								<xsl:call-template name="show-gender"/>
+							</xsl:for-each>
+						</td>
+					</tr>
+					<tr>
+						<td width="10%" bgcolor="#3399ff">
+							<span class="td_label">
+								<xsl:text>Contact info</xsl:text>
+							</span>
+						</td>
+						<td width="35%">
+							<xsl:call-template name="show-contactInfo">
+								<xsl:with-param name="contact" select="."/>
+							</xsl:call-template>
+						</td>
+						<td width="10%" bgcolor="#3399ff">
+							<span class="td_label">
+								<xsl:text>Patient IDs</xsl:text>
+							</span>
+						</td>
+						<td>
+							<xsl:for-each select="n1:id">
+								<xsl:call-template name="show-id"/>
+								<br/>
+							</xsl:for-each>
+						</td>
+					</tr>
+					</xsl:if>
+				</xsl:for-each>
+			</tbody>
+		</table>
+	</xsl:template>
+	<!-- relatedDocument -->
+	<xsl:template name="relatedDocument">
+		<xsl:if test="n1:relatedDocument">
+			<table class="header_table">
+				<tbody>
+					<xsl:for-each select="n1:relatedDocument">
+						<tr>
+							<td width="20%" bgcolor="#3399ff">
+								<span class="td_label">
+									<xsl:text>Related document</xsl:text>
+								</span>
+							</td>
+							<td width="80%">
+								<xsl:for-each select="n1:parentDocument">
+									<xsl:for-each select="n1:id">
+										<xsl:call-template name="show-id"/>
+										<br/>
+									</xsl:for-each>
+								</xsl:for-each>
+							</td>
+						</tr>
+					</xsl:for-each>
+				</tbody>
+			</table>
+		</xsl:if>
+	</xsl:template>
+	<!-- authorization (consent) -->
+	<xsl:template name="authorization">
+		<xsl:if test="n1:authorization">
+			<table class="header_table">
+				<tbody>
+					<xsl:for-each select="n1:authorization">
+						<tr>
+							<td width="20%" bgcolor="#3399ff">
+								<span class="td_label">
+									<xsl:text>Consent</xsl:text>
+								</span>
+							</td>
+							<td width="80%">
+								<xsl:choose>
+									<xsl:when test="n1:consent/n1:code">
+										<xsl:call-template name="show-code">
+											<xsl:with-param name="code" select="n1:consent/n1:code"/>
+										</xsl:call-template>
+									</xsl:when>
+									<xsl:otherwise>
+										<xsl:call-template name="show-code">
+											<xsl:with-param name="code" select="n1:consent/n1:statusCode"/>
+										</xsl:call-template>
+									</xsl:otherwise>
+								</xsl:choose>
+								<br/>
+							</td>
+						</tr>
+					</xsl:for-each>
+				</tbody>
+			</table>
+		</xsl:if>
+	</xsl:template>
+	<!-- setAndVersion -->
+	<xsl:template name="setAndVersion">
+		<xsl:if test="n1:setId and n1:versionNumber">
+			<table class="header_table">
+				<tbody>
+					<tr>
+						<td width="20%">
+							<xsl:text>SetId and Version</xsl:text>
+						</td>
+						<td colspan="3">
+							<xsl:text>SetId: </xsl:text>
+							<xsl:call-template name="show-id">
+								<xsl:with-param name="id" select="n1:setId"/>
+							</xsl:call-template>
+							<xsl:text>  Version: </xsl:text>
+							<xsl:value-of select="n1:versionNumber/@value"/>
+						</td>
+					</tr>
+				</tbody>
+			</table>
+		</xsl:if>
+	</xsl:template>
+	<!-- show StructuredBody 	-->
+	<xsl:template match="n1:component/n1:structuredBody">
+		<xsl:for-each select="n1:component/n1:section">
+			<xsl:call-template name="section" />
+		</xsl:for-each>
+	</xsl:template>
+	<!-- show nonXMLBody -->
+	<xsl:template match='n1:component/n1:nonXMLBody'>
+		<xsl:choose>
+			<!-- if there is a reference, use that in an IFRAME -->
+			<xsl:when test='n1:text/n1:reference'>
+				<IFRAME name='nonXMLBody' id='nonXMLBody' WIDTH='80%' HEIGHT='66%' src='{n1:text/n1:reference/@value}'/>
+			</xsl:when>
+			<xsl:when test='n1:text/@mediaType="text/plain"'>
+				<pre>
+					<xsl:value-of select='n1:text/text()'/>
+				</pre>
+			</xsl:when>
+			<xsl:otherwise>
+				<CENTER>Cannot display the text</CENTER>
+			</xsl:otherwise>
+		</xsl:choose>
+	</xsl:template>
+	<!-- top level component/section: display title and text,
+     and process any nested component/sections
+	 -->
+	<xsl:template name="section">
+		<xsl:call-template name="section-title">
+			<xsl:with-param name="title" select="n1:title"/>
+		</xsl:call-template>
+		<xsl:call-template name="section-author"/>
+		<xsl:call-template name="section-text"/>
+		<xsl:for-each select="n1:component/n1:section">
+			<xsl:call-template name="nestedSection">
+				<xsl:with-param name="margin" select="2"/>
+			</xsl:call-template>
+		</xsl:for-each>
+	</xsl:template>
+	<!-- top level section title -->
+	<xsl:template name="section-title">
+		<xsl:param name="title"/>
+		<h3>
+			<a name="{generate-id($title)}" href="#toc">
+				<xsl:value-of select="$title"/>
+			</a>
+		</h3>
+	</xsl:template>
+	<!-- section author -->
+	<xsl:template name="section-author">
+		<xsl:if test="count(n1:author)&gt;0">
+			<div style="margin-left : 2em;">
+				<b>
+					<xsl:text>Section Author: </xsl:text>
+				</b>
+				<xsl:for-each select="n1:author/n1:assignedAuthor">
+					<xsl:choose>
+						<xsl:when test="n1:assignedPerson/n1:name">
+							<xsl:call-template name="show-name">
+								<xsl:with-param name="name" select="n1:assignedPerson/n1:name"/>
+							</xsl:call-template>
+							<xsl:if test="n1:representedOrganization">
+								<xsl:text>, </xsl:text>
+								<xsl:call-template name="show-name">
+									<xsl:with-param name="name" select="n1:representedOrganization/n1:name"/>
+								</xsl:call-template>
+							</xsl:if>
+						</xsl:when>
+						<xsl:when test="n1:assignedAuthoringDevice/n1:softwareName">
+							<xsl:value-of select="n1:assignedAuthoringDevice/n1:softwareName"/>
+						</xsl:when>
+						<xsl:otherwise>
+							<xsl:for-each select="n1:id">
+								<xsl:call-template name="show-id"/>
+								<br/>
+							</xsl:for-each>
+						</xsl:otherwise>
+					</xsl:choose>
+				</xsl:for-each>
+				<br />
+			</div>
+		</xsl:if>
+	</xsl:template>
+	<!-- top-level section Text   -->
+	<xsl:template name="section-text">
+		<div>
+			<xsl:apply-templates select="n1:text" />
+		</div>
+	</xsl:template>
+	<!-- nested component/section -->
+	<xsl:template name="nestedSection">
+		<xsl:param name="margin" />
+		<h4 style="margin-left : {$margin}em;">
+			<xsl:value-of select="n1:title"/>
+		</h4>
+		<div style="margin-left : {$margin}em;">
+			<xsl:apply-templates select="n1:text"/>
+		</div>
+		<xsl:for-each select="n1:component/n1:section">
+			<xsl:call-template name="nestedSection">
+				<xsl:with-param name="margin" select="2*$margin"/>
+			</xsl:call-template>
+		</xsl:for-each>
+	</xsl:template>
+	<!--   paragraph  -->
+	<xsl:template match="n1:paragraph">
+		<p>
+			<xsl:apply-templates/>
+		</p>
+	</xsl:template>
+	<!--   pre format  -->
+	<xsl:template match="n1:pre">
+		<pre>
+			<xsl:apply-templates/>
+		</pre>
+	</xsl:template>
+	<!--   Content w/ deleted text is hidden -->
+	<xsl:template match="n1:content[@revised='delete']"/>
+	<!--   content  -->
+	<xsl:template match="n1:content">
+		<xsl:apply-templates/>
+	</xsl:template>
+	<!-- line break -->
+	<xsl:template match="n1:br">
+		<xsl:element name='br'>
+			<xsl:apply-templates/>
+		</xsl:element>
+	</xsl:template>
+	<!--   list  -->
+	<xsl:template match="n1:list">
+		<xsl:if test="n1:caption">
+			<p>
+				<b>
+					<xsl:apply-templates select="n1:caption"/>
+				</b>
+			</p>
+		</xsl:if>
+		<ul>
+			<xsl:for-each select="n1:item">
+				<li>
+					<xsl:apply-templates/>
+				</li>
+			</xsl:for-each>
+		</ul>
+	</xsl:template>
+	<xsl:template match="n1:list[@listType='ordered']">
+		<xsl:if test="n1:caption">
+			<span style="font-weight:bold; ">
+				<xsl:apply-templates select="n1:caption"/>
+			</span>
+		</xsl:if>
+		<ol>
+			<xsl:for-each select="n1:item">
+				<li>
+					<xsl:apply-templates/>
+				</li>
+			</xsl:for-each>
+		</ol>
+	</xsl:template>
+	<!--   caption  -->
+	<xsl:template match="n1:caption">
+		<xsl:apply-templates/>
+		<xsl:text>: </xsl:text>
+	</xsl:template>
+	<!--  Tables   -->
+	<xsl:template match="n1:table/@*|n1:thead/@*|n1:tfoot/@*|n1:tbody/@*|n1:colgroup/@*|n1:col/@*|n1:tr/@*|n1:th/@*|n1:td/@*">
+		<xsl:copy>
+			<xsl:copy-of select="@*"/>
+			<xsl:apply-templates/>
+		</xsl:copy>
+	</xsl:template>
+	<xsl:template match="n1:table">
+		<table class="narr_table">
+			<xsl:copy-of select="@*"/>
+			<xsl:apply-templates/>
+		</table>
+	</xsl:template>
+	<xsl:template match="n1:thead">
+		<thead>
+			<xsl:copy-of select="@*"/>
+			<xsl:apply-templates/>
+		</thead>
+	</xsl:template>
+	<xsl:template match="n1:tfoot">
+		<tfoot>
+			<xsl:copy-of select="@*"/>
+			<xsl:apply-templates/>
+		</tfoot>
+	</xsl:template>
+	<xsl:template match="n1:tbody">
+		<tbody>
+			<xsl:copy-of select="@*"/>
+			<xsl:apply-templates/>
+		</tbody>
+	</xsl:template>
+	<xsl:template match="n1:colgroup">
+		<colgroup>
+			<xsl:copy-of select="@*"/>
+			<xsl:apply-templates/>
+		</colgroup>
+	</xsl:template>
+	<xsl:template match="n1:col">
+		<col>
+			<xsl:copy-of select="@*"/>
+			<xsl:apply-templates/>
+		</col>
+	</xsl:template>
+	<xsl:template match="n1:tr">
+		<tr class="narr_tr">
+			<xsl:copy-of select="@*"/>
+			<xsl:apply-templates/>
+		</tr>
+	</xsl:template>
+	<xsl:template match="n1:th">
+		<th class="narr_th">
+			<xsl:copy-of select="@*"/>
+			<xsl:apply-templates/>
+		</th>
+	</xsl:template>
+	<xsl:template match="n1:td">
+		<td>
+			<xsl:copy-of select="@*"/>
+			<xsl:apply-templates/>
+		</td>
+	</xsl:template>
+	<xsl:template match="n1:table/n1:caption">
+		<span style="font-weight:bold; ">
+			<xsl:apply-templates/>
+		</span>
+	</xsl:template>
+	<!--   RenderMultiMedia 
+    this currently only handles GIF's and JPEG's.  It could, however,
+    be extended by including other image MIME types in the predicate
+    and/or by generating <object> or <applet> tag with the correct
+    params depending on the media type  @ID  =$imageRef  referencedObject
+    -->
+	<xsl:template match="n1:renderMultiMedia">
+		<xsl:variable name="imageRef" select="@referencedObject"/>
+		<xsl:choose>
+			<xsl:when test="//n1:regionOfInterest[@ID=$imageRef]">
+				<!-- Here is where the Region of Interest image referencing goes -->
+				<xsl:if test="//n1:regionOfInterest[@ID=$imageRef]//n1:observationMedia/n1:value[@mediaType='image/gif'           or
+          @mediaType='image/jpeg']">
+					<br clear="all"/>
+					<xsl:element name="img">
+						<xsl:attribute name="src"><xsl:value-of select="//n1:regionOfInterest[@ID=$imageRef]//n1:observationMedia/n1:value/n1:reference/@value"/></xsl:attribute>
+					</xsl:element>
+				</xsl:if>
+			</xsl:when>
+			<xsl:otherwise>
+				<!-- Here is where the direct MultiMedia image referencing goes -->
+				<xsl:if test="//n1:observationMedia[@ID=$imageRef]/n1:value[@mediaType='image/gif' or @mediaType='image/jpeg']">
+					<br clear="all"/>
+					<xsl:element name="img">
+						<xsl:attribute name="src"><xsl:value-of select="//n1:observationMedia[@ID=$imageRef]/n1:value/n1:reference/@value"/></xsl:attribute>
+					</xsl:element>
+				</xsl:if>
+			</xsl:otherwise>
+		</xsl:choose>
+	</xsl:template>
+	<!--    Stylecode processing   
+    Supports Bold, Underline and Italics display
+    -->
+	<xsl:template match="//n1:*[@styleCode]">
+		<xsl:if test="@styleCode='Bold'">
+			<xsl:element name="b">
+				<xsl:apply-templates/>
+			</xsl:element>
+		</xsl:if>
+		<xsl:if test="@styleCode='Italics'">
+			<xsl:element name="i">
+				<xsl:apply-templates/>
+			</xsl:element>
+		</xsl:if>
+		<xsl:if test="@styleCode='Underline'">
+			<xsl:element name="u">
+				<xsl:apply-templates/>
+			</xsl:element>
+		</xsl:if>
+		<xsl:if test="contains(@styleCode,'Bold') and contains(@styleCode,'Italics') and not (contains(@styleCode, 'Underline'))">
+			<xsl:element name="b">
+				<xsl:element name="i">
+					<xsl:apply-templates/>
+				</xsl:element>
+			</xsl:element>
+		</xsl:if>
+		<xsl:if test="contains(@styleCode,'Bold') and contains(@styleCode,'Underline') and not (contains(@styleCode, 'Italics'))">
+			<xsl:element name="b">
+				<xsl:element name="u">
+					<xsl:apply-templates/>
+				</xsl:element>
+			</xsl:element>
+		</xsl:if>
+		<xsl:if test="contains(@styleCode,'Italics') and contains(@styleCode,'Underline') and not (contains(@styleCode, 'Bold'))">
+			<xsl:element name="i">
+				<xsl:element name="u">
+					<xsl:apply-templates/>
+				</xsl:element>
+			</xsl:element>
+		</xsl:if>
+		<xsl:if test="contains(@styleCode,'Italics') and contains(@styleCode,'Underline') and contains(@styleCode, 'Bold')">
+			<xsl:element name="b">
+				<xsl:element name="i">
+					<xsl:element name="u">
+						<xsl:apply-templates/>
+					</xsl:element>
+				</xsl:element>
+			</xsl:element>
+		</xsl:if>
+		<xsl:if test="not (contains(@styleCode,'Italics') or contains(@styleCode,'Underline') or contains(@styleCode, 'Bold'))">
+			<xsl:apply-templates/>
+		</xsl:if>
+	</xsl:template>
+	<!--    Superscript or Subscript   -->
+	<xsl:template match="n1:sup">
+		<xsl:element name="sup">
+			<xsl:apply-templates/>
+		</xsl:element>
+	</xsl:template>
+	<xsl:template match="n1:sub">
+		<xsl:element name="sub">
+			<xsl:apply-templates/>
+		</xsl:element>
+	</xsl:template>
+	<!-- show nonXMLBody -->
+	<xsl:template match='n1:component/n1:nonXMLBody'>
+		<xsl:choose>
+			<!-- if there is a reference, use that in an IFRAME -->
+			<xsl:when test='n1:text/n1:reference'>
+				<IFRAME name='nonXMLBody' id='nonXMLBody' WIDTH='80%' HEIGHT='66%' src='{n1:text/n1:reference/@value}'/>
+			</xsl:when>
+			<xsl:when test='n1:text/@mediaType="text/plain"'>
+				<pre>
+					<xsl:value-of select='n1:text/text()'/>
+				</pre>
+			</xsl:when>
+			<xsl:otherwise>
+				<CENTER>Cannot display the text</CENTER>
+			</xsl:otherwise>
+		</xsl:choose>
+	</xsl:template>
+	<!-- show-signature -->
+	<xsl:template name="show-sig">
+		<xsl:param name="sig"/>
+		<xsl:choose>
+			<xsl:when test="$sig/@code =&apos;S&apos;">
+				<xsl:text>signed</xsl:text>
+			</xsl:when>
+			<xsl:when test="$sig/@code=&apos;I&apos;">
+				<xsl:text>intended</xsl:text>
+			</xsl:when>
+			<xsl:when test="$sig/@code=&apos;X&apos;">
+				<xsl:text>signature required</xsl:text>
+			</xsl:when>
+		</xsl:choose>
+	</xsl:template>
+	<!--	show-id	-->
+	<xsl:template name="show-id">
+		<xsl:param name="id"/>
+		<xsl:choose>
+			<xsl:when test="not($id)">
+				<xsl:if test="not(@nullFlavor)">
+					<xsl:if test="@extension">
+						<xsl:value-of select="@extension"/>
+					</xsl:if>
+					<xsl:text> </xsl:text>
+					<xsl:value-of select="@root"/>
+				</xsl:if>
+			</xsl:when>
+			<xsl:otherwise>
+				<xsl:if test="not($id/@nullFlavor)">
+					<xsl:if test="$id/@extension">
+						<xsl:value-of select="$id/@extension"/>
+					</xsl:if>
+					<xsl:text> </xsl:text>
+					<xsl:value-of select="$id/@root"/>
+				</xsl:if>
+			</xsl:otherwise>
+		</xsl:choose>
+	</xsl:template>
+	<!-- show-name	-->
+	<xsl:template name="show-name">
+		<xsl:param name="name"/>
+		<xsl:choose>
+			<xsl:when test="$name/n1:family">
+				<xsl:if test="$name/n1:prefix">
+					<xsl:value-of select="$name/n1:prefix"/>
+					<xsl:text> </xsl:text>
+				</xsl:if>
+				<xsl:value-of select="$name/n1:given"/>
+				<xsl:text> </xsl:text>
+				<xsl:value-of select="$name/n1:family"/>
+				<xsl:if test="$name/n1:suffix">
+					<xsl:text>, </xsl:text>
+					<xsl:value-of select="$name/n1:suffix"/>
+				</xsl:if>
+			</xsl:when>
+			<xsl:otherwise>
+				<xsl:value-of select="$name"/>
+			</xsl:otherwise>
+		</xsl:choose>
+	</xsl:template>
+	<!-- show-gender	-->
+	<xsl:template name="show-gender">
+		<xsl:choose>
+			<xsl:when test="@code   = &apos;M&apos;">
+				<xsl:text>Male</xsl:text>
+			</xsl:when>
+			<xsl:when test="@code  = &apos;F&apos;">
+				<xsl:text>Female</xsl:text>
+			</xsl:when>
+			<xsl:when test="@code  = &apos;U&apos;">
+				<xsl:text>Undifferentiated</xsl:text>
+			</xsl:when>
+		</xsl:choose>
+	</xsl:template>
+	<!-- show-contactInfo -->
+	<xsl:template name="show-contactInfo">
+		<xsl:param name="contact"/>
+		<xsl:call-template name="show-address">
+			<xsl:with-param name="address" select="$contact/n1:addr"/>
+		</xsl:call-template>
+		<xsl:call-template name="show-telecom">
+			<xsl:with-param name="telecom" select="$contact/n1:telecom"/>
+		</xsl:call-template>
+	</xsl:template>
+	<!-- show-address	-->
+	<xsl:template name="show-address">
+		<xsl:param name="address"/>
+		<xsl:choose>
+			<xsl:when test="$address">
+				<xsl:if test="$address/@use">
+					<xsl:text> </xsl:text>
+					<xsl:call-template name="translateTelecomCode">
+						<xsl:with-param name="code" select="$address/@use"/>
+					</xsl:call-template>
+					<xsl:text>:</xsl:text>
+					<br/>
+				</xsl:if>
+				<xsl:for-each select="$address/n1:streetAddressLine">
+					<xsl:value-of select="."/>
+					<br/>
+				</xsl:for-each>
+				<xsl:if test="$address/n1:streetName">
+					<xsl:value-of select="$address/n1:streetName"/>
+					<xsl:text> </xsl:text>
+					<xsl:value-of select="$address/n1:houseNumber"/>
+					<br/>
+				</xsl:if>
+				<xsl:if test="string-length($address/n1:city)>0">
+					<xsl:value-of select="$address/n1:city"/>
+				</xsl:if>
+				<xsl:if test="string-length($address/n1:state)>0">
+					<xsl:text>,&#160;</xsl:text>
+					<xsl:value-of select="$address/n1:state"/>
+				</xsl:if>
+				<xsl:if test="string-length($address/n1:postalCode)>0">
+					<xsl:text>&#160;</xsl:text>
+					<xsl:value-of select="$address/n1:postalCode"/>
+				</xsl:if>
+				<xsl:if test="string-length($address/n1:country)>0">
+					<xsl:text>,&#160;</xsl:text>
+					<xsl:value-of select="$address/n1:country"/>
+				</xsl:if>
+			</xsl:when>
+			<xsl:otherwise>
+				<xsl:text>address not available</xsl:text>
+			</xsl:otherwise>
+		</xsl:choose>
+		<br/>
+	</xsl:template>
+	<!-- show-telecom	-->
+	<xsl:template name="show-telecom">
+		<xsl:param name="telecom"/>
+		<xsl:choose>
+			<xsl:when test="$telecom">
+				<xsl:variable name="type" select="substring-before($telecom/@value, ':')"/>
+				<xsl:variable name="value" select="substring-after($telecom/@value, ':')"/>
+				<xsl:if test="$type">
+					<xsl:call-template name="translateTelecomCode">
+						<xsl:with-param name="code" select="$type"/>
+					</xsl:call-template>
+					<xsl:if test="@use">
+						<xsl:text> (</xsl:text>
+						<xsl:call-template name="translateTelecomCode">
+							<xsl:with-param name="code" select="@use"/>
+						</xsl:call-template>
+						<xsl:text>)</xsl:text>
+					</xsl:if>
+					<xsl:text>: </xsl:text>
+					<xsl:text> </xsl:text>
+					<xsl:value-of select="$value"/>
+				</xsl:if>
+			</xsl:when>
+			<xsl:otherwise>
+				<xsl:text>Telecom information not available</xsl:text>
+			</xsl:otherwise>
+		</xsl:choose>
+		<br/>
+	</xsl:template>
+	<!-- show-recipientType -->
+	<xsl:template name="show-recipientType">
+		<xsl:param name="typeCode"/>
+		<xsl:choose>
+			<xsl:when test="$typeCode='PRCP'">Primary Recipient:</xsl:when>
+			<xsl:when test="$typeCode='TRC'">Secondary Recipient:</xsl:when>
+			<xsl:otherwise>Recipient:</xsl:otherwise>
+		</xsl:choose>
+	</xsl:template>
+	<!-- Convert Telecom URL to display text -->
+	<xsl:template name="translateTelecomCode">
+		<xsl:param name="code"/>
+		<!--xsl:value-of select="document('voc.xml')/systems/system[@root=$code/@codeSystem]/code[@value=$code/@code]/@displayName"/-->
+		<!--xsl:value-of select="document('codes.xml')/*/code[@code=$code]/@display"/-->
+		<xsl:choose>
+			<!-- lookup table Telecom URI -->
+			<xsl:when test="$code='tel'">
+				<xsl:text>Tel</xsl:text>
+			</xsl:when>
+			<xsl:when test="$code='fax'">
+				<xsl:text>Fax</xsl:text>
+			</xsl:when>
+			<xsl:when test="$code='http'">
+				<xsl:text>Web</xsl:text>
+			</xsl:when>
+			<xsl:when test="$code='mailto'">
+				<xsl:text>Mail</xsl:text>
+			</xsl:when>
+			<xsl:when test="$code='H'">
+				<xsl:text>Home</xsl:text>
+			</xsl:when>
+			<xsl:when test="$code='HV'">
+				<xsl:text>Vacation Home</xsl:text>
+			</xsl:when>
+			<xsl:when test="$code='HP'">
+				<xsl:text>Pirmary Home</xsl:text>
+			</xsl:when>
+			<xsl:when test="$code='WP'">
+				<xsl:text>Work Place</xsl:text>
+			</xsl:when>
+			<xsl:when test="$code='PUB'">
+				<xsl:text>Pub</xsl:text>
+			</xsl:when>
+			<xsl:otherwise>
+				<xsl:text>{$code='</xsl:text>
+				<xsl:value-of select="$code"/>
+				<xsl:text>'?}</xsl:text>
+			</xsl:otherwise>
+		</xsl:choose>
+	</xsl:template>
+	<!-- convert RoleClassAssociative code to display text -->
+	<xsl:template name="translateRoleAssoCode">
+		<xsl:param name="code"/>
+		<xsl:choose>
+			<xsl:when test="$code='AFFL'">
+				<xsl:text>affiliate</xsl:text>
+			</xsl:when>
+			<xsl:when test="$code='AGNT'">
+				<xsl:text>agent</xsl:text>
+			</xsl:when>
+			<xsl:when test="$code='ASSIGNED'">
+				<xsl:text>assigned entity</xsl:text>
+			</xsl:when>
+			<xsl:when test="$code='COMPAR'">
+				<xsl:text>commissioning party</xsl:text>
+			</xsl:when>
+			<xsl:when test="$code='CON'">
+				<xsl:text>contact</xsl:text>
+			</xsl:when>
+			<xsl:when test="$code='ECON'">
+				<xsl:text>emergency contact</xsl:text>
+			</xsl:when>
+			<xsl:when test="$code='NOK'">
+				<xsl:text>next of kin</xsl:text>
+			</xsl:when>
+			<xsl:when test="$code='SGNOFF'">
+				<xsl:text>signing authority</xsl:text>
+			</xsl:when>
+			<xsl:when test="$code='GUARD'">
+				<xsl:text>guardian</xsl:text>
+			</xsl:when>
+			<xsl:when test="$code='GUAR'">
+				<xsl:text>guardian</xsl:text>
+			</xsl:when>
+			<xsl:when test="$code='CIT'">
+				<xsl:text>citizen</xsl:text>
+			</xsl:when>
+			<xsl:when test="$code='COVPTY'">
+				<xsl:text>covered party</xsl:text>
+			</xsl:when>
+			<xsl:otherwise>
+				<xsl:text>{$code='</xsl:text>
+				<xsl:value-of select="$code"/>
+				<xsl:text>'?}</xsl:text>
+			</xsl:otherwise>
+		</xsl:choose>
+	</xsl:template>
+	<!-- show time -->
+	<xsl:template name="show-time">
+		<xsl:param name="datetime"/>
+		<xsl:choose>
+			<xsl:when test="not($datetime)">
+				<xsl:call-template name="formatDateTime">
+					<xsl:with-param name="date" select="@value"/>
+				</xsl:call-template>
+				<xsl:text> </xsl:text>
+			</xsl:when>
+			<xsl:otherwise>
+				<xsl:call-template name="formatDateTime">
+					<xsl:with-param name="date" select="$datetime/@value"/>
+				</xsl:call-template>
+				<xsl:text> </xsl:text>
+			</xsl:otherwise>
+		</xsl:choose>
+	</xsl:template>
+	<!-- show assignedEntity -->
+	<xsl:template name="show-assignedEntity">
+		<xsl:param name="asgnEntity"/>
+		<xsl:choose>
+			<xsl:when test="$asgnEntity/n1:assignedPerson/n1:name">
+				<xsl:call-template name="show-name">
+					<xsl:with-param name="name" select="$asgnEntity/n1:assignedPerson/n1:name"/>
+				</xsl:call-template>
+				<xsl:if test="$asgnEntity/n1:representedOrganization/n1:name">
+					<xsl:text> of </xsl:text>
+					<xsl:value-of select="$asgnEntity/n1:representedOrganization/n1:name"/>
+				</xsl:if>
+			</xsl:when>
+			<xsl:when test="$asgnEntity/n1:representedOrganization">
+				<xsl:value-of select="$asgnEntity/n1:representedOrganization/n1:name"/>
+			</xsl:when>
+			<xsl:otherwise>
+				<xsl:for-each select="$asgnEntity/n1:id">
+					<xsl:call-template name="show-id"/>
+					<xsl:choose>
+						<xsl:when test="position()!=last()">
+							<xsl:text>, </xsl:text>
+						</xsl:when>
+						<xsl:otherwise>
+							<br/>
+						</xsl:otherwise>
+					</xsl:choose>
+				</xsl:for-each>
+			</xsl:otherwise>
+		</xsl:choose>
+	</xsl:template>
+	
+		<!-- show relatedEntity -->
+	<xsl:template name="show-relatedEntity">
+		<xsl:param name="relatedEntity"/>
+		<xsl:choose>
+			<xsl:when test="$relatedEntity/n1:relatedPerson/n1:name">
+				<xsl:call-template name="show-name">
+					<xsl:with-param name="name" select="$relatedEntity/n1:relatedPerson/n1:name"/>
+				</xsl:call-template>
+			</xsl:when>
+		</xsl:choose>
+	</xsl:template>
+
+	<!-- show associatedEntity -->
+	<xsl:template name="show-associatedEntity">
+		<xsl:param name="assoEntity"/>
+		<xsl:choose>
+			<xsl:when test="$assoEntity/n1:associatedPerson">
+				<xsl:for-each select="$assoEntity/n1:associatedPerson/n1:name">
+					<xsl:call-template name="show-name">
+						<xsl:with-param name="name" select="."/>
+					</xsl:call-template>
+					<br/>
+				</xsl:for-each>
+			</xsl:when>
+			<xsl:when test="$assoEntity/n1:scopingOrganization">
+				<xsl:for-each select="$assoEntity/n1:scopingOrganization">
+					<xsl:if test="n1:name">
+						<xsl:call-template name="show-name">
+							<xsl:with-param name="name" select="n1:name"/>
+						</xsl:call-template>
+						<br/>
+					</xsl:if>
+					<xsl:if test="n1:standardIndustryClassCode">
+						<xsl:value-of select="n1:standardIndustryClassCode/@displayName"/>
+						<xsl:text> code:</xsl:text>
+						<xsl:value-of select="n1:standardIndustryClassCode/@code"/>
+					</xsl:if>
+				</xsl:for-each>
+			</xsl:when>
+			<xsl:when test="$assoEntity/n1:code">
+				<xsl:call-template name="show-code">
+					<xsl:with-param name="code" select="$assoEntity/n1:code"/>
+				</xsl:call-template>
+			</xsl:when>
+			<xsl:when test="$assoEntity/n1:id">
+				<xsl:value-of select="$assoEntity/n1:id/@extension"/>
+				<xsl:text> </xsl:text>
+				<xsl:value-of select="$assoEntity/n1:id/@root"/>
+			</xsl:when>
+		</xsl:choose>
+	</xsl:template>
+	<!-- show code 
+		if originalText present, return it, otherwise, check and return attribute: display name
+    -->
+	<xsl:template name="show-code">
+		<xsl:param name="code"/>
+		<xsl:variable name="this-codeSystem">
+			<xsl:value-of select="$code/@codeSystem"/>
+		</xsl:variable>
+		<xsl:variable name="this-code">
+			<xsl:value-of select="$code/@code"/>		
+		</xsl:variable>
+		<xsl:choose>
+			<xsl:when test="$code/n1:originalText">
+				<xsl:value-of select="$code/n1:originalText"/>
+			</xsl:when>
+			<xsl:when test="$code/@displayName">
+				<xsl:value-of select="$code/@displayName"/>
+			</xsl:when>
+			<!--
+			<xsl:when test="$the-valuesets/*/voc:system[@root=$this-codeSystem]/voc:code[@value=$this-code]/@displayName">
+				<xsl:value-of select="$the-valuesets/*/voc:system[@root=$this-codeSystem]/voc:code[@value=$this-code]/@displayName"/>
+			</xsl:when>
+			-->
+			<xsl:otherwise>
+				<xsl:value-of select="$this-code"/>
+			</xsl:otherwise>
+		</xsl:choose>
+	</xsl:template>		<!-- show classCode -->
+	<xsl:template name="show-actClassCode">
+		<xsl:param name="clsCode"/>
+		<xsl:choose>
+			<xsl:when test=" $clsCode = 'ACT' ">
+				<xsl:text>healthcare service</xsl:text>
+			</xsl:when>
+			<xsl:when test=" $clsCode = 'ACCM' ">
+				<xsl:text>accommodation</xsl:text>
+			</xsl:when>
+			<xsl:when test=" $clsCode = 'ACCT' ">
+				<xsl:text>account</xsl:text>
+			</xsl:when>
+			<xsl:when test=" $clsCode = 'ACSN' ">
+				<xsl:text>accession</xsl:text>
+			</xsl:when>
+			<xsl:when test=" $clsCode = 'ADJUD' ">
+				<xsl:text>financial adjudication</xsl:text>
+			</xsl:when>
+			<xsl:when test=" $clsCode = 'CONS' ">
+				<xsl:text>consent</xsl:text>
+			</xsl:when>
+			<xsl:when test=" $clsCode = 'CONTREG' ">
+				<xsl:text>container registration</xsl:text>
+			</xsl:when>
+			<xsl:when test=" $clsCode = 'CTTEVENT' ">
+				<xsl:text>clinical trial timepoint event</xsl:text>
+			</xsl:when>
+			<xsl:when test=" $clsCode = 'DISPACT' ">
+				<xsl:text>disciplinary action</xsl:text>
+			</xsl:when>
+			<xsl:when test=" $clsCode = 'ENC' ">
+				<xsl:text>encounter</xsl:text>
+			</xsl:when>
+			<xsl:when test=" $clsCode = 'INC' ">
+				<xsl:text>incident</xsl:text>
+			</xsl:when>
+			<xsl:when test=" $clsCode = 'INFRM' ">
+				<xsl:text>inform</xsl:text>
+			</xsl:when>
+			<xsl:when test=" $clsCode = 'INVE' ">
+				<xsl:text>invoice element</xsl:text>
+			</xsl:when>
+			<xsl:when test=" $clsCode = 'LIST' ">
+				<xsl:text>working list</xsl:text>
+			</xsl:when>
+			<xsl:when test=" $clsCode = 'MPROT' ">
+				<xsl:text>monitoring program</xsl:text>
+			</xsl:when>
+			<xsl:when test=" $clsCode = 'PCPR' ">
+				<xsl:text>care provision</xsl:text>
+			</xsl:when>
+			<xsl:when test=" $clsCode = 'PROC' ">
+				<xsl:text>procedure</xsl:text>
+			</xsl:when>
+			<xsl:when test=" $clsCode = 'REG' ">
+				<xsl:text>registration</xsl:text>
+			</xsl:when>
+			<xsl:when test=" $clsCode = 'REV' ">
+				<xsl:text>review</xsl:text>
+			</xsl:when>
+			<xsl:when test=" $clsCode = 'SBADM' ">
+				<xsl:text>substance administration</xsl:text>
+			</xsl:when>
+			<xsl:when test=" $clsCode = 'SPCTRT' ">
+				<xsl:text>speciment treatment</xsl:text>
+			</xsl:when>
+			<xsl:when test=" $clsCode = 'SUBST' ">
+				<xsl:text>substitution</xsl:text>
+			</xsl:when>
+			<xsl:when test=" $clsCode = 'TRNS' ">
+				<xsl:text>transportation</xsl:text>
+			</xsl:when>
+			<xsl:when test=" $clsCode = 'VERIF' ">
+				<xsl:text>verification</xsl:text>
+			</xsl:when>
+			<xsl:when test=" $clsCode = 'XACT' ">
+				<xsl:text>financial transaction</xsl:text>
+			</xsl:when>
+		</xsl:choose>
+	</xsl:template>
+	<!-- show participationType -->
+	<xsl:template name="show-participationType">
+		<xsl:param name="ptype"/>
+		<xsl:choose>
+			<xsl:when test=" $ptype='PPRF' ">
+				<xsl:text>primary performer</xsl:text>
+			</xsl:when>
+			<xsl:when test=" $ptype='PRF' ">
+				<xsl:text>performer</xsl:text>
+			</xsl:when>
+			<xsl:when test=" $ptype='VRF' ">
+				<xsl:text>verifier</xsl:text>
+			</xsl:when>
+			<xsl:when test=" $ptype='SPRF' ">
+				<xsl:text>secondary performer</xsl:text>
+			</xsl:when>
+		</xsl:choose>
+	</xsl:template>
+	<!-- show participationFunction -->
+	<xsl:template name="show-participationFunction">
+		<xsl:param name="pFunction"/>
+		<xsl:choose>
+			<xsl:when test=" $pFunction = 'ADMPHYS' ">
+				<xsl:text>admitting physician</xsl:text>
+			</xsl:when>
+			<xsl:when test=" $pFunction = 'ANEST' ">
+				<xsl:text>anesthesist</xsl:text>
+			</xsl:when>
+			<xsl:when test=" $pFunction = 'ANRS' ">
+				<xsl:text>anesthesia nurse</xsl:text>
+			</xsl:when>
+			<xsl:when test=" $pFunction = 'ATTPHYS' ">
+				<xsl:text>attending physician</xsl:text>
+			</xsl:when>
+			<xsl:when test=" $pFunction = 'DISPHYS' ">
+				<xsl:text>discharging physician</xsl:text>
+			</xsl:when>
+			<xsl:when test=" $pFunction = 'FASST' ">
+				<xsl:text>first assistant surgeon</xsl:text>
+			</xsl:when>
+			<xsl:when test=" $pFunction = 'MDWF' ">
+				<xsl:text>midwife</xsl:text>
+			</xsl:when>
+			<xsl:when test=" $pFunction = 'NASST' ">
+				<xsl:text>nurse assistant</xsl:text>
+			</xsl:when>
+			<xsl:when test=" $pFunction = 'PCP' ">
+				<xsl:text>primary care physician</xsl:text>
+			</xsl:when>
+			<xsl:when test=" $pFunction = 'PRISURG' ">
+				<xsl:text>primary surgeon</xsl:text>
+			</xsl:when>
+			<xsl:when test=" $pFunction = 'RNDPHYS' ">
+				<xsl:text>rounding physician</xsl:text>
+			</xsl:when>
+			<xsl:when test=" $pFunction = 'SASST' ">
+				<xsl:text>second assistant surgeon</xsl:text>
+			</xsl:when>
+			<xsl:when test=" $pFunction = 'SNRS' ">
+				<xsl:text>scrub nurse</xsl:text>
+			</xsl:when>
+			<xsl:when test=" $pFunction = 'TASST' ">
+				<xsl:text>third assistant</xsl:text>
+			</xsl:when>
+		</xsl:choose>
+	</xsl:template>
+	<xsl:template name="formatDateTime">
+		<xsl:param name="date"/>
+		<!-- month -->
+		<xsl:variable name="month" select="substring ($date, 5, 2)"/>
+		<xsl:choose>
+			<xsl:when test="$month='01'">
+				<xsl:text>January </xsl:text>
+			</xsl:when>
+			<xsl:when test="$month='02'">
+				<xsl:text>February </xsl:text>
+			</xsl:when>
+			<xsl:when test="$month='03'">
+				<xsl:text>March </xsl:text>
+			</xsl:when>
+			<xsl:when test="$month='04'">
+				<xsl:text>April </xsl:text>
+			</xsl:when>
+			<xsl:when test="$month='05'">
+				<xsl:text>May </xsl:text>
+			</xsl:when>
+			<xsl:when test="$month='06'">
+				<xsl:text>June </xsl:text>
+			</xsl:when>
+			<xsl:when test="$month='07'">
+				<xsl:text>July </xsl:text>
+			</xsl:when>
+			<xsl:when test="$month='08'">
+				<xsl:text>August </xsl:text>
+			</xsl:when>
+			<xsl:when test="$month='09'">
+				<xsl:text>September </xsl:text>
+			</xsl:when>
+			<xsl:when test="$month='10'">
+				<xsl:text>October </xsl:text>
+			</xsl:when>
+			<xsl:when test="$month='11'">
+				<xsl:text>November </xsl:text>
+			</xsl:when>
+			<xsl:when test="$month='12'">
+				<xsl:text>December </xsl:text>
+			</xsl:when>
+		</xsl:choose>
+		<!-- day -->
+		<xsl:choose>
+			<xsl:when test='substring ($date, 7, 1)="0"'>
+				<xsl:value-of select="substring ($date, 8, 1)"/>
+				<xsl:text>, </xsl:text>
+			</xsl:when>
+			<xsl:otherwise>
+				<xsl:value-of select="substring ($date, 7, 2)"/>
+				<xsl:text>, </xsl:text>
+			</xsl:otherwise>
+		</xsl:choose>
+		<!-- year -->
+		<xsl:value-of select="substring ($date, 1, 4)"/>
+		<!-- time and US timezone -->
+		<xsl:if test="string-length($date) > 8">
+			<xsl:text>, </xsl:text>
+			<!-- time -->
+			<xsl:variable name="time">
+				<xsl:value-of select="substring($date,9,6)"/>
+			</xsl:variable>
+			<xsl:variable name="hh">
+				<xsl:value-of select="substring($time,1,2)"/>
+			</xsl:variable>
+			<xsl:variable name="mm">
+				<xsl:value-of select="substring($time,3,2)"/>
+			</xsl:variable>
+			<xsl:variable name="ss">
+				<xsl:value-of select="substring($time,5,2)"/>
+			</xsl:variable>
+			<xsl:if test="string-length($hh)&gt;1">
+				<xsl:value-of select="$hh"/>
+				<xsl:if test="string-length($mm)&gt;1 and not(contains($mm,'-')) and not (contains($mm,'+'))">
+					<xsl:text>:</xsl:text>
+					<xsl:value-of select="$mm"/>
+					<xsl:if test="string-length($ss)&gt;1 and not(contains($ss,'-')) and not (contains($ss,'+'))">
+						<xsl:text>:</xsl:text>
+						<xsl:value-of select="$ss"/>
+					</xsl:if>
+				</xsl:if>
+			</xsl:if>
+			<!-- time zone -->
+			<xsl:variable name="tzon">
+				<xsl:choose>
+					<xsl:when test="contains($date,'+')">
+						<xsl:text>+</xsl:text>
+						<xsl:value-of select="substring-after($date, '+')"/>
+					</xsl:when>
+					<xsl:when test="contains($date,'-')">
+						<xsl:text>-</xsl:text>
+						<xsl:value-of select="substring-after($date, '-')"/>
+					</xsl:when>
+				</xsl:choose>
+			</xsl:variable>
+			<xsl:choose>
+				<!-- reference: http://www.timeanddate.com/library/abbreviations/timezones/na/ -->
+				<xsl:when test="$tzon = '-0500' ">
+					<xsl:text>, EST</xsl:text>
+				</xsl:when>
+				<xsl:when test="$tzon = '-0600' ">
+					<xsl:text>, CST</xsl:text>
+				</xsl:when>
+				<xsl:when test="$tzon = '-0700' ">
+					<xsl:text>, MST</xsl:text>
+				</xsl:when>
+				<xsl:when test="$tzon = '-0800' ">
+					<xsl:text>, PST</xsl:text>
+				</xsl:when>
+				<xsl:otherwise>
+					<xsl:text> </xsl:text>
+					<xsl:value-of select="$tzon"/>
+				</xsl:otherwise>
+			</xsl:choose>
+		</xsl:if>
+	</xsl:template>
+	<!-- convert to lower case -->
+	<xsl:template name="caseDown">
+		<xsl:param name="data"/>
+		<xsl:if test="$data">
+			<xsl:value-of select="translate($data, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ','abcdefghijklmnopqrstuvwxyz')"/>
+		</xsl:if>
+	</xsl:template>
+	<!-- convert to upper case -->
+	<xsl:template name="caseUp">
+		<xsl:param name="data"/>
+		<xsl:if test="$data">
+			<xsl:value-of select="translate($data,'abcdefghijklmnopqrstuvwxyz', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ')"/>
+		</xsl:if>
+	</xsl:template>
+	<!-- convert first character to upper case -->
+	<xsl:template name="firstCharCaseUp">
+		<xsl:param name="data"/>
+		<xsl:if test="$data">
+			<xsl:call-template name="caseUp">
+				<xsl:with-param name="data" select="substring($data,1,1)"/>
+			</xsl:call-template>
+			<xsl:value-of select="substring($data,2)"/>
+		</xsl:if>
+	</xsl:template>
+	<!-- show-noneFlavor -->
+	<!-- to do list -->
+	<xsl:template name="show-noneFlavor">   
+	</xsl:template>
+</xsl:stylesheet>
Index: /ccr2ccd-xslt/trunk/make/gpl2.sh
===================================================================
--- /ccr2ccd-xslt/trunk/make/gpl2.sh	(revision 999)
+++ /ccr2ccd-xslt/trunk/make/gpl2.sh	(revision 999)
@@ -0,0 +1,2 @@
+#!/bin/bash
+xsltproc -o M1-PAT_100839_QRDA_V1_0_0.xml  M1-ccr_qrda.xsl /home/vademo4-09/CCR/M1_100839_CCR_V1_0_0.xml
Index: /ccr2ccd-xslt/trunk/make/gpl2.sh~
===================================================================
--- /ccr2ccd-xslt/trunk/make/gpl2.sh~	(revision 999)
+++ /ccr2ccd-xslt/trunk/make/gpl2.sh~	(revision 999)
@@ -0,0 +1,13 @@
+#!/bin/bash
+#!/bin/bash
+xalan -in /home/vademo4-09/CCR/M1_100146_CCR_V1_0_0.xml -xsl M1-ccr_qrda.xsl -out /home/vademo4-09/QRDA/M1-PAT_100146_QRDA_V1_0_0.xml
+xalan -in /home/vademo4-09/CCR/M1_100676_CCR_V1_0_0.xml -xsl M1-ccr_qrda.xsl -out /home/vademo4-09/QRDA/M1-PAT_100676_QRDA_V1_0_0.xml
+xalan -in /home/vademo4-09/CCR/M1_100839_CCR_V1_0_0.xml -xsl M1-ccr_qrda.xsl -out /home/vademo4-09/QRDA/M1-PAT_100839_QRDA_V1_0_0.xml
+xalan -in /home/vademo4-09/CCR/M1_100846_CCR_V1_0_0.xml -xsl M1-ccr_qrda.xsl -out /home/vademo4-09/QRDA/M1-PAT_100846_QRDA_V1_0_0.xml
+xalan -in /home/vademo4-09/CCR/M1_100847_CCR_V1_0_0.xml -xsl M1-ccr_qrda.xsl -out /home/vademo4-09/QRDA/M1-PAT_100847_QRDA_V1_0_0.xml
+xalan -in /home/vademo4-09/CCR/M1_100848_CCR_V1_0_0.xml -xsl M1-ccr_qrda.xsl -out /home/vademo4-09/QRDA/M1-PAT_100848_QRDA_V1_0_0.xml
+xalan -in /home/vademo4-09/CCR/M1_100849_CCR_V1_0_0.xml -xsl M1-ccr_qrda.xsl -out /home/vademo4-09/QRDA/M1-PAT_100849_QRDA_V1_0_0.xml
+xalan -in /home/vademo4-09/CCR/M1_100850_CCR_V1_0_0.xml -xsl M1-ccr_qrda.xsl -out /home/vademo4-09/QRDA/M1-PAT_100850_QRDA_V1_0_0.xml
+xalan -in /home/vademo4-09/CCR/M1_100852_CCR_V1_0_0.xml -xsl M1-ccr_qrda.xsl -out /home/vademo4-09/QRDA/M1-PAT_100852_QRDA_V1_0_0.xml
+xalan -in /home/vademo4-09/CCR/M1_100855_CCR_V1_0_0.xml -xsl M1-ccr_qrda.xsl -out /home/vademo4-09/QRDA/M1-PAT_100855_QRDA_V1_0_0.xml
+xalan -in /home/vademo4-09/CCR/M1_100858_CCR_V1_0_0.xml -xsl M1-ccr_qrda.xsl -out /home/vademo4-09/QRDA/M1-PAT_100858_QRDA_V1_0_0.xml
