Hi, 

> -----Original Message-----
> From: Mark Vakoc [mailto:[EMAIL PROTECTED] 

> ----- Original Message ----
> From: "Buchcik, Kasimier" <[EMAIL PROTECTED]>
> 
> 
> > While implementing the cleanup of temporary tree fragments directly
> > when an instruction exits, I noticed that we'll get problems if
> > trying to do the same for extension elements. With the current
> > implementation of EXSLT's functions, this won't work:
> 
> Ah, you just refreshed my memory a bit.  I actually perform 
> the external data gathering in an extension element, 
> assigning it to a variable for processing.
> 
> <xsl:variable name="results">
>  <my:sql table="some_table">
>    <columns>.....</columns>
>    <selection>....</selection>
>  </my:sql>
> </xsl:variable>
> 
> <xsl:for-each select="exsl:node-set($results)/row">
>   <xsl:variable name="results2">
>     <my:sql table="some_other_table">....</my:sql>
>   </xsl:variable>
>   <xsl:for-each select="exsl:node-set($results2)/row">
>      ....
> 
> So the main problem I had, if I remember correctly, was that 
> although the variable results2 would go out of scope with 
> each of iteration of the first <xsl:for-each>
> it would not get freed until the parent template (i.e. 
> xsltApplyOneTemplate) was exited.  The workaround was to 
> always call into a named template directly under
> each xsl:for-each that did any external data fetching, so the 
> lifespan of the nested sql results would be reduced.
> 
> Again, probably a corner case here, though I'm probably not 
> the only one using extension elements and functions to gather 
> significant amounts of data.

I see. This must have been the case before I started looking at the
code, since the mechanism I was confronted with calls
xsltApplyOneTemplate() for every iteration of xsl:for-each. Also
for every xsl:variable xsltApplyOneTemplate() is called with the
variable instruction itself. Or, in other words, xsltApplyOneTemplate()
was not only called for an xsl:template but for every "template" 
(or sequence constructor in XSLT 2.0 terms).

Hmm, while writing this, I now wonder why the EXSLT function
implementation works at all.
Example:
<func:function name="foo">
  <func:result>
    <foo/>
  </func:result>
</func:function>

The exsltFuncFunctionFunction() calls xsltApplyOneTemplate() to
process the content, which is <func:result>; this should free the
tree fragment inside <func:result> on exit of xsltApplyOneTemplate().
It seems I'm still missing something here. I'll look into this.

Regards,

Kasimier
_______________________________________________
xslt mailing list, project page http://xmlsoft.org/XSLT/
[email protected]
http://mail.gnome.org/mailman/listinfo/xslt

Reply via email to