Thorsten Scherler a écrit :
On Tue, 2005-08-02 at 11:58 +0200, Cyriaque Dupoirieux wrote:
Anyway, here is what I think - When we put a hook in an *.fv file :
* There is a css problem if the hook is transformed into an empty
<div/> tag when generating XHTML,
* There is also a problem when we add a blank ( ) because if
the defined style has a background color, the tag <div
...> </div> appears in the page as a box with the background
color
So, the solution would be to skip the hook generation when the content
is empty.
Something like :
|<xsl:choose>
<xsl:when test="normalize-space(.)">
... Generation of div tag and content ...
</xsl:when>
<xsl:otherwise>
... Skip the generation ...
</xsl:otherwise>
</xsl:choose>|
But I don't know exactly where to put this control ?
/home/thorsten/apache/forrest-trunk/whiteboard/plugins/org.apache.forrest.plugin.internal.view/resources/stylesheets/hooksMatcher.xsl
...but it is not that easy because normally you will have
<forrest:hook name="test">
<forrest:contract name="testData"/>
</forrest:hook>
Now what you would have to do is to test whether the *transfomed*
presentation model of the contract (remember a contract is right now
only a xsl viewHelper template) will return something. You may test it
via a xsl:variable but I am not sure.
The hooksMatcher.xsl got imported in the prepare.xhtml.xsl all in the
internal view plugin.
Maybe we can do this in two phases :
* First the prepare.xhtml.sxl (including hooksMatcher.xsl) generates
what he has to generate.
* Second, another sheet clean the generated code by removing empty
div tags ?
Yes, that is a really good solution but it should be customizable. I
mean sometimes the designer would need something like:
<div class="test"> </div>
I reckon if no @nbsp is set and the content is empty it should get
removed.
WDYT?
Yes, It's exactly what I need since the beginning.
Now we just have to do this :-) .
Cyriaque,