Torsten Curdt wrote:

>>>Referring to some old C1 documentation http://xml.apache.org/cocoon1/xsp.html
>>>(paragraph "logic tags") this should work.
>>>And I think this should work the same way in C2!
>>>
>>You need to open a new <xsp:logic> inside <ns:list> : the scope of Java
>>code in <xsp:logic> is limited to text nodes that are its _direct_
>> children. Also, "o.getName()" should be enclosed by an <xsp:expr>. So
>>the above snippet should be written as follows :
>>
>
>[snip]
>
>Right.
>
>>So I'm not sure there is a wrong behaviour in the engine.
>>Sylvain
>>
>If you look at the provided C1 docs this was different before.
>
How is this different ? The examples do not embed markup as far as your 
example, but they state that " the |<xsp:logic>| element allows for the 
arbitrary nesting of other markup without the need to "prematurely" 
close it"

And the example below this sentence clearly shows that text nodes in 
embedded markup aren't Java code :

<table>
  <xsp:logic>
    for (int i = 0; i &lt; countries.length; i++) {
      <tr>
        <td>
          <xsp:expr>countries[i].getName()</xsp:expr>
        </td>
        <td>
          <xsp:expr>countries[i].getCurrency()</xsp:expr>
        </td>
      </tr>
    }
  </xsp:logic>
</table>

Notice the <xsp:expr> inside the <td> : if they weren't present, 
"countries[i]..." wouldn't be considered as Java code and thus inserted 
as is in the produced document.

And this is what makes XSP more XML-ish than other dynamic page 
languages : in the XML tree, the <tr> in the above sample are _inside_ 
the <xsp:logic>, which is more in accordance with the page logic than 
what you would do with JSP, where there would be 2 java code blocs _at 
the same level_ as the <tr>.

>
>So question is:
>
>1) is this still C1 behaviour or is the docu outdate (well, always ;)
>
This both C1 & C2 behaviour, and docu is up to date (well, at least on 
this point ;)

>
>2) what says the xsp spec (is there one?)
>
There's a 2-year old working draft at 
http://xml.apache.org/cocoon1/wd-xsp.html
The before-last chapter "Page readability" explains just the same as 
above on JSP.

>
>3) what's the more desired behaviour
>
IMO the desired behaviour is the one we have today : as soon as you put 
markup in an <xsp:logic>, you leave Java code to go back to XML content.

>
>4) what will break if we change it
>
Again, IMO nothing's wrong... or maybe our example ;-)

Sylvain




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

Reply via email to