Modify attribute based on id
Chuck Theobald <[email protected]>
| Newsgroups | gmane.comp.web.zope.plone.user |
|---|---|
| Message-ID | <[email protected]> |
I would like to selectively apply a css class definition to an element
based on the path. For instance, I have a Research page that I would
like formatted in two columns rather than one. In this case, then, I
want to apply/add class="two-column" to the content element <div
id="content-core">.
I have found leads toward an xsl solution, but have not gotten it to work:
http://docs.plone.org/external/diazo/docs/recipes/adding-an-attribute/index.html
I've modified the given code as follows, but this severely breaks the
theming:
<xsl:template match="div#content-core">
<xsl:copy>
<xsl:attribute name="class">two-column</xsl:attribute>
<xsl:copy-of select="@*" />
<xsl:apply-templates />
</xsl:copy>
</xsl:template>
I've also tried variations of the following without success:
<replace css:content="div#content-core">
<class="two-column"></class>
</replace>
<copy attributes="class" css:content="#content-core"
if-path="research" theme='//*[@class="two-column"]' />
Thank you,
--
Chuck Theobald
System Administrator
The Robert and Beverly Lewis Center for Neuroimaging
University of Oregon
P: 541-346-0343
F: 541-346-0345
------------------------------------------------------------------------------
Slashdot TV.
Video for Nerds. Stuff that matters.
http://tv.slashdot.org/