0
我需要使用XQuery獲取元素子節點(我正在使用eXist-db)。在XQuery中獲取元素子元素
<component>
<section classCode="DOCSECT" moodCode="EVN">
<templateId root="1.3.6.1.4.1.19376.1.5.3.1.3.4"/>
<id root="2.16.840.1.113883.3.441.1.50.300011.51.26840.61" extension="a20f6b4c8538492d"/>
<code code="10164-2" displayName="HISTORY OF PRESENT ILLNESS" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC"/>
<title>History of Present Illness</title>
<text mediaType="text/x-hl7-text+xml">
<table border="1">
<thead>
<tr>
<th>Diagnosis</th>
<th>Date</th>
</tr>
</thead>
<tbody>
<tr>
<td ID="ref_9f2173a9a20b4b7989001f10616bca5e_presentIllness_diagnosis_1">Abscess Of Breast Associated With Childbirth</td>
<td ID="ref_9f2173a9a20b4b7989001f10616bca5e_presentIllness_date_1">03/20/2013</td>
</tr>
<tr>
<td ID="ref_9f2173a9a20b4b7989001f10616bca5e_presentIllness_diagnosis_5">Fibrocystic Mastopathy</td>
<td ID="ref_9f2173a9a20b4b7989001f10616bca5e_presentIllness_date_5">03/20/2013</td>
</tr>
</tbody>
</table>
</text>
</section>
</component>
需要取值爲<text>
標記。
<table border="1">
<thead>
<tr>
<th>Diagnosis</th>
<th>Date</th>
</tr>
</thead>
<tbody>
<tr>
<td ID="ref_9f2173a9a20b4b7989001f10616bca5e_presentIllness_diagnosis_1">Abscess Of Breast Associated With Childbirth</td>
<td ID="ref_9f2173a9a20b4b7989001f10616bca5e_presentIllness_date_1">03/20/2013</td>
</tr>
<tr>
<td ID="ref_9f2173a9a20b4b7989001f10616bca5e_presentIllness_diagnosis_5">Fibrocystic Mastopathy</td>
<td ID="ref_9f2173a9a20b4b7989001f10616bca5e_presentIllness_date_5">03/20/2013</td>
</tr>
</tbody>
</table>
如果我使用以下查詢,結果以<text>
標記開始。但我只需要它裏面的html內容。
return $section/text
我嘗試return $section/text/string()
和return $section/d:text/text()
,但它得到的<tr>
和<td>
值組合。
以下是不可能的,因爲有些時間<text>
包含沒有任何html標記的直接值。
return $section/text/d:table