sorry, but can't help You.
This trick with

        <xsl:variable name="selectedPerson"
select="document('people.xml',.)/people/person[name='$person']"/>
        <xsl:value-of select="$selectedPerson/favoriteColour">

didn't work for me too.
You took to selectedPerson just a value of
document('people.xml',.)/people/person[name='$person'] node, but not entire
node...

As I noticed nobody succeded in passing a node as variable or param.
If somebody did - please tell us how?

Good luck,
Valdo
-----------------------
mailto:[EMAIL PROTECTED]


-----Original Message-----
From: Phil Blake [mailto:[EMAIL PROTECTED]]
Sent: Thursday, October 25, 2001 1:57 AM
To: [EMAIL PROTECTED]
Subject: Help needed Passing Parameters


I am missing something when it comes to getting and passing request
arguments. I've looked at the cocoon examples, and although my test
example appears to match the cocoon one in every way there is obviously
something fundamental missing.

I think I'm pretty close. :) If anyone could help me get past this
misunderstanding it would be much appreciated.

My example scenario allows the user to enter a URL like the following:
http://hostname/example/colour.html?person=Phil%20Blake
The result would be a HTML page with the person's favorite colour.

In the sitemap I added a generic matcher that matches anything .html and
returns the corresponding xsp. I figured (as opposed to read anywhere in
documentation) that I needed to include the use-request-parameters and
use-browser-capabilities-db parameters - I don't know why I want them,
just that they appeared in the cocoon sitemap.
        <!-- Match *.html and map to *.xsp -->
                <map:match pattern="**.html">
                        <map:generate type="serverpages" src="{1}.xsp"/>
                        <map:transform src="Example.xsl">
                                 <map:parameter
name="use-request-parameters" value="true"/>
                                 <map:parameter
name="use-browser-capabilities-db" value="true"/>
                        </map:transform>
                        <map:serialize/>
                </map:match>

The requested xsp page looks like this. (colour.xsp)
<xsp:page
           language="java"
           xmlns:xsp="http://apache.org/xsp";
           xmlns:xsp-request="http://apache.org/xsp/request/2.0";
           xmlns:xsp-response="http://apache.org/xsp/response/2.0";>
     <xsp:logic>
         String person = null;
     </xsp:logic>
        <html>
                <title>The favorite colour page - Yay"</title>
                <xsp:logic>
                                person = <xsp-request:get-parameter name="person"/>;
                 </xsp:logic>
                 <xsp:expr>person</xsp:expr> has a favorite colour! It is
<person-colour/>
        </html>
</xsp:page>

I then have a half/broken stylesheet that is supposed to select the
person named in the URL person path arg. Then return their favorite
colour. However, as you'll notice, I can't see how to get from the first
line, to the second one. I assume the variable selectedPerson contains a
person node. (I don't know 'cause I can't make it work).
However, I have no idea how to use that variable to retrieve the colour.
XSL Stylesheet:
<xsl:template match="person-colour">
        <!-- Select the person, somehow -->
        <xsl:variable name="selectedPerson"
select="document('people.xml',.)/people/person[name='$person']"/>
        <!-- return their favorite colour, somehow  -->
        <xsl:value-of select="$selectedPerson/favoriteColour">
</xsl:template>



XML External Content (people.xml)
<people>
        <person>
                <name>Phil</name>
                <favoriteColour>blue</favoriteColour>
        </person>
        <person>
                <name>Arthur</name>
                <favoriteColour>yellow</favoriteColour>
        </person>
</people>


Thanks for your help. Have fun,

Phil


---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.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/faqs.html>

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

Reply via email to