cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeremy Quinn <je...@media.demon.co.uk>
Subject RFC: Logic TagLib
Date Thu, 11 Jan 2001 19:22:44 GMT
Dear Cocooners,

I develop XSP TagLibs, as part of my work on the CRUDLET project.

	<http://www.crudlet.org>

We have developed a draft proposal of a TagLib for handling "content logic"
for webapps; to allow contextual content selection logic to be encoded in
an XSP page without the user having to write Java Code inside <xsp:logic/>
tags.

This is something that was critical for our project to allow us to develop
in a more scaleable way to the techniques we are using now.

The Logic TagLib was designed to be generic it has no dependencies on the
CRUDLET project, it was always intended to be contributed to Cocoon.


We invite all interested parties to read and comment on the proposal.

	<http://www.crudlet.org/logicTaglib.html>

I understand that some people may find this controversial .... I am not too
worried, we know it is something we need ;) but I am interested in your
opinions and I am totally prepared to alter the specification, or to not
incorporate it into Cocoon or whatever, depending on the response.


As a taster, here are two examples from the proposal:

A simple test for equality between the value that arrived in the request
parameter called "blag" and an empty String. If the parameter was empty,
the TextNode "The request param is empty" is output to the parent element
of the <logic:if/> tag; otherwise there is no output.

	<logic:if>
		<logic:test op="eq">
			<logic:arg><request:get-parameter name="blag"/></logic:arg>
			<logic:arg/>
		</logic:test>
		<logic:then>The request param is empty</logic:then>
	</logic:if>

This is a typical use of the <logic:choose/> tag whereby multiple
<logic:when/> clauses are evaluated until one of them returns something. If
none of them returned anything, the contents of <logic:otherwise/> is
output. There should be one or more <logic:when/> clauses and only one
<logic:otherwise/>. The equivalent forms of nesting available to the
<logic:if/> tag will also work with the <logic:choose/> tag.

	<logic:choose>
		<logic:when>
			<logic:test op="eq">
				<logic:arg><request:get-parameter name="type"/></logic:arg>
				<logic:arg>fish</logic:arg>
			</logic:test>
			<logic:then>This is a Fish</logic:then>
		</logic:when>
		<logic:when>
			<logic:test op="eq">
				<logic:arg><request:get-parameter name="type"/></logic:arg>
				<logic:arg>dogcow</logic:arg>
			</logic:test>
			<logic:then>This is a Dogcow</logic:then>
		</logic:when>
		<logic:otherwise>It was none of the above</logic:otherwise>
	</logic:choose>



This will get implemented over the coming weeks.

Let me know what you think, (but please read the whole thing first ;)

Thanks

regards Jeremy
-- 
   ___________________________________________________________________

   Jeremy Quinn                                           Karma Divers
                                                       webSpace Design
                                            HyperMedia Research Centre

   <mailto:sharkbait@mac.com>     		 <http://www.media.demon.co.uk>
    <phone:+44.[0].20.7737.6831>        <pager:jermq@sms.genie.co.uk>
Mime
View raw message