You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by I-Lin Kuo <ik...@hotmail.com> on 2003/02/03 18:00:45 UTC

newbie xsp question

In the sample xsp provided with cocoon, on the page

docs/samples/xsp/simple.xsp

There's a section of code that looks like this:

     <xsp:logic>
       <![CDATA[
       for (int i=0; i<3; i++) {]]><![CDATA[
       ]]>
         <li>
           Item <xsp:expr>i</xsp:expr>
         </li>
       <![CDATA[
       } ]]><![CDATA[
       ]]>
     </xsp:logic>

I understand that the CDATA sections are needed to escape the "<" in the for 
loop declaration, but it seems to me that only one such is needed. To test 
this, I made up another page with the following:

<ul>
<xsp:logic>
<![CDATA[
	for (int j=0;j<3;j++) ]]>{
		<li>Item <xsp:expr>j</xsp:expr></li>
	}
</xsp:logic>
</ul>

This worked, and confirmed my suspicions. So my question is, why were there 
so many CDATA sections in the original, and when am I supposed to use them?

Also, I'd appreciate it if someone could explain what xsp:content is 
supposed to do, or refer me to some place in the documentation where all the 
tags are listed (I couldn't find any).

_________________________________________________________________
Protect your PC - get McAfee.com VirusScan Online  
http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963


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


Re: newbie xsp question

Posted by Jim Bearce <ji...@bearce.us>.
I don't know why the simple.xsp was done the way it was but I believe 
you should also be able to write it this way:

<xsp:logic>
  for (int i=0; i &lt; 3; i++) {
    <li>Item <xsp:expr>i</xsp:expr></li>
  }
</xsp:logic>

I think wrapping it in CDATA sections is just to make it possible to use 
the < in the for statement

I-Lin Kuo wrote:

> In the sample xsp provided with cocoon, on the page
>
> docs/samples/xsp/simple.xsp
>
> There's a section of code that looks like this:
>
>     <xsp:logic>
>       <![CDATA[
>       for (int i=0; i<3; i++) {]]><![CDATA[
>       ]]>
>         <li>
>           Item <xsp:expr>i</xsp:expr>
>         </li>
>       <![CDATA[
>       } ]]><![CDATA[
>       ]]>
>     </xsp:logic>
>
> I understand that the CDATA sections are needed to escape the "<" in 
> the for loop declaration, but it seems to me that only one such is 
> needed. To test this, I made up another page with the following:
>
> <ul>
> <xsp:logic>
> <![CDATA[
>     for (int j=0;j<3;j++) ]]>{
>         <li>Item <xsp:expr>j</xsp:expr></li>
>     }
> </xsp:logic>
> </ul>
>
> This worked, and confirmed my suspicions. So my question is, why were 
> there so many CDATA sections in the original, and when am I supposed 
> to use them?
>
> Also, I'd appreciate it if someone could explain what xsp:content is 
> supposed to do, or refer me to some place in the documentation where 
> all the tags are listed (I couldn't find any).
>
> _________________________________________________________________
> Protect your PC - get McAfee.com VirusScan Online  
> http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963
>
>
> ---------------------------------------------------------------------
> 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:     <co...@xml.apache.org>
> For additional commands, e-mail:   <co...@xml.apache.org>
>
>


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