cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brent Johnson <bljohn...@gmail.com>
Subject Re: JXTemplate Variables in Attributes
Date Thu, 09 Dec 2004 20:25:11 GMT
Ahah!  Using #{colorval/text()} didnt work - but doing a jx:set in a
choose like you suggested works like a charm.  I just did 2 chooses..
one for the background type (image or color) and one for the value. 
Then all I had to do was:

<div style="...; background-${colortype}: ${colorval};">...</div>

Thanks for the help!

- Brent

On Thu, 9 Dec 2004 20:07:57 +0100, H.vanderLinden@mi.unimaas.nl
<H.vanderLinden@mi.unimaas.nl> wrote:
> If I remember correctly, the "problem" lies in the fact that you create the
> value of the variable between the <jx:set> tags. In that case you create a
> Node. If you create it in the value attribute, you create a string or text.
> 
> You can try either of the following:
> 
> 
> 
> > <jx:set var="colorval"><jx:choose><jx:when
> > test="${colors.get(block.getColor()).startsWith('/')}">backgro
> > und-image:
> > url('${
> > colors.get(block.getColor())}')</jx:when><jx:otherwise>backgro
> > und-color:
> > ${colors.get(block.getColor())}</jx:otherwise></jx:choose></jx:set>
> > VAL = ${colorval}
> > <div style="width: 25px; height: 25px; border: 1px solid
> > white; ${colorval};">
> 
> <div style="width: 25px; height: 25px; border: 1px solid white;
> #{colorval/text()};">  (or the jexl equivalent)
> 
> Or
> 
> <jx:choose>
> <jx:when test="${colors.get(block.getColor()).startsWith('/')}">
>   <jx:set var="colorval" value="background-image:
> url('${colors.get(block.getColor())}')"/>
> </jx:when>
> <jx:otherwise>
>   <jx:set var="colorval" value="background-color:
> ${colors.get(block.getColor())}"/>
> </jx:otherwise>
> </jx:choose>
> 
> VAL = ${colorval}
> <div style="width: 25px; height: 25px; border: 1px solid white;
> ${colorval};">
> 
> 
> HTH.
> 
> Bye, Helma
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
> 
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message