3

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?

Community
  • 1
  • 1
Ross Patterson
  • 5,702
  • 20
  • 38

1 Answers1

2

The Diazo replacement for prepend css:theme is before css:theme-children, not before css:theme. Your example works with that changed.

Dan Jacka
  • 1,782
  • 1
  • 15
  • 25