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

时间:2019-03-30 04:10:08

标签: xml xslt

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

我当时想这是因为没有架构位置和xsi定义,但是当我添加它们时它们没有任何区别。我该如何解决?

test1,test11,test12,..test2,test21,..test3

我希望

的输出
for /f "delims=" %%A in ('dir /ad /b /od') do set lastfolder=%%A
echo %lastfolder%

但实际输出是:<?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>

1 个答案:

答案 0 :(得分:0)

用于代码

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