我有下面的XML代碼獲得第一前同輩和應用模板
<root>
<title num="1/2"><content-style font-style="bold">Application</content-style> (O 1 r 2)</title>
<para><content-style font-style="bold">2.</content-style>—(1) Subject to paragraph (2), these Rules apply to all proceedings in-</para>
<para>(2) These Rules do not have effect in relation to proceedings in respect of which rules have been or may be made under any written law for the specific purpose of such proceedings or in relation to any criminal proceedings.</para>
<para>(3) Where prior to the coming into operation of these Rules, reference is made in any written law to any Rules of Court that reference shall be to these Rules.</para>
</root>
及以下XSLT
<xsl:template name="para" match="para">
<xsl:choose>
<xsl:when test="./@align">
<div class="para align-{@align}">
<xsl:apply-templates/>
</div>
</xsl:when>
<xsl:otherwise>
<xsl:choose>
<xsl:when test="preceding-sibling::title[1]/@num[1]">
<xsl:apply-templates/>
</xsl:when>
<xsl:otherwise>
<div class="para">
<xsl:apply-templates/>
</div>
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
這裏的時候,我試圖運行此<xsl:when test="preceding-sibling::title[1]/@num[1]">
未正常工作預期。對於第一個para
模板應該直接適用於第二和第三段,首先應該有一個<div class="para">
,並在其內部應用模板(否則條件),但在我的情況下,所有的<xsl:when test="preceding-sibling::title[1]/@num[1]">
段越來越滿意,它直接應用模板。請讓我知道我哪裏錯了。
感謝