cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From oceatoon <>
Subject Re: widget value wrap as src attribute
Date Sun, 03 Apr 2005 13:25:54 GMT
Well I don't know if this is the best of solutions but it works for me 

in the model:
<fd:output id="housepath">
<fd:datatype base="string"/>

bind this to your database value.

in my template:
<ft:widget id="housepath">
        <fi:styling type="picture"/>

I added a styling in the stylesheet/forms-field-styling.xsl:
<xsl:template match="fi:output[fi:styling/@type='picture']" priority="2">
            <xsl:when test="fi:value">
                <xsl:element name="img">
                    <xsl:attribute name="src"><xsl:copy-of
                    <xsl:attribute name="height">200</xsl:attribute>
                    <xsl:attribute name="width">200</xsl:attribute>
                <img src="" height="70" width="70"/>
This builds the HTML code you want for your picture

That's it

Laxmikant Ruikar wrote:

> Hello
> I want to show some images in form. I have image name in database. I am
> using form template to show the form widgets. I have done form binding
> with java object. Everything works fine. But I want to use image name from
> widget value and show the particular image in form by using form
> templates.
> For example <img src= src='images/{[<ft:widget id="image"/>]}small.jpg'/>
> or <ft:widget id="image">
> <fi:styling type="image" class="action" src='images/{[<ft:widget
> id="image"/>]}small.jpg'/>
> </ft:widget>
> How can I solved this ?
> Regards,
> Laxmikant.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message