cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From oceatoon <t.katelb...@systheo.com>
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"/>
</fd:output>

bind this to your database value.

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

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

That's it
Tibor

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: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message