Wow, Jerry, that's complicated for an XSL newbie like me.  I will definitely keep it 
around and try to "crack" the code sometime. ;-)  Btw, do you know of any XSL/XPath 
book of which you think highly?  I have an XML book but it doesn't go into all that 
much depth.

Thanks,

Sonny

--- Jerry Fowler <[EMAIL PROTECTED]> wrote:
>I think this snippet that I gleaned from the list a while back
>(didn't thank the author in my comment, unfortunately, so I don't
>remember who) addresses what you're asking:
>
><!--
> Allows initialization code to be executed exactly once.
> This was expressed as:
> <xsl:template match="xsp:page/*[not(starts-with(name(.), 'xsp:'))]">
> in the xsp docs with Cocoon, but I think what's below is prettier.
>   -->
><xsl:template match="xsp:page/*[not(self::xsp:*)]">
>   <xsl:copy>
>     <xsl:apply-templates select="@*"/>
>   <xsp:logic>
>     // This code ends up inside populateDocument() before any user code
>      String productId = request.getParameter("productid");
>   </xsp:logic>
>     <xsl:apply-templates/>
>   </xsl:copy>
></xsl:template>
>
>
>Sonny Sukumar wrote:
>> Hi guys,
>> 
>> I sent the following message (below the line) yesterday and got one good suggestion 
>to use 
>> 
>> <xsp:logic>
>>     String productId = request.getParameter("productid");
>> </xsp:logic>
>> 
>> instead of 
>> 
>> <xsp:logic>
>>     String productId = <xsp-request:get-parameter name="productid"/>;
>> </xsp:logic>
>> 
>> However, it did not work..same problem with the ordering of the generated Java code 
>for the XSP which causes productId to try to be used (to create an attribute value 
>for the root element) before it is declared.  I would REALLY appreciate any insight 
>into this.
>> 
>> Thanks. :-)
>> ______________________________________________________________________________
>> Using: Cocoon 2.0.3 with Tomcat 4.1.12 on Redhat 7.3
>> 
>> My problem is this:  I'm writing an XSP and trying to insert an attribute
>> in the root element of my document.  The root element is <Product>, as this
>> doc stores product info.  
>> 
>> Anyhow, a logicsheet inserts an
>> <xsp:attribute>
>>   <xsp:expr>products.getCategory(productId)</xsp:expr>
>> </xsp:attribute>
>> 
>> into my XSP within the <Product> element.  Now, the productId variable is
>> declared like this *right* below the root <Product> element in the XSP:
>> 
>> <Product>
>>   <xsp:logic>
>>     String productId = <xsp-request:get-parameter name="productid" default=""/>;
>>   </xsp:logic>
>>  ...
>> 
>> The problem is that in the Java class generated for the XSP declares productId
>> AFTER the attribute code tries to call products.getCategory using productId
>> as a parameter.  This is the ONLY thing causing the error as far as I can
>> tell, as the code works fine without putting in the attribute.
>> 
>> Note that NO MATTER WHERE the <xsp:attribute>..</xsp:attribute> code gets
>> inserted within the <Product></Product> block, the generated Java code still
>> has the same ordering problem.
>> 
>> Does anybody know how to fix this?  I would have put the productId declaration
>> above the root element (i.e. made it a class member of the generated Java
>> class), but apparently one can't use the xsp-request logicsheet tags at the
>> class level.  I don't know why this is the case either.
>> 
>> Thanks for the help!
>> 
>> Sonny
>> 
>> _____________________________________________________________
>> Conserve wilderness with a click (free!) and get your own EcologyFund.net email 
>(free!) at http://www.ecologyfund.com.
>> 
>> _____________________________________________________________
>> Select your own custom email address for FREE! Get [EMAIL PROTECTED] w/No Ads, 
>6MB, POP & more! http://www.everyone.net/selectmail?campaign=tag
>> 
>> ---------------------------------------------------------------------
>> 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]>
>> 
>
>
>-- 
>Jerry Fowler
>Bioinformatics, Xeotron Corporation
>+1 713.842.2121 x292
>8275 El Rio, Suite 130
>Houston, Texas 77054
>
>
>---------------------------------------------------------------------
>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]>

_____________________________________________________________
Conserve wilderness with a click (free!) and get your own EcologyFund.net email 
(free!) at http://www.ecologyfund.com.

_____________________________________________________________
Select your own custom email address for FREE! Get [EMAIL PROTECTED] w/No Ads, 6MB, 
POP & more! http://www.everyone.net/selectmail?campaign=tag

---------------------------------------------------------------------
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]>

Reply via email to