Index: ccr2ccd-xslt/trunk/ccr_ccd.xsl
===================================================================
--- ccr2ccd-xslt/trunk/ccr_ccd.xsl	(revision 766)
+++ ccr2ccd-xslt/trunk/ccr_ccd.xsl	(revision 769)
@@ -100,10 +100,10 @@
             </author>
 
-            <xsl:if test="/a:ContinuityOfCareRecord/a:Actors/a:Actor[a:ActorObjectID=$fromID]/a:InternalCCRLink[a:LinkRelationship='Organization']">
+            <xsl:if test="/a:ContinuityOfCareRecord/a:Actors/a:Actor[a:ActorObjectID=$fromID]/a:InternalCCRLink[a:LinkRelationship='representedOrganization']">
                 <custodian>
                     <assignedCustodian>
                         <representedCustodianOrganization>
                             <xsl:call-template name="ccdEntity">
-                                <xsl:with-param name="ccrActorObjectID" select="/a:ContinuityOfCareRecord/a:Actors/a:Actor[a:ActorObjectID=$fromID]/a:InternalCCRLink[a:LinkRelationship='Organization']/a:LinkID"></xsl:with-param>
+                                <xsl:with-param name="ccrActorObjectID" select="/a:ContinuityOfCareRecord/a:Actors/a:Actor[a:ActorObjectID=$fromID]/a:InternalCCRLink[a:LinkRelationship='representedOrganization']/a:LinkID"></xsl:with-param>
                             </xsl:call-template>
                         </representedCustodianOrganization>
@@ -1747,5 +1747,5 @@
         <xsl:param name="personNodeName">assignedPerson</xsl:param>
 
-        <xsl:variable name="CCRActor" select="//a:ContinuityOfCareRecord/a:Actors/a:Actor[a:ActorObjectID=$ccrActorObjectID]"/>
+        <xsl:variable name="CCRActor" select="/a:ContinuityOfCareRecord/a:Actors/a:Actor[a:ActorObjectID=$ccrActorObjectID]"/>
 
         <id>
@@ -1780,5 +1780,5 @@
                         <xsl:call-template name="CDAVocabularyLookup">
                             <xsl:with-param name="domain" select="'telecommunicationsAddressUse'"/>
-                            <xsl:with-param name="ccrDescription" select="$CCRActor/a:Address/a:Type/a:Text"/>
+                            <xsl:with-param name="ccrtext" select="$CCRActor/a:Address[1]/a:Type/a:Text"/>
                         </xsl:call-template>
                     </xsl:attribute>
@@ -1807,5 +1807,5 @@
                     <xsl:call-template name="CDAVocabularyLookup">
                         <xsl:with-param name="domain" select="'telecommunicationsAddressUse'"/>
-                        <xsl:with-param name="ccrDescription" select="$CCRActor/a:Telephone/a:Type/a:Text"/>
+                        <xsl:with-param name="ccrtext" select="$CCRActor/a:Telephone/a:Type/a:Text"/>
                     </xsl:call-template>
                 </xsl:attribute>
@@ -1825,5 +1825,5 @@
                             <xsl:call-template name="CDAVocabularyLookup">
                                 <xsl:with-param name="domain" select="'telecommunicationsAddressUse'"/>
-                                <xsl:with-param name="ccrDescription" select="$CCRActor/a:Telephone/a:Type/a:Text"/>
+                                <xsl:with-param name="ccrtext" select="$CCRActor/a:Telephone/a:Type/a:Text"/>
                             </xsl:call-template>
                         </xsl:attribute>
@@ -1840,38 +1840,38 @@
         </xsl:if>
 
-        <xsl:if test="a:Person">
+        <xsl:if test="$CCRActor/a:Person">
             <xsl:element name="{$personNodeName}">
                 <name>
-                    <xsl:if test="a:Person/a:Name/a:CurrentName/a:Title">
+                    <xsl:if test="$CCRActor/a:Person/a:Name/a:CurrentName/a:Title">
                         <prefix>
-                            <xsl:value-of select="a:Person/a:Name/a:CurrentName/a:Title"></xsl:value-of>
+                            <xsl:value-of select="$CCRActor/a:Person/a:Name/a:CurrentName/a:Title"></xsl:value-of>
                         </prefix>
                     </xsl:if>
-                    <xsl:if test="a:Person/a:Name/a:CurrentName/a:Given">
+                    <xsl:if test="$CCRActor/a:Person/a:Name/a:CurrentName/a:Given">
                         <given>
-                            <xsl:value-of select="a:Person/a:Name/a:CurrentName/a:Given"></xsl:value-of>
+                            <xsl:value-of select="$CCRActor/a:Person/a:Name/a:CurrentName/a:Given"></xsl:value-of>
                         </given>
                     </xsl:if>
-                    <xsl:if test="a:Person/a:Name/a:CurrentName/a:Middle">
+                    <xsl:if test="$CCRActor/a:Person/a:Name/a:CurrentName/a:Middle">
                         <given>
-                            <xsl:value-of select="a:Person/a:Name/a:CurrentName/a:Middle"></xsl:value-of>
+                            <xsl:value-of select="$CCRActor/a:Person/a:Name/a:CurrentName/a:Middle"></xsl:value-of>
                         </given>
                     </xsl:if>
-                    <xsl:if test="a:Person/a:Name/a:CurrentName/a:Family">
+                    <xsl:if test="$CCRActor/a:Person/a:Name/a:CurrentName/a:Family">
                         <family>
-                            <xsl:value-of select="a:Person/a:Name/a:CurrentName/a:Family"></xsl:value-of>
+                            <xsl:value-of select="$CCRActor/a:Person/a:Name/a:CurrentName/a:Family"></xsl:value-of>
                         </family>
                     </xsl:if>
-                    <xsl:if test="a:Person/a:Name/a:CurrentName/a:Suffix">
+                    <xsl:if test="$CCRActor/a:Person/a:Name/a:CurrentName/a:Suffix">
                         <suffix>
-                            <xsl:value-of select="a:Person/a:Name/a:CurrentName/a:Suffix"></xsl:value-of>
+                            <xsl:value-of select="$CCRActor/a:Person/a:Name/a:CurrentName/a:Suffix"></xsl:value-of>
                         </suffix>
                     </xsl:if>
                 </name>
 
-                <xsl:if test="a:Person/a:Gender">
+                <xsl:if test="$CCRActor/a:Person/a:Gender">
 
                     <xsl:call-template name="ccdCodedValue">
-                        <xsl:with-param name="ccrCodedDescription" select="a:Person/a:Gender"/>
+                        <xsl:with-param name="ccrCodedDescription" select="$CCRActor/a:Person/a:Gender"/>
                         <xsl:with-param name="domain" select="'AdministrativeGender'"/>
                         <xsl:with-param name="nodeName" select="'administrativeGenderCode'"/>
@@ -1879,10 +1879,10 @@
                 </xsl:if>
 
-                <xsl:if test="a:Person/a:DateOfBirth">
+                <xsl:if test="$CCRActor/a:Person/a:DateOfBirth">
                     <birthTime>
                         <xsl:attribute name="value">
                             <xsl:call-template name="date:format-date">
                                 <xsl:with-param name="date-time">
-                                    <xsl:value-of select="a:Person/a:DateOfBirth/a:ExactDateTime"/>
+                                    <xsl:value-of select="$CCRActor/a:Person/a:DateOfBirth/a:ExactDateTime"/>
                                 </xsl:with-param>
                                 <xsl:with-param name="pattern">yyyyMMddhhmmss</xsl:with-param>
