cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christian Haul <h...@dvs1.informatik.tu-darmstadt.de>
Subject Re: [RT] forms
Date Fri, 20 Jul 2001 14:14:22 GMT
On 19.Jul.2001 -- 09:17 PM, Peter Nuetzel - inglobo wrote:
> >Why do you use xalan:evaluate() to fill in the data?
> >
> 
> I need it to evaluate the XPath values of the ref attributes of the form
> controls.
> example:
> 
> <form-descriptor>
>     <instance>
>         <person>
>             <firstname>Paul</firstname>
>             <lastname/>
>         </person>
>     </instance>
>     <form>
>         <textbox ref="person/firstname">
>             <caption>First Name</caption>
>         </textbox>
>         ...
>     </form>
> </form-descriptor>
> 
> to transform this to HTML the following stylesheet may be used:
> ...
> <xsl:variable name="instance" select="/form-descriptor/instance"/>
> 
> <xsl:template match="textfield">
>      <xsl:value-of select="caption"/>
>      <input type="text" value="{xalan:evaluate(concat('$instance/',
> @ref))}">
>      </input>
> </xsl:template>
> ...
> 
> AFAIK there is no possible solution with pure XSLT. An alternative would be
> a Transformer which fills in the data.
> I think there is also some kind of intermediate format necessary which
> represents the evaluated form. I think adding the evaluated values as
> elements to the form controls like you proposed in your last mail is a nice
> solution. So you get a simple and straight XML document which may be easily
> transformed to special presentations by user stylesheets.

Would a <xsl:attribute> do it?

<xsl:template match="textfield">
     <xsl:value-of select="caption"/>
     <input type="text">
        <xsl:attribute name="value">
	   <xsl:value-of select="concat('$instance/',@ref)"/>
        </xsl:attribute>
     </input>
</xsl:template>


	Chris.

-- 
C h r i s t i a n       H a u l
haul@informatik.tu-darmstadt.de
    fingerprint: 99B0 1D9D 7919 644A 4837  7D73 FEF9 6856 335A 9E08

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


Mime
View raw message