cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tobia <tobia.confo...@linux.it>
Subject Re: Tuning XSP output
Date Tue, 20 Mar 2007 10:20:02 GMT
Richard Lewis wrote:
> 1) Stop it from producing empty elements.
> <duration><esql:get-string column="duration" /></duration>

I guess you need to put it inside a Java if statement.
You can wrap it all in a logicsheet, for convenience:

	<my:get-element column="duration"/>

Something like this (untested):

	<xsl:template match="my:get-element">
	  <xsp:logic>
	    if (<esql:get-string column="{@column}"/>.length() > 0) {
	      <xsl:element name="{@column}">
	        <esql:get-string column="{@column}"/>
	      </xsl:element>
	    }
	  </xsp:logic>
	</xsl:template>


> 2) Some of my fields (e.g. biography) are long textual fields which
> include line spaces. Is there a way to capture those lines and wrap
> them up in elements?

Again untested:

	String biography = <esql:get-string column="biography"/>;
	for (String para : biography.split("\\n\\s*\\n")) {
	  <l><xsp:expr>para</xsp:expr></l>
	}

All the other methods I can think of are less reliable, less performant
and much more lenghty.


Tobia

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message