Andrew,

sorry I didn't reply to your previous mail - I got very busy yesterday.  I
looked at the files you sent, and I saw some things, but it looks like
you've moved on.

In your current posting, I think the problem is the order of execution.  In
your logicsheet, you are putting in code to look up the artist details in
an xsp:logic block directly inside the xsp:page block.  This puts all of
that code at the class level, so it is executed when the page object is
first instantiated.  The code that provides the artistID for lookup, on the
other hand, is inside the 'page' element, which means it is put in the
generate() method of the page class, which gets called to generate the
page.  By the time it is called, though, all of your artist detail
variables have already been set.

Here's a rewrite/simplification that may help:

1. XSP Page (snippet)
<?xml version="1.0"?>

<xsp:page language="java"
             xmlns:xsp="http://apache.org/xsp";
             xmlns:artistDetails="
http://www.beyarecords.com/artistDetails/1.0";
             xmlns:xlink="http://www.w3.org/1999/xlink";
             xmlns:util="http://apache.org/xsp/util/2.0";
 >
      <page>
             <xsp:logic>
                  int artistID =
Integer.parseInt(<util:get-sitemap-parameter name="artistID"/>);
             </xsp:logic>

             <artistDetails:get-details>

<artistDetails:id><xsp:expr>artistID</xsp:expr></artistDetails:id>
             </artistDetails:get-details>

            ...


2. XSP Logic Sheet
<?xml version="1.0"?>
<xsl:stylesheet
   xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
   xmlns:xsp="http://apache.org/xsp";
   xmlns:util="http://apache.org/xsp/util/2.0";
   xmlns:artistDetails="http://www.beyarecords.com/artistDetails/1.0";
   version="1.0">

<xsl:template match="xsp:page">
      <xsp:page>
            <xsl:apply-templates select="@*"/>

            <xsp:structure>
                  <xsp:include>test.Artist</xsp:include>
                  <xsp:include>test.Base64</xsp:include>
            </xsp:structure>

            <xsl:apply-templates/>
      </xsp:page>
</xsl:template>

<xsl:template match="artistDetails:get-details">
      <xsp:logic>
            int artistID = Integer.parseInt(<xsl:apply-templates
select="artistDetails:id/node()"/>);
            Artist artist = Artist.getArtist(artistID);
            String artist_name = artist.getArtistName();
      </xsp:logic>
      <artist-details>
            <name><xsp:expr>artist_name</xsp:expr></name>
      </artist-details>
</xsl:template>

...

-Christopher




|---------+---------------------------->
|         |           beyaNet          |
|         |           Consultancy      |
|         |           <[EMAIL PROTECTED]|
|         |           .com>            |
|         |                            |
|         |           03/04/2004 08:26 |
|         |           AM               |
|         |           Please respond to|
|         |           users            |
|         |                            |
|---------+---------------------------->
  
>--------------------------------------------------------------------------------------------------------------|
  |                                                                                    
                          |
  |       To:       [EMAIL PROTECTED]                                                  
                    |
  |       cc:                                                                          
                          |
  |       Subject:  Re: Passing values into an XSP logic sheet                         
                          |
  
>--------------------------------------------------------------------------------------------------------------|




Hi,
I am trying to pull a value in from my XSP page into an XSP Logicsheet.
At the moment no value is being pulled in. What am I doing incorrectly?

1. XSP Page (snippet)
<?xml version="1.0"?>

<xsp:page language="java"
             xmlns:xsp="http://apache.org/xsp";
             xmlns:artistDetails="
http://www.beyarecords.com/artistDetails/1.0"; --
LOGICSHEET REF:
             xmlns:xlink="http://www.w3.org/1999/xlink";
             xmlns:util="http://apache.org/xsp/util/2.0";
 >
<page>
             <xsp:logic>
                           int artistID =
Integer.parseInt(<util:get-sitemap-parameter
name="artistID"/>); --VALUE PULLED IN FROM SITEMAP
             </xsp:logic>

             <artistDetails:id>
                         <xsp:expr>artistID</xsp:expr> --- VALUE HELD HERE
             </artistDetails:id>

2. XSP Logic Sheet
<?xml version="1.0"?>
<xsl:stylesheet
   xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
   xmlns:xsp="http://apache.org/xsp";
   xmlns:util="http://apache.org/xsp/util/2.0";
   xmlns:artistDetails="http://www.beyarecords.com/artistDetails/1.0"; --
LOGICSHEET REF:
   version="1.0">

<xsl:template match="xsp:page">
   <xsp:page>
      <xsl:apply-templates select="@*"/>

              <xsp:structure>
                <xsp:include>test.Artist</xsp:include>
                <xsp:include>test.Base64</xsp:include>
              </xsp:structure>

      <xsp:logic>
                         int artistID =
Integer.parseInt(<xsl:apply-templates
select="artistDetails:id/node()"/>); -- WANT VALUE PULLED INTO HERE
                         Artist artist = Artist.getArtist(artistID);

                         int id = artist.getID();
                         String artist_name = artist.getArtistName();
                         String info = artist.getArtistInfo();
                         String basePhoto1 =
Base64.encodeBytes(artist.getArtistPhoto1());
                         String basePhoto2 =
Base64.encodeBytes(artist.getArtistPhoto2());
      </xsp:logic>
      <xsl:apply-templates/>
   </xsp:page>
</xsl:template>

many thanks in advance

On 3 Mar 2004, at 21:07, beyaNet Consultancy wrote:

> Christopher,
> thanks for your reply. I have implemented your solution but am getting
> an error. I have attached both my XSP page and the XSP Logic sheet.
> Please let me know what i am doing here...
>
>
> many thanks in advance
>
> Andrew
>
> <artist-details.xsp><artistDetails.xsl>
> On 3 Mar 2004, at 16:02, Christopher Painter-Wakefield wrote:
>
>> <xsp:logic>
>>       int  myID = [code to get parameter value here];
>> </xsp:logic>
>>
>> <my-logic:get-data>
>>       <my-logic:id><xsp:expr>myID</xsp:expr></my-logic:id>
>> </my-logic:get-data>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]



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

Reply via email to