cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeremy Quinn <>
Subject a handy template for LogicSheet writers
Date Fri, 06 Oct 2000 16:24:21 GMT

Dear All,

I needed an XSL Template to pass multiline strings to Java Methods.


				Brought to you by Apache Cocoon XSP Mailer 1.0


	_mailer_N55be68.setSignature("" + "\n"
	+ "			--------------------------------------------------" + "\n"
	+ "				Brought to you by Apache Cocoon XSP Mailer 1.0" + "\n"
	+ "			--------------------------------------------------" + "\n" + "");

This is something that I believe other TagLibs want to be able to do, eg
ESQL etc. so I thought I'd pass it on straight away.

You use it by calling "get-nested-content" as usual ....

If there are fixes or optimisations, please feed them back.

And yes, I'll soon donate a mail sending TagLib for C1.

<xsl:template name="get-nested-content">
	<xsl:param name="content"/>
		<xsl:when test="$content/*"><xsl:apply-templates
		<xsl:when test="contains($content, '&#10;') or contains($content,
			<xsl:call-template name="get-nested-strings">
				<xsl:with-param name="content" select="$content"/>
		<xsl:otherwise>"<xsl:value-of select="$content"/>"</xsl:otherwise>

<xsl:template name="get-nested-strings">
	<xsl:param name="content"/>
	<xsl:variable name="ncontent" select="translate($content,'&#13;','&#10;')"/>
	<xsl:variable name="first" select="substring-before($ncontent, '&#10;')"/>
	<xsl:variable name="rest" select="substring-after($ncontent, '&#10;')"/>
	<xsl:text>"</xsl:text><xsl:value-of select="$first"/><xsl:text>"</xsl:text>
	<xsl:if test="$rest">
		<xsl:text> + "\n" +
		<xsl:call-template name="get-nested-strings">
			<xsl:with-param name="content" select="$rest"/>

Hope this helps

regards Jeremy

   Jeremy Quinn                                           Karma Divers
                                                       webSpace Design
                                            HyperMedia Research Centre

   <>     		 <>
    <phone:+44.[0].20.7737.6831>        <>

View raw message