我有以下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本节的第一个孩子应该是段/短语,而不是标题。请让我知道怎样才能匹配这个。
谢谢
发布于 2013-12-10 10:20:48
使用<xsl:when test="section/section[1]/*[1][self::para[phrase]]">。
https://stackoverflow.com/questions/20491401
复制相似问题