> Registered RTFs are then freed on every exit of xsltApplyOneTemplate().
> This means that the lifetime of RTFs is managed by Libxslt itself. This
> might be also the reason why there's no "free" function for RTFs yet.
A note about this: the lifetime of created RVTs used to give me tremendous
resource problems in the past, though admittedly probably a rare situation. I
had an extension function that would return database results as RVTs. The fact
that they were only freed once leaving a template forced me to dramatically
suboptimally re-write the XSLT to reduce the overhead generated. Where I
wanted to do:
<xsl:template match="something">
<xsl:for-each select="my:sql-many-results-func()/results/row">
<xsl:for-each select="my:some-other-sql-query('some query using the previous
row'">
</xsl:template>
Not really the best example, but had a few downsides:
1. required template matching to work on RVTs (actually RVTs converted to
node-sets like exsl:node-set() would do), which I think is against any spec but
Daniel always made it work
2. sometimes created some very ugly/verbose stylesheets
3. still sometimes tough to reduce the memory overhead for large RVTs
returned.
I remember trying for a long time to improve the granularity such that RVTs
created within <xsl:for-each> and other instructions , underneath elements
within a template, or generally anywhere a variable would no longer be in scope
would be freed when you leave that boundary. I could never get it to work
properly but I'm sure it's possible.
Alas, it's not a problem for me anymore (I've moved for good or bad to the java
world for development*), but thought it worth mentioning if someone is looking
at how the RVTs could work.
* Got to say I miss the speed and nicer API of libxslt over pure DOM and java
xml standards, I've written wrappers for DOM like the libxml2 tree.h APIs to
make it more tolerable. Will say the that XPATH 2.0 is quite powerful though.
_______________________________________________
xslt mailing list, project page http://xmlsoft.org/XSLT/
[email protected]
http://mail.gnome.org/mailman/listinfo/xslt