> From: Christian Haul [mailto:[EMAIL PROTECTED]]
> 
> On 12.Jul.2002 -- 07:20 AM, Eric Dalquist wrote:
> > My util.xsl doesn't have an include-source. There is include-uri,
> > include-file & include-expr.
> 
> Yeah, it's in 2.1 only. Might work just to copy this file from 2.1 and
> recompile
> 2.0.3 with it. Or try the snippet below and place it in your util.xsl:
> 
>   <xsl:template match="util:get-source">
>     <xsl:variable name="source-uri">
>       <xsl:call-template name="get-string-parameter">
>         <xsl:with-param name="name">uri</xsl:with-param>
>       </xsl:call-template>
>     </xsl:variable>
>     <xsp:expr>
>       XSPUtil.getSourceAsString(<xsl:copy-of select="$source-
> uri"/>,this.resolver)
>     </xsp:expr>
>   </xsl:template>
> 
>   <xsl:template match="util:include-source">
>     <xsl:variable name="source-uri">
>       <xsl:call-template name="get-string-parameter">
>         <xsl:with-param name="name">uri</xsl:with-param>
>       </xsl:call-template>
>     </xsl:variable>
>     <xsp:logic>
>       {
>          org.apache.cocoon.components.parser.Parser newParser = null;
>          try {
>             newParser = (org.apache.cocoon.components.parser.Parser)
> this.manager.lookup(org.apache.cocoon.components.parser.Parser.ROLE);
>             XSPUtil.include(this.resolver.resolve(<xsl:copy-of
> select="$source-uri"/>).getInputSource(), this.contentHandler,
newParser);

Ooooh, no! Sorry Chris, but why the hell parse source twice???

My thinking here is that everywhere else Cocoon uses resolver to
resolver URIs (and factory is deprecated). Thus, include-source is not
needed and include-uri has to be refactored.


>           } catch (Exception e) {
>               getLogger().error("Could not include source", e);
>           } finally {
>               if (newParser != null) this.manager.release((Component)
> newParser);
>           }
>       }

And here is memory leak: no source.recycle().


Eric,

Have you modified your copy as I suggested? Is it working? There is a
chance to have this resolved with 2.0.3 release on Monday...

Vadim


>     </xsp:logic>
>   </xsl:template>
> 
>       Chris.
> --
> C h r i s t i a n       H a u l
> [EMAIL PROTECTED]
>     fingerprint: 99B0 1D9D 7919 644A 4837  7D73 FEF9 6856 335A 9E08


---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

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

Reply via email to