You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Corin Moss <Co...@tvnz.co.nz> on 2004/02/13 12:21:18 UTC

How to go about getting a handle on the "parent" of a transformer?

Hi Guys,

I'm extending the CIncludeTransformer to support external caching, the
only stumbling block is getting a handle on the XSP which "called" the
transformer.  

Obviously the include is specified in the XSP using the
<ci:cached-include> tag.  I need to get the name of the XSP from which
the transformer was called.  The xsp's class name in this case is
get_rdf_content_xsp.  Usually I'd get the name (or something similar)
within the generator by calling "this.source".  But I'm not sure how to
get a handle on that particular value from within a subsequent
generator.

After writing this, it's fairly apparent that the XSP is not really
calling the transformer at all, so is there any way I can get the name
of the previous generator within the pipeline? :)

I realise I could pass it in as a parameter - but there is noooo way I
want to do something that hacky ;)

Any ideas?

Corin Moss
Lead Developer
TVNZ Interactive

+64 9 916 7367
+64 21 403 054
corin.moss@tvnz.co.nz



Re: How to go about getting a handle on the "parent" of a transformer?

Posted by Upayavira <uv...@upaya.co.uk>.
Corin Moss wrote:

> Hi Guys,
>
> I'm extending the CIncludeTransformer to support external caching, the 
> only stumbling block is getting a handle on the XSP which "called" the 
> transformer. 
>
> Obviously the include is specified in the XSP using the 
> <ci:cached-include> tag.  I need to get the name of the XSP from which 
> the transformer was called.  The xsp's class name in this case is 
> get_rdf_content_xsp.  Usually I'd get the name (or something similar) 
> within the generator by calling "this.source".  But I'm not sure how 
> to get a handle on that particular value from within a subsequent 
> generator.
>
> After writing this, it's fairly apparent that the XSP is not really 
> calling the transformer at all, so is there any way I can get the name 
> of the previous generator within the pipeline? :)
>
> I realise I could pass it in as a parameter - but there is noooo way I 
> want to do something that hacky ;)
>
No other way - pass a parameter from the sitemap. As far as a 
transformer is concerned, all it knows (and wants to know) in relation 
to previous pipeline stages is that there are SAX events coming along.

Upayavira



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