forrest-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thorsten Scherler <thorsten.scher...@wyona.com>
Subject Re: Best way to add repeatable code in v2/v3 (was Re: Exampleusecase)
Date Fri, 27 Jan 2006 12:24:43 GMT
El vie, 27-01-2006 a las 17:59 +0800, Gav.... escribió:
> ----- Original Message ----- 

...
> |
> | Actually since Cyriaque and yourself seem to prefer that the default
> | behavior would be non enclosing divs we can change the default
> | behavior.
> |
> | wdyt?
> 
> I have found another reason why it is best to close these divs properly.
> 
> e.g.
> 
>  <forrest:contract name="content-abstract">
>             <forrest:properties contract="content-abstract">
>               <forrest:property name="content-abstract" 
> nugget="get.abstract">
>                 <jx:import 
> uri="cocoon://#{$cocoon/parameters/getRequest}.abstract.xml"/>
>               </forrest:property>
>             </forrest:properties>
>  </forrest:contract>
> 
> If there is content to return into this content-abstract request then that 
> is fine, on pages where there may not be any content available to return, 
> then the contract is blank. This creates a <div class="abstract" /> . It so 
> happens that most style sheets I looked at give the abstract div an 'italic' 
> font-style. Because the div is not closed properly, the rest of the content 
> (content-main, content-minitoc-area etc.. ) that follows this self-closed 
> div are also outputting the 'italic' font-style.
> 
> I looked for ages as to why my main content was italic, its because I have 
> no abtract-content in the xml source to give.
> 
> I suppose one has to decide to either use a contract like this for all pages 
> or for none.

Why not check whether there is an abstract and if not omit the div?
<xsl:if test="$content-abstract/div[@class='abstract']/*">
 <xsl:copy-of 
          select="$content-abstract/div[@class='abstract']"/>
</xsl:if>

salu2
-- 
Thorsten Scherler
COO Spain
Wyona Inc.  -  Open Source Content Management  -  Apache Lenya
http://www.wyona.com                   http://lenya.apache.org
thorsten.scherler@wyona.com                thorsten@apache.org


Mime
View raw message