SessionTransformer questions

2002-10-30 Thread Alex Romayev
Hello,
I have a couple of questions on how to use
SessionTransformer:

1. I have a multiple select, which is being
submitted by a form, so that my request string looks
like:
my-action?selectItem=1selectItem=2selectItem=3...
 
Does anyone know how I could retrieve all of the
selectItem request paramters?  I've tried (just to
see what happens):
 
session:getxml context=request
path=/parameter/selectItem/, and this just gets the
first selectItem parameter (id=1).
 
What I would like to get is:
items
 item id=1/
 item id=2/
 item id=3/
/items
 
2. I would like to set an attribute with the value of
a request parameter.  I understand, that if I were to
set an element I would do something like:
 
item
 idsession:getxml context=request
path=/parameter/id//id
/item
 
However, what I would like to do is:
item id=the value of id request parameter/
 
Does anyone know if this is possible, or if not, what
are the typical workarounds?
 
Thanks,
-Alex

-
Please check that your question  has not already been answered in the
FAQ before posting. http://xml.apache.org/cocoon/faq/index.html

To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail:   [EMAIL PROTECTED]




RE: SessionTransformer questions

2002-10-30 Thread Carsten Ziegeler


 -Original Message-
 From: Alex Romayev [mailto:romayev;yahoo.com]
 Sent: Wednesday, October 30, 2002 12:30 PM
 To: [EMAIL PROTECTED]
 Subject: SessionTransformer questions
 
 
 Hello,
 I have a couple of questions on how to use
 SessionTransformer:
 
 1. I have a multiple select, which is being
 submitted by a form, so that my request string looks
 like:
 my-action?selectItem=1selectItem=2selectItem=3...
  
 Does anyone know how I could retrieve all of the
 selectItem request paramters?  I've tried (just to
 see what happens):
  
 session:getxml context=request
 path=/parameter/selectItem/, and this just gets the
 first selectItem parameter (id=1).
  
 What I would like to get is:
 items
  item id=1/
  item id=2/
  item id=3/
 /items
  
Try session:getxml context=request path=/parametervalues/selectItem/


 2. I would like to set an attribute with the value of
 a request parameter.  I understand, that if I were to
 set an element I would do something like:
  
 item
  idsession:getxml context=request
 path=/parameter/id//id
 /item
  
 However, what I would like to do is:
 item id=the value of id request parameter/
  
 Does anyone know if this is possible, or if not, what
 are the typical workarounds?
  
I don't know any direct working solution, but there are
some workarounds:
a) You can use a stylesheet to transform itemxyz/item
   to item id=xyz/. 
b) You can change your markup and use itemxyz/item
c) you can write a custom component for this
So you see, these are all workarounds, no real solutions.
Carsten

-
Please check that your question  has not already been answered in the
FAQ before posting. http://xml.apache.org/cocoon/faq/index.html

To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail:   [EMAIL PROTECTED]




Re: SessionTransformer questions

2002-10-30 Thread Ludovic de Beaurepaire
I did it directly in JAVA in a xsp generator, here I add in my data some
request parameters already formatted in XML :
if my request has the following parameters :
SrvImpNomMaquette=mqt1SrvImpData=data1/SrvImpNomMaquette=mqt2SrvImpData
=data2/
it generates :
maquettes
 maquette nom=mqt1
   data1/
 /maquette
 maquette nom=mqt2
   data2/
 /maquette
/maquettes

See the code below :

?xml version=1.0 encoding=ISO-8859-1?
xsp:page language=java xmlns:xsp=http://apache.org/xsp;
xsp:structure
  xsp:includejava.net.*/xsp:include

xsp:includeorg.apache.cocoon.components.language.markup.xsp.*/xsp:include

/xsp:structure

maquettes
xsp:logic
 String [] lstNomMaquette = request.getParameterValues(SrvImpNomMaquette);
 String [] lstData = request.getParameterValues(SrvImpData);
 String nomMaquette;
 String data;
 if(lstNomMaquette != null)
 {
  for(int i=0; i lt; lstNomMaquette.length; i++)
  {
   nomMaquette = lstNomMaquette[i];
   data = URLDecoder.decode(lstData[i]);

   xspAttr.addAttribute(,nom,nom,CDATA,nomMaquette);
   this.contentHandler.startElement(,maquette,maquette,xspAttr);
   xspAttr.clear();
   XSPObjectHelper.xspExpr(this.contentHandler,data);
   this.contentHandler.endElement(,maquette,maquette);
  }
 }
/xsp:logic
/maquettes
/xsp:page

ludovic

- Original Message -
From: Alex Romayev [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, October 30, 2002 12:29 PM
Subject: SessionTransformer questions


 Hello,
 I have a couple of questions on how to use
 SessionTransformer:

 1. I have a multiple select, which is being
 submitted by a form, so that my request string looks
 like:
 my-action?selectItem=1selectItem=2selectItem=3...

 Does anyone know how I could retrieve all of the
 selectItem request paramters?  I've tried (just to
 see what happens):

 session:getxml context=request
 path=/parameter/selectItem/, and this just gets the
 first selectItem parameter (id=1).

 What I would like to get is:
 items
  item id=1/
  item id=2/
  item id=3/
 /items

 2. I would like to set an attribute with the value of
 a request parameter.  I understand, that if I were to
 set an element I would do something like:

 item
  idsession:getxml context=request
 path=/parameter/id//id
 /item

 However, what I would like to do is:
 item id=the value of id request parameter/

 Does anyone know if this is possible, or if not, what
 are the typical workarounds?

 Thanks,
 -Alex

 -
 Please check that your question  has not already been answered in the
 FAQ before posting. http://xml.apache.org/cocoon/faq/index.html

 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail:   [EMAIL PROTECTED]





-
Please check that your question  has not already been answered in the
FAQ before posting. http://xml.apache.org/cocoon/faq/index.html

To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail:   [EMAIL PROTECTED]