简体   繁体   中英

How do I retrieve address values of a node for HL7 using xslt

I am trying to retrieve an address value from my CDA document however, when I write the XSLT code and run the transformation on the xml document, I only get the address tag without any values.

I was thinking it was because there was no schema location and xsi defined but those did not make any difference when I added them. How can I fix this?

<?xml version="1.0"?>
<!--This is where I thought the problem was occurring, here I tried using this xml styling reference -->
<?xml-stylesheet type="text/xsl" href="CDA.xsl"?>
<ClinicalDocument>
    <realmCode code="US"/>
    <typeId root="2.16.840.1.113883.1.3" extension="POCD_HD000040"/>
    <!-- US General Header Template -->
    <templateId root="2.16.840.1.113883.10.20.22.1.1"/>
    <!-- *** Note:  The next templateId, code and title will differ depending on what type of document is being sent. *** -->
    <!-- conforms to the document specific requirements  -->
    <templateId root="2.16.840.1.113883.10.20.22.1.4"/>
    <id extension="999021" root="2.16.840.1.113883.19"/>
    <code codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC" code="11488-4" displayName="Consultation Note"/>
    <title>Consultation Note</title>
    <effectiveTime value="20050329171504+0500"/>
    <confidentialityCode code="N" codeSystem="2.16.840.1.113883.5.25"/>
    <languageCode code="en-US"/>
    <setId extension="111199021" root="2.16.840.1.113883.19"/>
    <versionNumber value="1"/>
    <recordTarget>
        <patientRole>
            <id extension="12345" root="2.16.840.1.113883.19"/>
            <!-- Fake ID using HL7 example OID. -->
            <id extension="111-00-1234" root="2.16.840.1.113883.4.1"/>
            <!-- Fake Social Security Number using the actual SSN OID. -->
            <addr use="HP">
                <!-- HP is "primary home" from codeSystem 2.16.840.1.113883.5.1119 -->
                <streetAddressLine>17 Daws Rd.</streetAddressLine>
                <city>Blue Bell</city>
                <state>MA</state>
                <postalCode>02368</postalCode>
                <country>US</country>
                <!-- US is "United States" from ISO 3166-1 Country Codes: 1.0.3166.1 -->
            </addr>
            <telecom value="tel:(781)555-1212" use="HP"/>
            <!-- HP is "primary home" from HL7 AddressUse 2.16.840.1.113883.5.1119 -->
            <patient>

I expect the output of

<?xml version="1.0" encoding="UTF-8"? <addr><streetAddressLine>17 Daws Rd.</streetAddressLine>
                <city>Blue Bell</city>
                <state>MA</state>
                <postalCode>02368</postalCode>
                <country>US</country><addr/>

but the actual output is: <?xml version="1.0" encoding="UTF-8"?><addr/>

Use for code

    <?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    exclude-result-prefixes="xs"
    version="1.0">
    <xsl:output method="xml" encoding="UTF-8" indent="yes" omit-xml-declaration="yes"/>
    <xsl:strip-space elements="*"/>
    <xsl:template match="@*|node()">
        <xsl:copy>
            <xsl:apply-templates select="@*|node()"/>
        </xsl:copy>
    </xsl:template>
    <xsl:template match="ClinicalDocument">
        <xsl:apply-templates select="//addr"/>
    </xsl:template>
    <xsl:template match="//addr">
        <addr>
            <xsl:apply-templates select="@*|node()"/>
        </addr>
    </xsl:template>
    <xsl:template match="addr/@use"/>
</xsl:stylesheet>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM