我希望使用XSLT将XML文件转换为文本文件。
我想从发布的代码中提取以下值:
老年age.patient的病人又患了另一种癌症,或者他的一个家庭患了癌症。患者来自非洲-加勒比和非洲人后裔,而非亚洲裔男性,前列腺癌是常见的。最近的研究表明肥胖和前列腺癌之间可能有联系。
<event>
<date key="time:timestamp" value="2018-02-04T19:16:55.290-0500"/>
<string key="concept:name" value="history"/>
<string key="lifecycle:transition" value="start"/>
<string key="lifecycle:instance" value="9.1"/>
<string key="org:resource" value="PA-014e485a-16c6-4cf5-9ade-cdf6f17c69bb"/>
<string key="history2" value="patient in old age"/>
<string key="history1" value="patient has another cancer or one of his family has cancer"/>
<string key="history3" value="patient comes from African-Caribbean and African descent than in men of Asian descen which prostate cancer is common"/>
<string key="history4" value="obesity recent research suggests that there may be a link between obesity and prostate cancer"/>
</event>发布于 2018-02-05 04:35:44
用这个:
<xsl:template match="event">
<xsl:value-of select="descendant-or-self::string[starts-with(@key, 'history')]/@value" separator=". "/>
<xsl:text>.</xsl:text>
</xsl:template>参见http://xsltransform.net/aiwQ3v的转换
带有命名空间http://xsltransform.net/6q1R79D/1的问题的更新转换
https://stackoverflow.com/questions/48614530
复制相似问题