I can't figure out how to call another component. In my case, I want to
call xmlhttp component, but It's the same for any transformer...., I
guess


Here is my code.


package myGenerators;

import org.apache.avalon.excalibur.pool.Poolable;
import org.apache.cocoon.components.parser.Parser;
import org.apache.avalon.framework.component.ComponentException;
import org.apache.cocoon.ProcessingException;
import org.apache.cocoon.environment.Source;
import org.apache.cocoon.transformation.Transformer;
import org.apache.cocoon.generation.ComposerGenerator;
import org.apache.avalon.framework.component.Component;
import com.clsw.cocoon.XmlHttpTransformer;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import java.io.ByteArrayInputStream;
import java.io.IOException;


public class ZipGenerator extends ComposerGenerator implements Poolable{
        private XmlHttpTransformer trans = null;

        public void generate() 
                throws SAXException, IOException, ProcessingException { 
                        
                        String xmlURI = this.source;
                        Source archive = null;
                        Parser parser= null;
                        try { 
                                archive = this.resolver.resolve( xmlURI
);                              
                                InputSource inputSource =
archive.getInputSource();                               
                                parser = (Parser) this.manager.lookup
(Parser.ROLE);
                                //parser.setConsumer( this.xmlConsumer
); //con xmlConsumer no funca
                                trans = (XmlHttpTransformer)
this.manager.lookup (XmlHttpTransformer.ROLE);                          
        
trans.setContentHandler(this.contentHandler);
                                
        
parser.setContentHandler((xmlConsumer)trans);
                                parser.parse( inputSource );            
                        }        
                        catch (ComponentException ce) { 
                                                throw new
ProcessingException("Component Parser not found.", ce); 
                        }
                        finally { 
                                if (archive != null) 
                                        archive.recycle();
                        }
                                 
                }
}

-----Mensaje original-----
De: beyaRecords - The home Urban music [mailto:[EMAIL PROTECTED] 
Enviado el: jueves, 04 de marzo de 2004 13:35
Para: [EMAIL PROTECTED]
Asunto: Re: Passing values into an XSP logic sheet

Christopher,
that works fine now ;-)

many thanks


Andrew
On 4 Mar 2004, at 16:00, Christopher Painter-Wakefield wrote:

> <xsl:template match="artistDetails:get-details">
>       <xsp:logic>
>             int artistID = Integer.parseInt(<xsl:apply-templates
> select="artistDetails:id/node()"/>);
>             Artist artist = Artist.getArtist(artistID);
>             String artist_name = artist.getArtistName();
>       </xsp:logic>
>       <artist-details>
>             <name><xsp:expr>artist_name</xsp:expr></name>
>       </artist-details>
> </xsl:template>


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to