xml-xsp-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jens Alm" <j...@ulmus.org>
Subject Nested calls to logicsheets
Date Thu, 27 Feb 2003 04:56:42 GMT
I am new to Cocoon and I have a question about nesting logicsheet calls. The reason I want
to do this is that I generate all the content at run-time and as such I don't want to have
several definitions of how, for instance, an image should be presented. So what I want to
do is define templates that I call instead. The problem is some of the templates call other

My logicsheet looks something like this (simplified):

<?xml version="1.0"?>
    <xsl:template match="my:get-template">
        <xsl:variable name="name"/>
        <xsl:variable name="local"><xsl:value-of select="@name"/></xsl:variable>
            <xsl:copy-of select="//my:set-template[@name = $local]/*"/>
        <more whatever...>
The document it transforms might look something like this:

<xsp:page language="java"
    <my:set-template name="link">
            <Link particulars....>
            <my:context lookup="link"> // this is a database lookup through a helper
                if( this.link.anchor.type == image ) // this is based on the context
                    <my:get-template name="image"/>
                else if( this.link.anchor.type == text )
                    <my:get-template name="text"/> // not shown here though
                <my:something else...>
    <my:set-template name="image">
        <Image particulars, similar to link lookup, based on database lookup...>

        <my:get-template name="link"/>
        <my:get-template name="image"/>
        <my:get-template name="link"/>
        <my:get-template name="image"/>


I can't seem to get the <my:get-template name="image"/> that is nested within the "link
template" to translate into anything. I have tried implementing it as a meta-stylesheet but
with no luck and I have also tried several other approaches. I have also tried different things
in the logicsheet instead of <xsl:copy-of .../> but nothing I do seems to work. Can
this be done in Cocoon? If so how? What approach should I look at? 

Anyone have a similar problem? Please help me. Any suggestions are welcome.

// Jens


View raw message