使用XSLT 1.0,是否可以根据两个“related”xml元素创建xsl:key?对xsl使用两个相关的xml元素:key
例如,我想创造出串接的值的键:
/component/section/text/table/tbody/tr/td[1]/text()
/component/section/entry/act/effectiveTime/low/@value
理想的情况下,将键看起来像出头:
test description|20161229000000
test description2|20161230000000
这些元素在这个意义上,它们共享相同的附图编号(ref_b71a6ee05ef245f1a0c3f302ca769077_pastIllness_name_*
)作为属性一个同级元素相关。
定义一个键时,需要指定一个“匹配”xpath模式和一个“使用”xpath模式。但是创建一个能够解释具有特定值的相关属性的模式似乎很困难,特别是当元素具有不同的父元素并且相关属性值对于每对相关元素不同时。
示例XML:级联基于共享属性/元素值的两个元素时
<?xml version="1.0" ?>
<component>
<section classCode="DOCSECT" moodCode="EVN">
<text mediaType="text/x-hl7-text+xml">
<table border="1">
<tbody>
<tr>
<td ID="ref_b71a6ee05ef245f1a0c3f302ca769077_pastIllness_name_1">test description</td>
<td ID="ref_b71a6ee05ef245f1a0c3f302ca769077_pastIllness_dateOfOnset_1">12/29/2016</td>
<td ID="ref_b71a6ee05ef245f1a0c3f302ca769077_pastIllness_comments_1"/>
</tr>
<tr>
<td ID="ref_b71a6ee05ef245f1a0c3f302ca769077_pastIllness_name_2">test description2</td>
<td ID="ref_b71a6ee05ef245f1a0c3f302ca769077_pastIllness_dateOfOnset_2">12/30/2016</td>
<td ID="ref_b71a6ee05ef245f1a0c3f302ca769077_pastIllness_comments_2"/>
</tr>
</tbody>
</table>
</text>
<entry>
<act classCode="ACT" moodCode="EVN">
<id extension="1206ca2c614d4d07990b0162ee99aaf1" root="2.16.840.1.113883.3.441"/>
<code nullFlavor="NA"/>
<statusCode code="completed"/>
<effectiveTime>
<low value="20161229000000"/>
<high nullFlavor="UNK"/>
</effectiveTime>
<entryRelationship inversionInd="false" typeCode="SUBJ">
<observation classCode="OBS" moodCode="EVN" negationInd="false">
<templateId root="2.16.840.1.113883.10.20.1.28"/>
<id extension="99999999" root="2.16.840.1.113883.3.441.1.50.869.51.1349970.61"/>
<code code="55607006"
codeSystem="2.16.840.1.113883.6.96"
codeSystemName="SNOMED CT" displayName="undescriptive display name"/>
<text>
<reference value="#ref_b71a6ee05ef245f1a0c3f302ca769077_pastIllness_name_1"/>
</text>
<statusCode code="completed"/>
<effectiveTime>
<low value="20161229000000"/>
</effectiveTime>
<value code="783.3" codeSystemName="ICD9" displayName="undescriptive display name">
<originalText>ref_b71a6ee05ef245f1a0c3f302ca769077_pastIllness_name_1</originalText>
</value>
<entryRelationship inversionInd="false" typeCode="REFR">
<observation classCode="OBS" moodCode="EVN">
<templateId root="2.16.840.1.113883.10.20.1.50"/>
<code code="33999-4"
codeSystem="2.16.840.1.113883.6.1"
codeSystemName="LOINC" displayName="Status"/>
<statusCode code="Completed"/>
<value code="73425007"
codeSystem="2.16.840.1.113883.6.96"
codeSystemName="SNOMED CT" displayName="InActive"/>
</observation>
</entryRelationship>
</observation>
</entryRelationship>
</act>
</entry>
<entry>
<act classCode="ACT" moodCode="EVN">
<id extension="1206ca2c614d4d07990b0162ee99aaf1" root="2.16.840.1.113883.3.441"/>
<code nullFlavor="NA"/>
<statusCode code="completed"/>
<effectiveTime>
<low value="20161230000000"/>
<high nullFlavor="UNK"/>
</effectiveTime>
<entryRelationship inversionInd="false" typeCode="SUBJ">
<observation classCode="OBS" moodCode="EVN" negationInd="false">
<templateId root="2.16.840.1.113883.10.20.1.28"/>
<id extension="99999999" root="2.16.840.1.113883.3.441.1.50.869.51.1349970.61"/>
<code code="55607006"
codeSystem="2.16.840.1.113883.6.96"
codeSystemName="SNOMED CT" displayName="undescriptive display name2"/>
<text>
<reference value="#ref_b71a6ee05ef245f1a0c3f302ca769077_pastIllness_name_2"/>
</text>
<statusCode code="completed"/>
<effectiveTime>
<low value="20161230000000"/>
</effectiveTime>
<value code="783.3" codeSystemName="ICD9" displayName="undescriptive display name2">
<originalText>ref_b71a6ee05ef245f1a0c3f302ca769077_pastIllness_name_2</originalText>
</value>
<entryRelationship inversionInd="false" typeCode="REFR">
<observation classCode="OBS" moodCode="EVN">
<templateId root="2.16.840.1.113883.10.20.1.50"/>
<code code="33999-4"
codeSystem="2.16.840.1.113883.6.1"
codeSystemName="LOINC" displayName="Status"/>
<statusCode code="Completed"/>
<value code="73425007"
codeSystem="2.16.840.1.113883.6.96"
codeSystemName="SNOMED CT" displayName="InActive"/>
</observation>
</entryRelationship>
</observation>
</entryRelationship>
</act>
</entry>
</section> </component>
那么你要定义为重点,你心里有哪些'match'哪些元素?你想如何将表格行与条目相关联? –