3
只有在满足某些条件的情况下,我才需要向来自主题的元素添加一个类。我试过this solution,调整重氮通过更换prepend
与before
:Diazo - 有条件地向主题元素添加一个类
<before css:theme=".main" if-content="not(//*[@id='portal-column-two'])"><xsl:attribute name="class"><xsl:value-of select="//*[@class='main']/@class"/> full</xsl:attribute></before>
,但我得到了以下错误:
XSLTApplyError: xsl:attribute: Cannot add attributes to an element if children have been already added to the element.
我得到这个错误,甚至当我删除所有其他规则,例如,有只有<theme>
规则和<before>
规则。
只有在内容中没有#portal-column-two
元素时,如何才能将类添加到主题元素?