You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Roman Kunert <ro...@hsh-berlin.com> on 2000/05/23 11:58:20 UTC

using other taglibrary in own taglibrary

I tried to extend the example taglibrary from the cocoon samples like this:

<?xml version="1.0"?>
<xsl:stylesheet
        xmlns:xsl="http://www.w3.org/XSL/Transform/1.0"
        xmlns:xsp="http://www.apache.org/1999/XSP/Core"
        xmlns:example="http://localhost/~roman"
        xmlns:sql="http://www.apache.org/1999/SQL"
>
<xsl:template match="xsp:page">
<xsp:page
       xmlns:sql="http://www.apache.org/1999/SQL"
>
	<xsl:copy>
        	<xsl:apply-templates select="@*"/>
         </xsl:copy>
         <xsp:structure>
         	<xsp:include>java.util.Date</xsp:include>
                <xsp:include>java.text.SimpleDateFormat</xsp:include>
          </xsp:structure>
         <xsp:logic>
         		/* "Example" Class Level Logic roman was here*/
         		private static String formatDate(Date date, String pattern) {
            		if (pattern == null || pattern.length() == 0) {
              			pattern = "yyyy/MM/dd hh:mm:ss aa";
            		}
            		return (new SimpleDateFormat(pattern)).format(date);
            	}
         </xsp:logic>
         <xsl:apply-templates/>
 </xsp:page>
</xsl:template>

<xsl:template match="example:test">
	<sql:execute-query>
		<sql:driver>org.gjt.mm.mysql.Driver</sql:driver>
		<sql:dburl>jdbc:mysql://localhost/example</sql:dburl>
				...
				...
	</sql:execute-query>
</xsl:template>

...

calling <example:test> doesn't evaluate the
<sql:execute-query>...</sql:execute-query> branch, it simply copies the nodes.

What do I have to do to make this work? Thanks for your help!

Re: using other taglibrary in own taglibrary

Posted by Donald Ball <ba...@webslingerZ.com>.
On Tue, 23 May 2000, Roman Kunert wrote:

> I tried to extend the example taglibrary from the cocoon samples like this:

(code snipped)

> calling <example:test> doesn't evaluate the
> <sql:execute-query>...</sql:execute-query> branch, it simply copies
> the nodes.
> 
> What do I have to do to make this work? Thanks for your help!

are you doing this for learning experience or to add column formatting to
the sql taglib? if the former, more power to you, i cannot help. if the
latter, you can do column formatting without modifying the sql taglib. see

http://xml.apache.org/cocoon/sqltaglib.html

and read the section entitied "Column Formatting".

- donald