Index: /ccr2ccd-xslt/trunk/ccr_ccd.xsl
===================================================================
--- /ccr2ccd-xslt/trunk/ccr_ccd.xsl	(revision 768)
+++ /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>
Index: r2ccd-xslt/trunk/templates/ccdcodedvalue.xsl
===================================================================
--- /ccr2ccd-xslt/trunk/templates/ccdcodedvalue.xsl	(revision 768)
+++ 	(revision )
@@ -1,58 +1,0 @@
-﻿<?xml version="1.0" encoding="utf-8"?>
-<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="urn:hl7-org:v3" xmlns:a="urn:astm-org:CCR" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" exclude-result-prefixes="a">
-
-    <xsl:import href="cdavocablookup.xsl"/>
-    <xsl:import href="HL7OIDLookup.xsl"/>
-
-    <xsl:template name="ccdCodedValue">
-        <xsl:param name="ccrCodedDescription"/>
-        <xsl:param name="type"/>
-        <xsl:param name="domain"/>
-        <xsl:param name="nodeName">value</xsl:param>
-
-        <xsl:element name="{$nodeName}">
-            <xsl:if test="$type">
-                <xsl:attribute name="xsi:type">
-                    <xsl:value-of select="$type"/>
-                </xsl:attribute>
-            </xsl:if>
-            <xsl:attribute name="displayName">
-                <xsl:value-of select="$ccrCodedDescription/a:Text"/>
-            </xsl:attribute>
-            <xsl:choose>
-                <xsl:when test="$ccrCodedDescription/a:Code">
-                    <xsl:attribute name="code">
-                        <xsl:value-of select="$ccrCodedDescription/a:Code/a:Value"/>
-                    </xsl:attribute>
-                    <xsl:attribute name="codeSystemName">
-                        <xsl:value-of select="$ccrCodedDescription/a:Code/a:CodingSystem"/>
-                    </xsl:attribute>
-                    <xsl:attribute name="codeSystem">
-                        <xsl:call-template name="HL7OIDLookup">
-                            <xsl:with-param name="name" select="$ccrCodedDescription/a:Code/a:CodingSystem"/>
-                        </xsl:call-template>
-                    </xsl:attribute>
-                </xsl:when>
-                <xsl:when test="$domain">
-                    <xsl:attribute name="code">
-                        <xsl:call-template name="CDAVocabularyLookup">
-                            <xsl:with-param name="domain" select="$domain"/>
-                            <xsl:with-param name="ccrDescription" select="$ccrCodedDescription/a:Text"/>
-                        </xsl:call-template>
-                    </xsl:attribute>
-                    <xsl:attribute name="codeSystemName">
-                        <xsl:call-template name="CDAVocabularyCodeSystemNameLookup">
-                            <xsl:with-param name="domain" select="$domain"/>
-                        </xsl:call-template>
-                    </xsl:attribute>
-                    <xsl:attribute name="codeSystemName">
-                        <xsl:call-template name="CDAVocabularyCodeSystemLookup">
-                            <xsl:with-param name="domain" select="$domain"/>
-                        </xsl:call-template>
-                    </xsl:attribute>
-                </xsl:when>
-            </xsl:choose>
-        </xsl:element>
-
-    </xsl:template>
-</xsl:stylesheet>
Index: r2ccd-xslt/trunk/templates/ccddatetime.xsl
===================================================================
--- /ccr2ccd-xslt/trunk/templates/ccddatetime.xsl	(revision 768)
+++ 	(revision )
@@ -1,141 +1,0 @@
-﻿<?xml version="1.0" encoding="utf-8"?>
-<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="urn:hl7-org:v3" xmlns:a="urn:astm-org:CCR" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:date="http://exslt.org/dates-and-times" exclude-result-prefixes="a date">
-    <!-- Converts the CCR DateTime to CCD effectiveTime.  Only ExactDateTime is supported (both alone and in DateTimeRange). -->
-    <xsl:import href="../lib/date.format-date.template.xsl"/>
-    <xsl:template name="ccdDateTime">
-        <xsl:param name="dt"/>
-        <xsl:param name="type"/>
-        <xsl:if test="$dt">
-            <xsl:if test="$dt[1]/a:ExactDateTime">
-                <effectiveTime>
-                    <xsl:if test="$type">
-                        <xsl:attribute name="xsi:type">
-                            <xsl:value-of select="$type"></xsl:value-of>
-                        </xsl:attribute>
-                    </xsl:if>
-                    <low>
-                        <xsl:attribute name="value">
-                            <xsl:call-template name="date:format-date">
-                                <xsl:with-param name="date-time">
-                                    <xsl:value-of select="$dt[1]/a:ExactDateTime"/>
-                                </xsl:with-param>
-                                <xsl:with-param name="pattern">yyyyMMdd</xsl:with-param>
-                            </xsl:call-template>
-                        </xsl:attribute>
-                    </low>
-                    <high nullFlavor="UNK"/>
-                </effectiveTime>
-            </xsl:if>
-            <xsl:if test="$dt[1]/a:DateTimeRange">
-                <effectiveTime>
-                    <low>
-                        <xsl:attribute name="value">
-                            <xsl:call-template name="date:format-date">
-                                <xsl:with-param name="date-time">
-                                    <xsl:value-of select="$dt[1]/a:DateTimeRange/a:BeginRange/a:ExactDateTime"/>
-                                </xsl:with-param>
-                                <xsl:with-param name="pattern">yyyyMMdd</xsl:with-param>
-                            </xsl:call-template>
-                        </xsl:attribute>
-                    </low>
-                    <high>
-                        <xsl:attribute name="value">
-                            <xsl:call-template name="date:format-date">
-                                <xsl:with-param name="date-time">
-                                    <xsl:value-of select="$dt[1]/a:DateTimeRange/a:EndRange/a:ExactDateTime"/>
-                                </xsl:with-param>
-                                <xsl:with-param name="pattern">yyyyMMdd</xsl:with-param>
-                            </xsl:call-template>
-                        </xsl:attribute>
-                    </high>
-                </effectiveTime>
-            </xsl:if>
-        </xsl:if>
-    </xsl:template>
-
-    <xsl:template name="dateTime" match="a:DateTime">
-        <xsl:param name="dt" select="."/>
-        <xsl:param name="fmt">MMM dd, yyyy</xsl:param>
-        <xsl:for-each select="$dt">
-            <tr>
-                <xsl:if test="$dt/a:Type/a:Text">
-                    <td>
-                        <xsl:value-of select="a:Type/a:Text"/>:
-                    </td>
-                </xsl:if>
-                <xsl:choose>
-                    <xsl:when test="a:ExactDateTime">
-                        <td>
-                            <xsl:call-template name="date:format-date">
-                                <xsl:with-param name="date-time">
-                                    <xsl:value-of select="a:ExactDateTime"/>
-                                </xsl:with-param>
-                                <xsl:with-param name="pattern" select="$fmt"/>
-                            </xsl:call-template>
-                        </td>
-                    </xsl:when>
-                    <xsl:when test="$dt/a:Age">
-                        <td>
-                            <xsl:value-of select="$dt/a:Age/a:Value"/>
-                            <xsl:text xml:space="preserve"> </xsl:text>
-                            <xsl:value-of select="$dt/a:Age/a:Units/a:Unit"/>
-                        </td>
-                    </xsl:when>
-                    <xsl:when test="$dt/a:ApproximateDateTime">
-                        <td>
-                            <xsl:value-of select="$dt/a:ApproximateDateTime/a:Text"/>
-                        </td>
-                    </xsl:when>
-                    <xsl:when test="$dt/a:DateTimeRange">
-                        <td>
-                            <xsl:for-each select="$dt/a:DateTimeRange/a:BeginRange">
-                                <xsl:choose>
-                                    <xsl:when test="$dt/a:ExactDateTime">
-                                        <xsl:call-template name="date:format-date">
-                                            <xsl:with-param name="date-time">
-                                                <xsl:value-of select="$dt/a:ExactDateTime"/>
-                                            </xsl:with-param>
-                                            <xsl:with-param name="pattern" select="$fmt"/>
-                                        </xsl:call-template>
-                                    </xsl:when>
-                                    <xsl:when test="$dt/a:Age">
-                                        <xsl:value-of select="$dt/a:Age/a:Value"/>
-                                        <xsl:text xml:space="preserve"> </xsl:text>
-                                        <xsl:value-of select="$dt/a:Age/a:Units/a:Unit"/>
-                                    </xsl:when>
-                                    <xsl:when test="$dt/a:ApproximateDateTime">
-                                        <xsl:value-of select="$dt/a:ApproximateDateTime/a:Text"/>
-                                    </xsl:when>
-                                    <xsl:otherwise/>
-                                </xsl:choose>
-                            </xsl:for-each><xsl:text xml:space="preserve"> </xsl:text>
-                            -<xsl:text xml:space="preserve"> </xsl:text>
-                            <xsl:for-each select="$dt/a:DateTimeRange/a:EndRange">
-                                <xsl:choose>
-                                    <xsl:when test="$dt/a:ExactDateTime">
-                                        <xsl:call-template name="date:format-date">
-                                            <xsl:with-param name="date-time">
-                                                <xsl:value-of select="$dt/a:ExactDateTime"/>
-                                            </xsl:with-param>
-                                            <xsl:with-param name="pattern" select="$fmt"/>
-                                        </xsl:call-template>
-                                    </xsl:when>
-                                    <xsl:when test="$dt/a:Age">
-                                        <xsl:value-of select="$dt/a:Age/a:Value"/>
-                                        <xsl:text xml:space="preserve"> </xsl:text>
-                                        <xsl:value-of select="$dt/a:Age/a:Units/a:Unit"/>
-                                    </xsl:when>
-                                    <xsl:when test="$dt/a:ApproximateDateTime">
-                                        <xsl:value-of select="$dt/a:ApproximateDateTime/a:Text"/>
-                                    </xsl:when>
-                                    <xsl:otherwise/>
-                                </xsl:choose>
-                            </xsl:for-each>
-                        </td>
-                    </xsl:when>
-                    <xsl:otherwise/>
-                </xsl:choose>
-            </tr>
-        </xsl:for-each>
-    </xsl:template>
-</xsl:stylesheet>
Index: r2ccd-xslt/trunk/templates/ccdentity.xsl
===================================================================
--- /ccr2ccd-xslt/trunk/templates/ccdentity.xsl	(revision 768)
+++ 	(revision )
@@ -1,173 +1,0 @@
-﻿<?xml version="1.0" encoding="utf-8"?>
-<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="urn:hl7-org:v3" xmlns:a="urn:astm-org:CCR" xmlns:date="http://exslt.org/dates-and-times" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" exclude-result-prefixes="a date">
-
-    <xsl:import href="actor.xsl"/>
-    <xsl:import href="ccdcodedvalue.xsl"/>
-    <xsl:import href="ccddatetime.xsl"/>
-    <xsl:import href="cdavocablookup.xsl"/>
-
-    <xsl:template name="ccdEntity">
-        <xsl:param name="ccrActorObjectID"/>
-        <xsl:param name="personNodeName">assignedPerson</xsl:param>
-
-        <xsl:variable name="CCRActor" select="//a:ContinuityOfCareRecord/a:Actors/a:Actor[a:ActorObjectID=$ccrActorObjectID]"/>
-
-        <id>
-            <xsl:choose>
-                <xsl:when test="$CCRActor/a:IDs">
-                    <xsl:attribute name="extension">
-                        <xsl:value-of select="$CCRActor/a:IDs[1]/a:ID"/>
-                    </xsl:attribute>
-                    <xsl:attribute name="root">
-                        <xsl:value-of select="$CCRActor/a:IDs[1]/a:Type/a:Text"/>
-                    </xsl:attribute>
-                </xsl:when>
-                <xsl:otherwise>
-                    <xsl:attribute name="extension">
-                        <xsl:value-of select="$CCRActor/a:ActorObjectID"/>
-                    </xsl:attribute>
-                    <xsl:attribute name="root">
-                        <xsl:text>CCR Actor ID</xsl:text>
-                    </xsl:attribute>
-                </xsl:otherwise>
-            </xsl:choose>
-        </id>
-
-        <xsl:if test="$CCRActor/a:Organization">
-            <xsl:value-of select="$CCRActor/a:Organization/a:Name"></xsl:value-of>
-        </xsl:if>
-
-        <addr>
-            <xsl:choose>
-                <xsl:when test="$CCRActor/a:Address">
-                    <xsl:attribute name="use">
-                        <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:call-template>
-                    </xsl:attribute>
-                    <streetAddressLine>
-                        <xsl:value-of select="$CCRActor/a:Address[1]/a:Line1"/>
-                    </streetAddressLine>
-                    <city>
-                        <xsl:value-of select="$CCRActor/a:Address[1]/a:City"/>
-                    </city>
-                    <state>
-                        <xsl:value-of select="$CCRActor/a:Address[1]/a:State"/>
-                    </state>
-                    <postalcode>
-                        <xsl:value-of select="$CCRActor/a:Address[1]/a:PostalCode"/>
-                    </postalcode>
-                </xsl:when>
-                <xsl:otherwise>
-                    <streetAddressLine/>
-                </xsl:otherwise>
-            </xsl:choose>
-        </addr>
-
-        <telecom>
-            <xsl:if test="$CCRActor/a:Telephone">
-                <xsl:attribute name="use">
-                    <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:call-template>
-                </xsl:attribute>
-                <xsl:attribute name="value">
-                    <xsl:text>tel:+1-</xsl:text>
-                    <xsl:value-of select="$CCRActor/a:Telephone[1]/a:Value"/>
-                </xsl:attribute>
-            </xsl:if>
-
-        </telecom>
-
-        <xsl:if test="$CCRActor/a:Email">
-            <telecom>
-                <xsl:choose>
-                    <xsl:when test="$CCRActor/a:Telephone">
-                        <xsl:attribute name="use">
-                            <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:call-template>
-                        </xsl:attribute>
-                        <xsl:attribute name="value">
-                            <xsl:text>mailto:</xsl:text>
-                            <xsl:value-of select="$CCRActor/a:Email[1]/a:Value"/>
-                        </xsl:attribute>
-                    </xsl:when>
-                    <xsl:otherwise>
-                        <xsl:attribute name="value">Unknown</xsl:attribute>
-                    </xsl:otherwise>
-                </xsl:choose>
-            </telecom>
-        </xsl:if>
-
-        <xsl:element name="{$personNodeName}">
-            <name>
-                <xsl:call-template name="actorName">
-                    <xsl:with-param name="objID" select="$ccrActorObjectID"/>
-                </xsl:call-template>
-            </name>
-
-            <xsl:if test="a:Person/a:Gender">
-                
-                    <xsl:call-template name="ccdCodedValue">
-                        <xsl:with-param name="ccrCodedDescription" select="a:Person/a:Gender"/>
-                        <xsl:with-param name="domain" select="'AdministrativeGender'"/>
-                        <xsl:with-param name="nodeName" select="'administrativeGenderCode'"/>
-                    </xsl:call-template>
-
-                
-            </xsl:if>
-
-            <xsl:if test="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:with-param>
-                            <xsl:with-param name="pattern">yyyyMMddhhmmss</xsl:with-param>
-                        </xsl:call-template>
-                    </xsl:attribute>
-                </birthTime>
-            </xsl:if>
-        </xsl:element>
-
-        <xsl:if test="$ccrActorObjectID=/a:ContinuityOfCareRecord/a:Patient[1]/a:ActorID">
-            <xsl:if test="/a:ContinuityOfCareRecord/a:Body/a:SocialHistory/a:SocialHistoryElement[a:Type/a:Text='Marital Status']">
-                
-                    <xsl:call-template name="ccdCodedValue">
-                        <xsl:with-param name="ccrCodedDescription" select="/a:ContinuityOfCareRecord/a:Body/a:SocialHistory/a:SocialHistoryElement[a:Type/a:Text='Marital Status']/a:Description"></xsl:with-param>
-                        <xsl:with-param name="domain" select="'MaritalStatus'"/>
-                        <xsl:with-param name="nodeName" select="'maritalStatusCode'"/>
-                    </xsl:call-template>
-                
-            </xsl:if>
-
-            <xsl:if test="/a:ContinuityOfCareRecord/a:Body/a:SocialHistory/a:SocialHistoryElement[a:Type/a:Text='Language']">
-                <languageCommunication>
-                    <templateId root="2.16.840.1.113883.3.88.11.83.2" assigningAuthorityName="HITSP/C83"/>
-                    <templateId root="1.3.6.1.4.1.19376.1.5.3.1.2.1" assigningAuthorityName="IHE/PCC"/>
-                    
-                        <xsl:call-template name="ccdCodedValue">
-                            <xsl:with-param name="ccrCodedDescription" select="/a:ContinuityOfCareRecord/a:Body/a:SocialHistory/a:SocialHistoryElement[a:Type/a:Text='Language']/a:Description"></xsl:with-param>
-                            <xsl:with-param name="domain" select="'HumanLanguage'"/>
-                            <xsl:with-param name="nodeName" select="'languageCode'"/>
-                        </xsl:call-template>
-                    
-                </languageCommunication>
-            </xsl:if>
-        </xsl:if>
-
-        <xsl:if test="/a:ContinuityOfCareRecord/a:Actors/a:Actor[a:ActorObjectID=$ccrActorObjectID]/a:InternalCCRLink[a:LinkRelationship='Organization']">
-            <representedOrganization>
-                <xsl:call-template name="ccdEntity">
-                    <xsl:with-param name="ccrActorObjectID" select="/a:ContinuityOfCareRecord/a:Actors/a:Actor[a:ActorObjectID=$ccrActorObjectID]/a:InternalCCRLink[a:LinkRelationship='Organization']/a:LinkID"></xsl:with-param>
-                </xsl:call-template>
-            </representedOrganization>
-        </xsl:if>
-
-    </xsl:template>
-</xsl:stylesheet>
Index: r2ccd-xslt/trunk/templates/ccdid.xsl
===================================================================
--- /ccr2ccd-xslt/trunk/templates/ccdid.xsl	(revision 768)
+++ 	(revision )
@@ -1,15 +1,0 @@
-﻿<?xml version="1.0" encoding="utf-8"?>
-<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="urn:hl7-org:v3" xmlns:a="urn:astm-org:CCR" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" exclude-result-prefixes="a">
-    <xsl:template name="ccdID">
-        <xsl:param name="ccrObjectID"/>
-        <xsl:param name="suffix"></xsl:param>
-    
-        <id>
-            <xsl:attribute name="root">
-                <xsl:value-of select="$ccrObjectID"></xsl:value-of>
-                <xsl:value-of select="$suffix"></xsl:value-of>
-            </xsl:attribute>
-            <xsl:attribute name="extension">CCR Object ID</xsl:attribute>
-        </id>
-    </xsl:template>
-</xsl:stylesheet>
Index: r2ccd-xslt/trunk/templates/ccdmedicationfrequency.xsl
===================================================================
--- /ccr2ccd-xslt/trunk/templates/ccdmedicationfrequency.xsl	(revision 768)
+++ 	(revision )
@@ -1,56 +1,0 @@
-﻿<?xml version="1.0" encoding="utf-8"?>
-<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="urn:hl7-org:v3" xmlns:a="urn:astm-org:CCR" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" exclude-result-prefixes="a">
-    <xsl:template name="ccdMedicationFrequency">
-        <xsl:param name="frequency"/>
-        <xsl:if test="$frequency">
-            <xsl:choose>
-                <xsl:when test="$frequency/a:Value='qd'">
-                    <effectiveTime xsi:type="PIVL_TS" operator="A">
-                        <xsl:attribute name="institutionSpecified">true</xsl:attribute>
-                        <period>
-                            <xsl:attribute name="value">24</xsl:attribute>
-                            <xsl:attribute name="unit">h</xsl:attribute>
-                        </period>
-                    </effectiveTime>
-                </xsl:when>
-                <xsl:when test="$frequency/a:Value='bid'">
-                    <effectiveTime xsi:type="PIVL_TS" operator="A">
-                        <xsl:attribute name="institutionSpecified">true</xsl:attribute>
-                        <period>
-                            <xsl:attribute name="value">12</xsl:attribute>
-                            <xsl:attribute name="unit">h</xsl:attribute>
-                        </period>
-                    </effectiveTime>
-                </xsl:when>
-                <xsl:when test="$frequency/a:Value='tid'">
-                    <effectiveTime xsi:type="PIVL_TS" operator="A">
-                        <xsl:attribute name="institutionSpecified">true</xsl:attribute>
-                        <period>
-                            <xsl:attribute name="value">8</xsl:attribute>
-                            <xsl:attribute name="unit">h</xsl:attribute>
-                        </period>
-                    </effectiveTime>
-                </xsl:when>
-                <xsl:when test="$frequency/a:Value='qid'">
-                    <effectiveTime xsi:type="PIVL_TS" operator="A">
-                        <xsl:attribute name="institutionSpecified">true</xsl:attribute>
-                        <period>
-                            <xsl:attribute name="value">6</xsl:attribute>
-                            <xsl:attribute name="unit">h</xsl:attribute>
-                        </period>
-                    </effectiveTime>
-                </xsl:when>
-                <xsl:when test="$frequency/a:Value='qam'">
-                    <effectiveTime xsi:type='EIVL' operator='A'>
-                        <event code='ACM'/>
-                    </effectiveTime>
-                </xsl:when>
-                <xsl:when test="$frequency/a:Value='qpm'">
-                    <effectiveTime xsi:type='EIVL' operator='A'>
-                        <event code='PCV'/>
-                    </effectiveTime>
-                </xsl:when>
-            </xsl:choose>
-        </xsl:if>
-    </xsl:template>
-</xsl:stylesheet>
Index: r2ccd-xslt/trunk/templates/ccdstatus.xsl
===================================================================
--- /ccr2ccd-xslt/trunk/templates/ccdstatus.xsl	(revision 768)
+++ 	(revision )
@@ -1,63 +1,0 @@
-﻿<?xml version="1.0" encoding="utf-8"?>
-<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="urn:hl7-org:v3" xmlns:a="urn:astm-org:CCR" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" exclude-result-prefixes="a">
-
-    <xsl:import href="ccdcodedvalue.xsl"/>
-    
-    <xsl:template name="ccdStatus">
-        <xsl:param name="ccrStatus"/>
-
-        <entryRelationship typeCode="REFR">
-            <observation classCode="OBS" moodCode="EVN">
-                <templateId root="2.16.840.1.113883.10.20.1.50"/>
-                <!-- Problem status observation template -->
-                <code code="33999-4" codeSystem="2.16.840.1.113883.6.1" displayName="Status"/>
-                <statusCode code="completed"/>
-                <xsl:call-template name="ccdCodedValue">
-                    <xsl:with-param name="ccrCodedDescription" select="$ccrStatus"/>
-                </xsl:call-template>
-            </observation>
-        </entryRelationship>
-    </xsl:template>
-    
-    <xsl:template name="ccdStatusObservation">
-        <xsl:param name="status"/>
-        <xsl:variable name="statusText" select="$status/a:Text"></xsl:variable>
-        <xsl:choose>
-            <xsl:when test="$statusText='Active'">
-                <xsl:call-template name="ccdStatusElement">
-                    <xsl:with-param name="statusCode" select="'55561003'"></xsl:with-param>
-                    <xsl:with-param name="statusDisplayName" select="$statusText"></xsl:with-param>
-                </xsl:call-template>
-            </xsl:when>
-            <xsl:when test="$statusText='Inactive'">
-                <xsl:call-template name="ccdStatusElement">
-                    <xsl:with-param name="statusCode" select="'73425007'"></xsl:with-param>
-                    <xsl:with-param name="statusDisplayName" select="$statusText"></xsl:with-param>
-                </xsl:call-template>
-            </xsl:when>
-            <xsl:when test="$statusText='Chronic'">
-                <xsl:call-template name="ccdStatusElement">
-                    <xsl:with-param name="statusCode" select="'90734009'"></xsl:with-param>
-                    <xsl:with-param name="statusDisplayName" select="$statusText"></xsl:with-param>
-                </xsl:call-template>
-            </xsl:when>
-        </xsl:choose>
-    </xsl:template>
-
-    <xsl:template name="ccdStatusElement">
-        <xsl:param name="statusCode"/>
-        <xsl:param name="statusDisplayName"/>
-        <value>
-            <xsl:attribute name="xsi:type">CE</xsl:attribute>
-            <xsl:attribute name="code">
-                <xsl:value-of select="$statusCode"></xsl:value-of>
-            </xsl:attribute>
-            <xsl:attribute name="codeSystem">2.16.840.1.113883.6.96</xsl:attribute>
-            <xsl:attribute name="displayName">
-                <xsl:value-of select="$statusDisplayName"></xsl:value-of>
-            </xsl:attribute>
-        </value>
-    </xsl:template>
-
-</xsl:stylesheet>
-
Index: /ccr2ccd-xslt/trunk/templates/cdavocabmap.xml
===================================================================
--- /ccr2ccd-xslt/trunk/templates/cdavocabmap.xml	(revision 768)
+++ /ccr2ccd-xslt/trunk/templates/cdavocabmap.xml	(revision 769)
@@ -19,4 +19,9 @@
         <item>
             <ccrtext>Office</ccrtext>
+            <cdadisplayname>office</cdadisplayname>
+            <cdacode>WP</cdacode>
+        </item>
+        <item>
+            <ccrtext>Work</ccrtext>
             <cdadisplayname>office</cdadisplayname>
             <cdacode>WP</cdacode>
@@ -113,5 +118,5 @@
             <cdacode>UN</cdacode>
         </item>
-    </domain>
+    </domain>    
     <domain name="RouteOfAdministration" codeSystemName="HL7 Route of Administration" codeSystem="2.16.840.1.113883.5.112">
         <item>
