像这个示例https://plone-theming-with-diazo.readthedocs.org/en/latest/snippets_diazo/recipes/index.html#add-attributes-on-the-fly一样,我需要修改所有特定标记的类,添加一个值(在内容端)。
此规则不起作用:
<xsl:template css:match="ul.navTreeLevel0 li">
<xsl:attribute name="class"><xsl:value-of select="./@class"/> no-bullet</xsl:attribute>
</xsl:template>我想用"navTreeLevel0“类在ul内的任何li标记上添加"no-bullet”值。
重氮不会引发异常。
在相同的规则文件中,我有类似的情况,但在这种情况下可以工作:
<replace content="//div[contains(@class,'cell')]/@class">
<xsl:attribute name="class">
<xsl:if test='contains(current(),"width-3:4")'>nine large-9 columns</xsl:if>
<xsl:if test='contains(current(),"width-2:3")'>height large-8 columns</xsl:if>
<xsl:if test='contains(current(),"width-1:2")'>six large-6 columns</xsl:if>
<xsl:if test='contains(current(),"width-1:3")'>four large-4 columns</xsl:if>
<xsl:if test='contains(current(),"width-1:4")'>three large-3 columns</xsl:if>
<xsl:if test='contains(current(),"width-full")'>twelve large-12 columns</xsl:if>
</xsl:attribute>
</replace>你怎么了?维托
发布于 2013-10-11 04:48:55
这可能与我今天读到的类似问题中的原因相同:diazo xsl:template not applying when inside secondary rules file
引用那里的Diazo文档:“内联XSL指令必须直接放在根标记内,并且无条件地应用。”
显然,一些xsl也可以在根规则标记之外工作,因为代码的其他部分也可以工作。
如果你用match="obviously wrong[xsl"替换代码中的css:match="...",那么重置会引发异常吗?如果不是,那么可能的原因是您的xsl被忽略了,需要将其移动到根roles标记。
https://stackoverflow.com/questions/19300928
复制相似问题