【发布时间】:2011-05-27 08:14:58
【问题描述】:
我想在 xslt 中创建一个模板,其中包含我要匹配的标记的参数的条件。
例如:
如果我有标签<par class="class1"> 和<par class="class2">
我想创建一个这样的模板:
<xsl:template match="par">
<xsl:if test="class=class1">
<fo:block
space-before="3pt"
space-after="3pt">
<xsl:apply-templates />
</fo:block>
</xsl:if>
<xsl:otherwise>
<fo:block
space-before="10pt"
space-after="10pt">
<xsl:apply-templates />
</fo:block>
</xsl:otherwise>
</xsl:template>
但它不起作用。如何测试标签的参数?
提前致谢。
【问题讨论】:
-
如果您学习行话,您会发现更容易获得答案(无论是从这里还是从书籍和在线搜索中)。您说的是元素和属性,而不是标签和参数。