Hi Mark,
We still speak about different things. I want to make a *conditional compilation* of XSP page (something like #ifdef in C). To do so I need to pass some parameter to XSL logics sheet (the one that translates XSP to Java). Lets consider fallowing example:


<xsl:stylesheet>
  <xsl:param name="denominator">

  <xsl:template match="test:div">
    <test:result>
      <xsl:choose>
        <xsl:when test="number($denominator) != 0">
          <xsp-request:get-parameter name="over"/>
          <xsl:text> / </xsl:text>
          <xsl:value-of select="$denominator"/>
          <xsl:text> = </xsl:text>
          <xsp:expr>
           Integer.parseInt(<xsp-request:get-parameter name="over"/>)
           / <xsl:value-of select="$denominator"/>
          </xsp:expr>
        </xsl:when>
        <xsl:otherwise>
          <xsl:text>You cannot divide by 0!</xsl:text>
        </xsl:otherwise>
      </xsl:choose>
    </xsl:copy>
  </xsl:template>
</xsl:stylesheet>

and page

<xsl:page>
  <test:div/>
</xsl:page>

As you probably see, the page divides request number by a number that was specified to logicsheet by <xsl:param>. The denominator is set only once, (before compiling page). There is no point in checking the denominator for every single request, just while compiling xsp page.

And now - how to pass pass the /value/ parameter to logic sheet other way than by some tag inside the page that is going to be compiled?

Regards,
Marcin Okraszewski




Hi Marcin,

So you are asking how to pass a parameter value from the sitemap, through an XSP, into a logicsheet?

If so, this is quite simple. I expect you have looked at this page?
http://cocoon.apache.org/2.1/userdocs/xsp/logicsheet-concepts.html

The first section explains how to pass request parameters into logic sheets (see the example using <xsp-request:get-parameter>). If you want to pass in sitemap parameters to a logicsheet (and not request parameters like the example here) then you should use the parameter fetching code as outlined in the mail archive links I sent before (instead of the <xsp-request:get-parameter>). Remember your logicsheet generates java code which is *compiled*: you can always look at the generated Java class files if you look in the work directory.

I hope this helps!
Mark

On 9 Feb 2004, at 15:32, Marcin Okraszewski wrote:

Hi,
Well, not quite. I mean getting the file on TRANSLATION (compilation) time! So that I can obtain it by XSLT, like this:


<xsl:param name="test"/>

<xsl:template match="test">
  <xsl:copy>
    <xsl:value-of select="$test"/>
  </xsl:copy>
</xsl:template>

and the solution described there is at execution time (XSP, not XSL).

Regards,
Marcin Okraszewski



Hi Marcin,
From your question, I think that Oliver was on the right track with his suggestion that you look in the archives. Maybe these links will help you?
I have used this technique:
http://marc.theaimsgroup.com/?l=xml-cocoon-users&m=105483065103410&w=2
I believe there is also a "util" logicsheet to do this (but I have never used it myself):
http://marc.theaimsgroup.com/?l=xml-cocoon-users&m=106806037121755&w=2
Regards,
Mark
On 6 Feb 2004, at 21:16, Marcin Okraszewski wrote:


I'm afraid you misunderstand me. I mean to pass parameter to logicsheet while translating xsp to java!

I tried with:

      <map:generate type="serverpages" src="test.xsp">
        <map:parameter name="test" value="this is test"/>
      </map:generate>
      <map:serialize type="xml"/>

But it didn't work :-(

Regards,
Marcin Okraszewski


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



Reply via email to