I made a theme based on plonetheme.barceloneta copying over the original index.html and including ++theme++barceloneta/rules.xml - which turned out to be quite a good solution.
Now for the integration of ad placements from google display network i registered some placeholder viewlets.
My plan now would be adding rules to replace the placeholders with the actual ad server snippets. Diazo should allow me to choose which snippet i want to insert, based on the body class for the section and the identifier of the placeholder.
for example
<replace css:content-children=".section_header_adspace">
<div>
html snippet for section above
</div>
</replace>
problem is that it doesn't work for the placeholder which is registered for IBelowContent
<replace css:content-children=".below_content_adspace">
<div>
html snippet for below content
</div>
</replace>
I guess, you have a problem regarding the order of execution of statements. Maybe IBelowContent is copied from the content to theme before you are making the replacement.
Try placing your replacement rule before you replace the theme's main content area (although the order of statements in a diazo rules file doesn't say much).
And try using method="raw":
<replace method="raw" css:content-children=".below_content_adspace">
<div>
html snippet for below content
</div>
</replace>
Sadly, when you have reach this point, the only way I know to sort it out is to analyse the XSL produced by Diazo and try to find out what is the problem: bin/diazocompiler rules.xml theme.html > out.xsl
(and to test your xsl: bin/diazorun out.xsl some_content.html
)
i still guess that this has something to do with the order of execution. if the content-area, including the IBelowContent viewlet area is copied before your manipulation of .below_content_adspace is done, your manipulation will of course have no effect.
maybe you can copy your content with a <drop theme-children="THEMECONTENTAREA"/> and a <after theme-children="THEMECONTENTAREA" content-children="CONTENTCONTENTAREA"/>. something like that.
XSLT is not an imperative procedural language (like python), but a recursive functional language. Yes, it explodes your head if you're spending 99% of your brain time in imperative mode and then have to debug XSLT. https://msdn.microsoft.com/en-us/library/bb669144.aspx
Having multiple transform steps/layers is a nice idea, indeed. But <xsl:include> isn't the way to do that - that's XSL core and cannot be used to create different transform rounds. Diazo is applied via plone.transformchain and for that to work, another diazo transform has to be registered.
Hi Johannes,
This is something that I've already found in there when I jump into the theme development. Maybe someone else knows why it's there. Indeed, if it helps in building a bullet proof way of inherit things it's worth to explore what it would mean not to use "raw" in that rule. BTW, this would require testing too.
However, I've always thought (others too) that you should inherit things only when you does not require big changes or big customizations. The barceloneta rules.xml file it's not that big and it's very simple, so it's easy to drop it into your new theme as a start point.
Some also proposed (@simahawk and @MrTango) to use barceloneta practices as a template included in the good known package generators or use bower or npm to pull them. I think it's something worth to explore as well.