cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mac Schwarz <mcsch...@phil.uni-erlangen.de>
Subject Re: setting a variable
Date Tue, 22 Aug 2000 19:10:31 GMT
Jeremy Quinn wrote:
> 
> At 17:05 +0200 21/08/00, Mac Schwarz wrote:
> >I'm trying to get a parameter value after a form submission to insert it
> >into a input field.
> >
> > <xsl:template match="gap">
> >    <xsl:variable name="guess"><request:get-parameter-values
> >name="{@id}"/></xsl:variable>
> >    <input type="text" size="{string-length(.)}" name="{@id}">
> >      <xsl:attribute name="value"><xsl:copy-of
> >select="$guess"/></xsl:attribute>
> >  </input>
> >  </xsl:template>
> 
> sorry if I misunderstand the problem, but does this work?
> 
>         <xsl:template match="gap">
>                 <input type="text" size="{string-length(.)}" name="{@id}">
>                         <xsl:attribute name="value">
>                                 <request:get-parameter-values name="{@id}"/>
>                         </xsl:attribute>
>                 </input>
>         </xsl:template>
> 
> Another thing, it might be safer to use <request:get-parameter
> name="{@id}"/> if you want to put it into the attribute,
> <request:get-parameter-values name="{@id}"/> could return a list ....
> 
> hope this helps
> 
> regards Jeremy


I think you understood the problem correctly but unfortunately your
suggestion won't work for me.

I'm getting following error if I try to use the
<request:get-parameter... with the attribute expression:

ElemTemplateElement error: Can not add request:get-parameter-values to
xsl:attribute

Same error if I'd try to use a xsp:expression like

<xsl:attribute
name="value"><xsp:expr>request.getParameter("parametername")</xsp:expr></xsl:attribute>

ElemTemplateElement error: Can not add xsp:expr to xsl:attribute

And if I want to use a value in a conditional expression like

<xsl:if test="ValueOfMyParameter == TheDesiredValue"> I couldn't use
<request:get-parameter...> for the ValueOfMyParameter either. Thus the
workaround with the xsl variable.

In fact I got the idea of using xsl variables and copy-of from an answer
to your question reqarding a taglib to set a variable:

<URL:http://archives2.real-time.com/rte-cocoon/2000/Jun/msg00255.html>

I can set  and display the variable with the parameter value e.g. with
"Variable value: <xsl:copy-of select="$guess"/> but I'm not able to use
it in the context of a attribute or a test condition.

I think it has do do with the sequence of taglib execution and the xsl
transformation but I don't know exacly how. 
And I don't know either hot to get the value of the parameter for the
use described above.

Regards,
	mac

-- 
Mac Schwarz / AERIA Projekt / Inst. f. Klassische Archaeologie
e-mail: mac@aeria.phil.uni-erlangen.de  / Tel.: 09131-85-24791
 FAU Erlangen-Nuernberg   /   Kochstr.4   /   91054 Erlangen
  <http://www.phil.uni-erlangen.de/~p1altar/aeriahome.html>

Mime
View raw message