0
我有下面的XML代碼。匹配節點的第一個孩子
<chapter>
<section>
<section level="sect2">
<title>I<content-style format="smallcaps">ntroduction to</content-style> H<content-style format="smallcaps">ong</content-style> K<content-style format="smallcaps">ong’s</content-style> A<content-style format="smallcaps">rbitration</content-style> R<content-style format="smallcaps">egime</content-style></title>
<figure><caption><para>Hong Kong White Book Image</para></caption><graphic href="HKWB2014_Part_U1.pdf"/></figure>
<para id="t2_HKWB2014_Part_U1_pgfId-2"><phrase>U1/0</phrase>This section is divided into five parts:</para>
</section>
</section>
</chapter>
這裏我需要匹配<section level="sect2">
的第一個孩子。我在章節中使用了下面的xslt條件。
<xsl:when test="./section/section[1]/para[1]/phrase">
上述聲明與我的XML代碼無關,但我想檢查xml是否像下面的格式。
--Section
--Section
--para
--phrase
節的第一個孩子應該是一個對/詞組,而不是所有權。請讓我知道我可以如何匹配這個。
謝謝