--- a/syntheticPatients/Pat2Indivo2.xsl Thu Sep 30 12:15:04 2010 -0400
+++ b/syntheticPatients/Pat2Indivo2.xsl Sat Oct 02 16:16:16 2010 -0400
@@ -1,26 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Id: Pat2rdf.xsl,v 1.23 2009/11/30 03:42:28 eric Exp $ -->
-<xsl:stylesheet
- version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://indivo.org/vocab/xml/documents#">
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns="http://indivo.org/vocab/xml/documents#">
<xsl:output method="xml" indent='yes' encoding='utf-8'
omit-xml-declaration="yes"
-media-type="application/rdf+xml" version="1.0"/>
+media-type="application/indivo+xml" version="1.0"/>
<xsl:template match="/root">
<xsl:comment> -*- XML -*- </xsl:comment><xsl:processing-instruction name="xml-stylesheet"><xsl:text>type="text/xsl" href="Patrdf2html.xsl"</xsl:text></xsl:processing-instruction>
<Envelope>
<CurrentStatus>
- <xsl:copy-of select="Contact"/>
+ <xsl:apply-templates mode="copyToDefaultNS" select="Contact"/>
<xsl:apply-templates select="Practice"/>
- <xsl:copy-of select="Demographics"/>
+ <xsl:apply-templates mode="copyToDefaultNS" select="Demographics"/>
<xsl:apply-templates select="prescriptions"/>
<xsl:apply-templates select="conditions"/>
<xsl:apply-templates select="procedures"/>
<xsl:apply-templates select="allergies"/>
<xsl:apply-templates select="immunizations"/>
- <xsl:copy-of select="lifestyle"/>
- <xsl:copy-of select="familyHistory"/>
+ <xsl:apply-templates mode="copyToDefaultNS" select="lifestyle"/>
+ <xsl:apply-templates mode="copyToDefaultNS" select="familyHistory"/>
</CurrentStatus>
<xsl:apply-templates select="Encounter"/>
</Envelope>
@@ -29,19 +30,19 @@
<xsl:template match="Practice">
<PrimaryCarePhysician>
<name>
- <xsl:copy-of select="primaryCarePhysician/fullName"/>
- <xsl:copy-of select="primaryCarePhysician/givenName"/>
- <xsl:copy-of select="primaryCarePhysician/familyName"/>
+ <xsl:apply-templates mode="copyToDefaultNS" select="primaryCarePhysician/fullName"/>
+ <xsl:apply-templates mode="copyToDefaultNS" select="primaryCarePhysician/givenName"/>
+ <xsl:apply-templates mode="copyToDefaultNS" select="primaryCarePhysician/familyName"/>
</name>
<address>
- <xsl:copy-of select="practiceAddress/streetAddress"/>
- <xsl:copy-of select="practiceAddress/postalCode"/>
- <xsl:copy-of select="practiceAddress/locality"/>
- <xsl:copy-of select="practiceAddress/region"/>
- <xsl:copy-of select="practiceAddress/country"/>
- <xsl:copy-of select="practiceAddress/timeZone"/>
+ <xsl:apply-templates mode="copyToDefaultNS" select="practiceAddress/streetAddress"/>
+ <xsl:apply-templates mode="copyToDefaultNS" select="practiceAddress/postalCode"/>
+ <xsl:apply-templates mode="copyToDefaultNS" select="practiceAddress/locality"/>
+ <xsl:apply-templates mode="copyToDefaultNS" select="practiceAddress/region"/>
+ <xsl:apply-templates mode="copyToDefaultNS" select="practiceAddress/country"/>
+ <xsl:apply-templates mode="copyToDefaultNS" select="practiceAddress/timeZone"/>
</address>
- <xsl:copy-of select="practiceAddress/phoneNumber"/>
+ <xsl:apply-templates mode="copyToDefaultNS" select="practiceAddress/phoneNumber"/>
</PrimaryCarePhysician>
</xsl:template>
@@ -77,7 +78,7 @@
</xsl:attribute>
</unit>
</strength>
- <xsl:copy-of select="frequency"/>
+ <xsl:apply-templates mode="copyToDefaultNS" select="frequency"/>
</medication>
<prescribedBy>
<name><xsl:value-of select="prescribedBy"/></name>
@@ -103,7 +104,7 @@
<xsl:value-of select="diagnosedWith"/>
</name>
<comments><xsl:value-of select="physicianNotes"/></comments>
- <xsl:copy-of select="diagnosedBy"/>
+ <xsl:apply-templates mode="copyToDefaultNS" select="diagnosedBy"/>
</Problem>
</xsl:for-each>
</Conditions>
@@ -148,7 +149,7 @@
<xsl:for-each select="child::*">
<Immunization>
<dateAdministered><xsl:value-of select="date"/>-01-01T00:00:00</dateAdministered>
- <xsl:copy-of select="administeredBy"/>
+ <xsl:apply-templates mode="copyToDefaultNS" select="administeredBy"/>
<vaccine>
<type><xsl:value-of select="name(.)"/></type>
<manufacturer></manufacturer>
@@ -180,7 +181,7 @@
<!-- xsl:for-each select="child::*">
<Immunization>
<dateAdministered><xsl:value-of select="date"/>-01-01T12:00:00</dateAdministered>
- <xsl:copy-of select="administeredBy"/>
+ <xsl:apply-templates mode="copyToDefaultNS" select="administeredBy"/>
<vaccine>
<type><xsl:value-of select="name(.)"/></type>
<manufacturer></manufacturer>
@@ -296,4 +297,19 @@
</HCLSresult>
</xsl:template>
+<!-- Utility functions -->
+<xsl:template mode="copyToDefaultNS" match="*">
+ <xsl:element name="{local-name()}">
+ <xsl:apply-templates mode="copyToDefaultNS" select="@*"/>
+ <xsl:apply-templates mode="copyToDefaultNS"/>
+ </xsl:element>
+</xsl:template>
+
+<xsl:template mode="copyToDefaultNS" match="@*">
+ <xsl:attribute name="{local-name()}">
+ <xsl:value-of select="." />
+ </xsl:attribute>
+</xsl:template>
+
+
</xsl:stylesheet>