You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Brett Palmer <pl...@hotmail.com> on 2000/05/17 21:02:25 UTC

Order of XSP elements in generated Producers?

This is really a clarification question on how XSP generates Cocoon 
Producers.

I was trying to get the same XML page processed by different stylesheets 
depending a request time parameter.  I got several errors when I tried to 
put a processing instruction near the top of the XML document.  The error 
referred to the "request" object not being defined yet.  When I moved the 
processing instruction towards the end of the XML page the error went away.

I reviewed the generated java file and noticed that in order to use the 
"request" object my code needed to be in the "populateDocument" method of 
the producer.

This is probably a basic question, but where do XSP elements need to be 
located in the XML page to be put into the "populateDocument" method?

Thanks for your help.

Brett

________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com


Re: Order of XSP elements in generated Producers?

Posted by Giacomo Pati <Gi...@pwr.ch>.
Nishit Trivedi wrote:
> 
> Brett,
> 
> I got the same damn problem...
> When i moved the root element before the first xsp starting tag i.e.
> <xsp:logic>,
> it worked fine...
> 

Have you read http://xml.apache.org/cocoon/xsp.html ? Look at chapter
"Notes on Tag Usage". This document helped me understanding XSP.

Giacomo

-- 
PWR GmbH, Organisation & Entwicklung      Tel:   +41 (0)1 856 2202
Giacomo Pati, CTO/CEO                     Fax:   +41 (0)1 856 2201
Hintereichenstrasse 7                     Mailto:Giacomo.Pati@pwr.ch
CH-8166 Niederweningen                    Web:   http://www.pwr.ch

Re: Order of XSP elements in generated Producers?

Posted by Nishit Trivedi <ni...@planet.net>.
Brett,

I got the same damn problem...
When i moved the root element before the first xsp starting tag i.e.
<xsp:logic>,
it worked fine...

below is my CORRECT code and <page> is my root element...
----------------------------------------------------------------------------
-------------
<?xml version="1.0"?>
<?xml-stylesheet href="xmlform.xsl" type="text/xsl"?>
<?cocoon-process type="xsp"?>
<?cocoon-process type="xslt"?>
<?cocoon-format type="text/html"?>

<xsp:page language="java"
xmlns:xsp="http://www.apache.org/1999/XSP/Core"

>
<page>   <!-- THIS IS MY ROOT ELEMENT -->
 <xsp:logic>
   String FirstName = request.getParameter("Fname");
   String LastName = request.getParameter("Lname");
 </xsp:logic>

<!-- THE ROOT ELEMENT WAS HERE BEFORE WHEN I GOT ERROR-->
     <p>The First Name is : <xsp:expr>FirstName</xsp:expr></p>
     <p>The Last Name is : <xsp:expr>LastName</xsp:expr></p>
</page>

</xsp:page>

------------------------------------------------------------------
try this...good luck...

Nishit
Internet Programmer
Planet Access Networks
973-691-4704 Ext:157
----- Original Message -----
From: "Brett Palmer" <pl...@hotmail.com>
To: <co...@xml.apache.org>
Sent: Wednesday, May 17, 2000 3:02 PM
Subject: Order of XSP elements in generated Producers?


> This is really a clarification question on how XSP generates Cocoon
> Producers.
>
> I was trying to get the same XML page processed by different stylesheets
> depending a request time parameter.  I got several errors when I tried to
> put a processing instruction near the top of the XML document.  The error
> referred to the "request" object not being defined yet.  When I moved the
> processing instruction towards the end of the XML page the error went
away.
>
> I reviewed the generated java file and noticed that in order to use the
> "request" object my code needed to be in the "populateDocument" method of
> the producer.
>
> This is probably a basic question, but where do XSP elements need to be
> located in the XML page to be put into the "populateDocument" method?
>
> Thanks for your help.
>
> Brett
>
> ________________________________________________________________________
> Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: cocoon-users-help@xml.apache.org
>
>