我正在使用docbook,並使用將零寬度字符插入到我的表項中的模板。這很好,但如果表項包含<para>
元素,則需要應用模板不適用。那麼,有沒有一種方法可以將模板應用於不包含<para>
的所有<entry>
?XSLT:將模板應用於不包含特定子節點的節點
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:d="http://docbook.org/ns/docbook">
<xsl:import href="urn:docbkx:stylesheet"/>
...
<xsl:template match="text()[parent::d:entry]">
<xsl:call-template name="intersperse-with-zero-spaces">
<xsl:with-param name="str" select="."/>
</xsl:call-template>
</xsl:template>
...
這是正確的。但是,最後的前後軸消...爲什麼不`d:entry [not(d:para)]/text()`,而不是? – 2011-01-12 23:59:24