Reputation: 5742
I need to add a class to an element coming from the theme only if certain conditions are met. I've tried this solution, adjusted for Diazo by replacing prepend
with before
:
<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>
but I get the following error:
XSLTApplyError: xsl:attribute: Cannot add attributes to an element if children have been already added to the element.
I get that error even when I remove all other rules such that there is only the <theme>
rule and the <before>
rule.
How can I add a class to a theme element only when there is no #portal-column-two
element in the content?
Upvotes: 3
Views: 1013
Reputation: 1782
The Diazo replacement for prepend css:theme
is before css:theme-children
, not before css:theme
. Your example works with that changed.
Upvotes: 2