繁体   English   中英

如何使用xslt检索HL7的节点地址值

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

我试图从我的CDA文档中检索地址值,但是,当我编写XSLT代码并在xml文档上运行转换时,我只得到没有任何值的地址标签。

我以为是因为没有架构位置和xsi定义,但是当我添加它们时它们没有任何区别。 我怎样才能解决这个问题?

<?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>

我希望输出

<?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/>

但实际输出是: <?xml version="1.0" encoding="UTF-8"?><addr/>

用于代码

    <?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>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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