You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Sean <ja...@wideasleep.com> on 2001/04/27 05:50:00 UTC

xsl:variable and logicsheets

I was wondering, can someone tell me why this would not work?  I keep
getting an error ...

<xsp:page>
    <xsl:variable name="rand"><my-util:random-number
ceiling="10"/></xsl:variable>

    <message>the number is <xsl:value-of select="$rand"/></message>
</xsp:page>

I am trying to store the output of a xsp logicsheet, which returns a number,
into an xsl variable and then I want to use it later.  If i just put the
<my-util:random-number ceiling="10"/> in the <message> itself it works but i
need it stored in a variable.

Thanks,
Sean


---------------------------------------------------------------------
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: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>


Re: xsl:variable and logicsheets

Posted by Donald Ball <ba...@webslingerZ.com>.
On Thu, 26 Apr 2001, Sean wrote:

> I was wondering, can someone tell me why this would not work?  I keep
> getting an error ...
>
> <xsp:page>
>     <xsl:variable name="rand"><my-util:random-number
> ceiling="10"/></xsl:variable>
>
>     <message>the number is <xsl:value-of select="$rand"/></message>
> </xsp:page>
>
> I am trying to store the output of a xsp logicsheet, which returns a number,
> into an xsl variable and then I want to use it later.  If i just put the
> <my-util:random-number ceiling="10"/> in the <message> itself it works but i
> need it stored in a variable.

because the value of the xsl:variable needs to be resolved at logicsheet
application time, whereas the value of my-util:random-number is resolved
at page run time. if you want to put that value in a variable, by all
means, put it in a variable:

<xsp:page>
 <page>
  <xsp:logic>
   int random = <my-util:random-number ceiling="10"/>;
  </xsp:logic>
  <message>the number is <xsp:expr>random</xsp:expr></message>
 </page>
</xsp:page>

- donald


---------------------------------------------------------------------
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: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>