You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Mac Schwarz <mc...@phil.uni-erlangen.de> on 2000/08/22 16:49:36 UTC
accessing parameter values
Hi,
I'm sticking to a problem for two weeks now. I just can't figure out how
to use the parameter values of a form in a conditional expression or an
attribut of an tag.
I'm getting the parameter value with <request:get-parameter-values
name="parametername"/>. But I can' assign as an attribute or use it in a
<xsl:if expression.
<xsl:attribute name="someattribute"><request:get-parameter-values
name="parametername"/></xsl:attribute>
won't work.
<xsl:if test="<request:get-parameter-values name="parametername"/> =
'somevalue'">
is obviously completely wrong.
But
<xsl:variable name="myvalue"><request:get-parameter-values
name="parametername"/><xsl:variable>
<xsl:attribute name="someattribute"><xsl:copy-of
select="$myvalue"></xsl:attribute>
or
<xsl:if test="$myvalue = 'somevalue'>
won't work either.
So how can I get this parameter value to use it as an attribute or a
testcondition?
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>
Re: accessing parameter values
Posted by Ricardo Rocha <ri...@apache.org>.
The request taglib already exists and is associated with
XSP pages by declaring its namespace:
<xsp:page xmlns:request="http://www.apache.org/1999/XSP/Request"
xmlns:xsp="http://www.apache.org/1999/XSP/Core">
<page>
<title>Request Example</title>
<p>
Request parameter "parm" has value
<request:get-parameter name="parm" default="N/A"/>
</p>
</page>
</xsp:page>
In general, there's a built-in taglib for each servlet object
type:
request http://www.apache.org/1999/XSP/Request
response http://www.apache.org/1999/XSP/Response
cookie http://www.apache.org/1999/XSP/Cookie
. . .
Yeb Havinga wrote:
>
> Hello
>
> I was not aware of a request tag library, so when I needed parameter
> values in my xsl I just used:
>
> <xsl:template match="showparam">
> <xsp:expr>request.getParameter("<xsl:value-of
> select="@name"/>")</xsp:expr> </xsl:template>
>
> So what happens when you try:
>
> <xsl:attribute name="someatt">
> <xsp:expr>request.getParameter("parametername")</xsp:expr>
> </xsl:attribute>
>
> Obviously, if a request library exists, this is a hint in the wrong
> direction.
>
> -- Yeb
>
> Mac Schwarz wrote:
> >
> > Hi,
> >
> > I'm sticking to a problem for two weeks now. I just can't figure out how
> > to use the parameter values of a form in a conditional expression or an
> > attribut of an tag.
> >
> > I'm getting the parameter value with <request:get-parameter-values
> > name="parametername"/>. But I can' assign as an attribute or use it in a
> > <xsl:if expression.
> >
> > <xsl:attribute name="someattribute"><request:get-parameter-values
> > name="parametername"/></xsl:attribute>
> >
> > won't work.
> >
> > <xsl:if test="<request:get-parameter-values name="parametername"/> =
> > 'somevalue'">
> >
> > is obviously completely wrong.
> >
> > But
> > <xsl:variable name="myvalue"><request:get-parameter-values
> > name="parametername"/><xsl:variable>
> > <xsl:attribute name="someattribute"><xsl:copy-of
> > select="$myvalue"></xsl:attribute>
> > or
> > <xsl:if test="$myvalue = 'somevalue'>
> >
> > won't work either.
> >
> > So how can I get this parameter value to use it as an attribute or a
> > testcondition?
> >
> > 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>
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> > For additional commands, e-mail: cocoon-users-help@xml.apache.org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: cocoon-users-help@xml.apache.org
Re: accessing parameter values
Posted by Mac Schwarz <mc...@phil.uni-erlangen.de>.
Yeb Havinga wrote:
>
> Mac Schwarz wrote:
> >
> > I'm getting the same error as trying to use the request taglib as an
> > attribute value:
> >
> > ElemTemplateElement error: Can not add xsp:expr to xsl:attribute
>
> I did a little test and got the same error. Also when trying to pass the
> value using xsl variable, I had no success:
>
> <xsp:expr>request.getParameter("aap")</xsp:expr> returned the 3rd line
> in
>
> ((Element) xspCurrentNode).setAttribute(
> "someatt",
> "request.getParameter("aap")"
> );
> in the generated java code.
>
> <request:get-parameter name="aap" default="N/A"/> returned
> ((Element) xspCurrentNode).setAttribute(
> "someatt",
> ""
> );
>
> Sorry!
>
> -- Yeb
With <xsp:attribute> I was able to assign the parameter value as an
attribute:
<input type="text" name="{@id}">
<xsp:attribute name="value">
<xsp:expr>request.getParameter("<xsl:value-of
select="@id"/>")</xsp:expr>
</xsp:attribute>
</input>
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>
Re: Plz, tell how to get 1.8dev version (how to use cvs)?
Posted by sudhi <su...@insage.com>.
U can get dev snapshot from
http://xml.apache.org/from-cvs/xml-cocoon/
HTH
Sudhi
Tagunov Anthony wrote:
>
> Hello, guys! We here like cocoon very much, all deadlines (for minor porjects luckely) are approaching, pleeeze
> HOW DO I GET LATEST VERSION OF COCOON 1.8 ?
>
> Tagunov Anthony
> NNT Telecom Russia
> (http://www.mavicanet.com)
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: cocoon-users-help@xml.apache.org
Plz, tell how to get 1.8dev version (how to use cvs)?
Posted by Tagunov Anthony <at...@nnt.ru>.
Hello, guys! We here like cocoon very much, all deadlines (for minor porjects luckely) are approaching, pleeeze
HOW DO I GET LATEST VERSION OF COCOON 1.8 ?
Tagunov Anthony
NNT Telecom Russia
(http://www.mavicanet.com)
Re: accessing parameter values
Posted by Yeb Havinga <ye...@ddnh.nl>.
1.8-dev snapshot of august #7.
dima wrote:
>
> Also, what version of Cocoon are you using?
> 1.7.4 does exactly that without any problems.
>
> cheers,
> d.
>
> On Wed, 23 Aug 2000, Yeb Havinga wrote:
>
> > Mac Schwarz wrote:
> > >
> > > I'm getting the same error as trying to use the request taglib as an
> > > attribute value:
> > >
> > > ElemTemplateElement error: Can not add xsp:expr to xsl:attribute
> >
> > I did a little test and got the same error. Also when trying to pass the
> > value using xsl variable, I had no success:
> >
> > <xsp:expr>request.getParameter("aap")</xsp:expr> returned the 3rd line
> > in
> >
> > ((Element) xspCurrentNode).setAttribute(
> > "someatt",
> > "request.getParameter("aap")"
> > );
> > in the generated java code.
> >
> > <request:get-parameter name="aap" default="N/A"/> returned
> > ((Element) xspCurrentNode).setAttribute(
> > "someatt",
> > ""
> > );
> >
> > Sorry!
> >
> > -- Yeb
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> > For additional commands, e-mail: cocoon-users-help@xml.apache.org
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: cocoon-users-help@xml.apache.org
Re: accessing parameter values
Posted by dima <di...@merlin.octarine.net>.
Also, what version of Cocoon are you using?
1.7.4 does exactly that without any problems.
cheers,
d.
On Wed, 23 Aug 2000, Yeb Havinga wrote:
> Mac Schwarz wrote:
> >
> > I'm getting the same error as trying to use the request taglib as an
> > attribute value:
> >
> > ElemTemplateElement error: Can not add xsp:expr to xsl:attribute
>
> I did a little test and got the same error. Also when trying to pass the
> value using xsl variable, I had no success:
>
> <xsp:expr>request.getParameter("aap")</xsp:expr> returned the 3rd line
> in
>
> ((Element) xspCurrentNode).setAttribute(
> "someatt",
> "request.getParameter("aap")"
> );
> in the generated java code.
>
> <request:get-parameter name="aap" default="N/A"/> returned
> ((Element) xspCurrentNode).setAttribute(
> "someatt",
> ""
> );
>
> Sorry!
>
> -- Yeb
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: cocoon-users-help@xml.apache.org
>
Re: accessing parameter values
Posted by dima <di...@merlin.octarine.net>.
I am quite sure that if you define your request parameter inside
<xsp:logic> tags and then include the result in <xsp:expr> it's going to
work just fine.
<xsp:logic>
String str = request.getParameter ("aap");
</xsp:logic>
<xsp:expr>str</xsp:expr>
I am not quite sure about the request taglib, didn't have a chance to take
a look at it yet.
hope this helps.
regards,
d
On Wed, 23 Aug 2000, Yeb Havinga wrote:
> Mac Schwarz wrote:
> >
> > I'm getting the same error as trying to use the request taglib as an
> > attribute value:
> >
> > ElemTemplateElement error: Can not add xsp:expr to xsl:attribute
>
> I did a little test and got the same error. Also when trying to pass the
> value using xsl variable, I had no success:
>
> <xsp:expr>request.getParameter("aap")</xsp:expr> returned the 3rd line
> in
>
> ((Element) xspCurrentNode).setAttribute(
> "someatt",
> "request.getParameter("aap")"
> );
> in the generated java code.
>
> <request:get-parameter name="aap" default="N/A"/> returned
> ((Element) xspCurrentNode).setAttribute(
> "someatt",
> ""
> );
>
> Sorry!
>
> -- Yeb
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: cocoon-users-help@xml.apache.org
>
Re: accessing parameter values
Posted by Yeb Havinga <ye...@ddnh.nl>.
Mac Schwarz wrote:
>
> I'm getting the same error as trying to use the request taglib as an
> attribute value:
>
> ElemTemplateElement error: Can not add xsp:expr to xsl:attribute
I did a little test and got the same error. Also when trying to pass the
value using xsl variable, I had no success:
<xsp:expr>request.getParameter("aap")</xsp:expr> returned the 3rd line
in
((Element) xspCurrentNode).setAttribute(
"someatt",
"request.getParameter("aap")"
);
in the generated java code.
<request:get-parameter name="aap" default="N/A"/> returned
((Element) xspCurrentNode).setAttribute(
"someatt",
""
);
Sorry!
-- Yeb
Re: accessing parameter values
Posted by Mac Schwarz <mc...@phil.uni-erlangen.de>.
Yeb Havinga wrote:
>
> Hello
>
> I was not aware of a request tag library, so when I needed parameter
> values in my xsl I just used:
>
> <xsl:template match="showparam">
> <xsp:expr>request.getParameter("<xsl:value-of
> select="@name"/>")</xsp:expr> </xsl:template>
>
> So what happens when you try:
>
> <xsl:attribute name="someatt">
> <xsp:expr>request.getParameter("parametername")</xsp:expr>
> </xsl:attribute>
>
> Obviously, if a request library exists, this is a hint in the wrong
> direction.
>
> -- Yeb
I'm getting the same error as trying to use the request taglib as an
attribute value:
ElemTemplateElement error: Can not add xsp:expr to xsl:attribute
<xsl:attribute name="someattribute"><request:get-parameter-values
name="parametername"/></xsl:attribute>
ElemTemplateElement error: Can not add request:get-parameter-values to
xsl:attribute
You can find the more about the request taglib if you have a look at
{cocoon cvs repository
checkout}/src/org/apache/cocoon/processor/xsp/library/java/request.xsl
There are context, cookie, global, response, session and util libs also.
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>
Re: accessing parameter values
Posted by Yeb Havinga <ye...@ddnh.nl>.
Hello
I was not aware of a request tag library, so when I needed parameter
values in my xsl I just used:
<xsl:template match="showparam">
<xsp:expr>request.getParameter("<xsl:value-of
select="@name"/>")</xsp:expr> </xsl:template>
So what happens when you try:
<xsl:attribute name="someatt">
<xsp:expr>request.getParameter("parametername")</xsp:expr>
</xsl:attribute>
Obviously, if a request library exists, this is a hint in the wrong
direction.
-- Yeb
Mac Schwarz wrote:
>
> Hi,
>
> I'm sticking to a problem for two weeks now. I just can't figure out how
> to use the parameter values of a form in a conditional expression or an
> attribut of an tag.
>
> I'm getting the parameter value with <request:get-parameter-values
> name="parametername"/>. But I can' assign as an attribute or use it in a
> <xsl:if expression.
>
> <xsl:attribute name="someattribute"><request:get-parameter-values
> name="parametername"/></xsl:attribute>
>
> won't work.
>
> <xsl:if test="<request:get-parameter-values name="parametername"/> =
> 'somevalue'">
>
> is obviously completely wrong.
>
> But
> <xsl:variable name="myvalue"><request:get-parameter-values
> name="parametername"/><xsl:variable>
> <xsl:attribute name="someattribute"><xsl:copy-of
> select="$myvalue"></xsl:attribute>
> or
> <xsl:if test="$myvalue = 'somevalue'>
>
> won't work either.
>
> So how can I get this parameter value to use it as an attribute or a
> testcondition?
>
> 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>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: cocoon-users-help@xml.apache.org