0
我正在使用XPath達到文本值,如輸入xml中所示。如何使用XPATH訪問此輸入中的元素
<stream>
<Services>
<ServicesSub>
<title>Parameter Calculations</title>
<list1 type="unordered-bullet">
<item>
<premier>
<link Id="1222">Sheet Size</link>
<link Id="433">Hydraulic System</link>
</premier>
</item>
<item>
<premier> Review
<link Id="342332">Diagnose</link>
Rational Approach</premier>
</item>
<item>
<premier>
<link Id="222">Process</link>
</premier>
</item>
</list1>
</ServicesSub>
<ServicesSub>
<title>Parameter Set</title>
<table TableNumber="tab1" titlesource="no-title" frame="all" pgwide="page-wide">
<tgroup cols="5" colsep="1" rowsep="1" align="left" charoff="50" char="">
<colspec ColumnName="col1" colwidth="2.77in"/>
<colspec ColumnName="col2" colwidth="1.10in"/>
<thead valign="bottom">
<row RowNumber="row1">
<entry ColumnName="col1" morerows="0" rotate="0" valign="bottom" align="center">
<ptxt>Price less</ptxt>
</entry>
<entry ColumnName="col2" morerows="0" rotate="0" valign="bottom" align="center">
<ptxt>Price more</ptxt>
</entry>
<entry ColumnName="col3" morerows="0" rotate="0" valign="bottom" align="center">
<ptxt>Open Price</ptxt>
</entry>
</row>
</thead>
<tbody valign="top">
<row RowNumber="row1">
<entry ColumnName="col1" morerows="0" rotate="0" valign="middle">
<ptxt>Sheet</ptxt>
</entry>
<entry ColumnName="col2" morerows="0" rotate="0" valign="middle" align="center">
<ptxt>Sheets1</ptxt>
</entry>
</row>
<row RowNumber="row2">
<entry ColumnName="col1" morerows="0" rotate="0" valign="middle">
<ptxt>Electric failure</ptxt>
</entry>
<entry ColumnName="col2" morerows="0" rotate="0" valign="middle" align="center">
<ptxt>Elec fails</ptxt>
</entry>
</row>
</tbody>
</tgroup>
</table>
</ServicesSub>
</Services>
</stream>
我只值位數的「價格更低」,「價格比較」,「開放價格」下的「參數設置」標題下THEAD - >列 - >條目。
我剛開始學習的XPath和XSLT ..請幫我fetchin這些值..
輸出預計:
<Value = "Price less"\>
<Value = "Price more"\>
<Value = "Open Price"\>
我想直到這個...
/stream/Services/ServicesSub/title[text() = "Parameter Set" ]/following::*
謝謝 Ramm
謝謝蒂姆。在我嘗試的表達式中,我錯過了標題之前的額外括號。是的,在「參數集」中設置後,我有重複的值和空間,因此無法完全提取數據。我如何做這些? – Ramm
如果您不能解決如何使用分組刪除重複項,那麼最好是您提出另一個問題,並在您的示例XML中顯示重複項。 –