You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Samuel ARNOD-PRIN <sa...@smile.ch> on 2001/06/10 11:32:46 UTC

[C1 to C2] Big difference in XSP !! Why ?

Hello,

Using C2 attributes are evaluated before the tags.

That's why :

<mytag>
	<xsp:logic>
		if (true) {
	</xsp:logic>
	<xsp:attribute name="att1" value="true"/>
	<xsp:logic>
		} else {
			String toto = "hello";
	</xsp:logic>
	<xsp:attribute name="att1" value="false"/>
	<xsp:attribute name="att2" ><xsp:expr>toto</xsp:expr></xsp:attribute>
	<xsp:logic>
		}
	</xsp:logic>
My tage body...
</mytag>

... works well with C1... but with C2... mytag has no attributes !!! For
the attribute 'att2.. it does not compile with C2 because toto is not
yet defined ... ;o(

Is it a bug in C2 (the xsp parser)... ??? Or should I have never used it
at all ?


If it could work, it would make my xsp files cleaner !!

---------------------------------------------------------------------
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: [C1 to C2] Big difference in XSP !! Why ?

Posted by Samuel ARNOD-PRIN <sa...@smile.ch>.
I have also discovered a big bug then :

suppose you want to use this :

<html>

..
<select>
<xsp:logic>
	String selected = (true) ? "yes" : "";
</xsp:logic>
	<option value="x">
		<xsp:attribute
name="selected"><xsp:expr>selected</xsp:expr></xsp:attribute>
		ValueX
	</option>
</select>

..
</html>


Well... <option selected=""> is unfortunately equivalent in html to
<option selected="yes"> and <option selected>

...


I have then to write this piece of code like this :


<select>
<xsp:logic>
	String selected = (true) ? "yes" : "";
	
if (selected.equals("")) {
	<xsp:content><option value="x"
selected="yes">hhhhhh</option></xsp:content>
} else {
	<xsp:content><option value="x">hhhhhh</option></xsp:content>
}
</xsp:logic>
</select>


it is not very elegant...

---------------------------------------------------------------------
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>