要消除内部 para 元素,但在 itemizedlist 中的后续 para 元素之间放置一个 br 元素,给定 xml,如下所示:
<listitem>
<para>The application of power invokes the POR state machine(PORSM). During
this time, the following registers are initialized:</para>
.
.
.
<para>In addition, the JTAG interface is disabled and the SSBD is
open.</para>
</listitem>
我写了一个模板,如下所示:
<xsl:template match="listitem/para">
<xsl:value-of select="."/>
<xsl:if test="count(./following-sibling::para) > 0">
<xsl:element name="br"/>
</xsl:if>
<xsl:apply-templates/>
</xsl:template>
我得到了 br,但重复了最初的 para 元素:
The application of power invokes the POR state machine
(PORSM). During this time, the following registers are
initialized:
<br/>The application of power invokes the POR state machine
(PORSM). During this time, the following registers are
initialized:
我知道这是一个新手问题,但是有人可以解释为什么我要重复当前的文本节点吗?
谢谢,
拉斯