Re: [xml] docuemnt() function cache in libxslt



Hello,

Thanks, for the response. In fact I find it reasonable to work this way since in my opinion side effects are not really the XSL way of doing things.

I found another solution but am now wondering about its scaleability.

The solution I found is to create a "temporary" subtree for each entry by using a variable and the exslt extension node-set and simulating a situation in which there is only a unique entry. I have something like this :

<xsl:for-each select="/document/entry">
<xsl:variable name="temptree">
   <document>
       <xsl:copy-of select="body" />
       <xsl:copy-of select="." />
  </document>
</xsl:variable>

<!-- Handle the document as if there was a unique entry -->
<xsl:apply-templates select="exsl:node-set($temptree/document)" />
</xsl:for-each>

It works great, but I have a performance question. Does xsl:copy-of effectively build a copy or are we internally working only with pointers ? Otherwise, this means I have an in memory copy of the potentially very big part of the document for every "entry" (which can be numerous).

How does libxslt work in such a case ?

Cheers,
Benjamin

Daniel Veillard a écrit :
On Tue, Mar 11, 2008 at 01:52:24PM +0100, Benjamin Habegger wrote:
Hello all,

I was wondering if there was any way in libxml to deactivate the cache of files loaded with the xslt document() function.

  no, that's needed for proper implementation of XSLT
  http://www.w3.org/TR/xslt#function-document
see paragraph 7:
  'Two documents are treated as the same document if they are identified
   by the same URI.'
and the explicit requirement
  'generate-id(document("foo.xml"))=generate-id(document("foo.xml"))'

which in libxml2/libxslt means using the same tree.
I think you need to find a better way to accomplish what you want, but
asking for different values on successive document() Just Can't Work !

Daniel





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]