Re: Modify attribute based on id

espen <[email protected]>
Newsgroups gmane.comp.web.zope.plone.user
Message-ID <[email protected]>
20. aug. 2014 kl. 02:03 skrev ctheobald [via Plone] <ml-node+s293351n7572342h55-PKuAHvtXa09l57MIdRCFDg@public.gmane.org>:

> 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">. 

If your research page has its own template or it is a custom content type, I would rather use that…

maybe:
.portaltype-researchpage #content {
	somecss: here;
}

body.section-research #content {
    should: worktoo;
}

If you really want to use rulest, why not just use a custom template:
      	<theme href=«columns.html" css:if-content=«body.section-research" />

and then just wrap the content div in another (span)?
(this will make it possible to do other adjustments, too)

Espen


> 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/
> _______________________________________________ 
> Plone-Users mailing list 
> [hidden email] 
> https://lists.sourceforge.net/lists/listinfo/plone-users
> 
> 
> If you reply to this email, your message will be added to the discussion below:
> http://plone.293351.n2.nabble.com/Modify-attribute-based-on-id-tp7572342.html
> To start a new topic under General Questions, email ml-node+s293351n293352h65-PKuAHvtXa09l57MIdRCFDg@public.gmane.org 
> To unsubscribe from Plone, click here.
> NAML





--
View this message in context: http://plone.293351.n2.nabble.com/Modify-attribute-based-on-id-tp7572342p7572351.html
Sent from the General Questions mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/

_______________________________________________
Plone-Users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/plone-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.