[xml] docuemnt() function cache in libxslt



Hello all,

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

I have an XSLT whose role is to copy a numer of times part of the input XML for each entry of another part of the same XML (or external XML, it doesn't matter). For example consider the flowing document.

<document>
   <body>
      <whatever>
            <reference name="firstname" />
      </whatever>
   </body>
   <data>
       <entry id="1">
           <firstname>Alex</firstname>
      </entry>
       <entry id="2">
           <firstname>Margot</firstname>
      </entry>
   </data>
</document>

My goal is to obtain a new document where the "body" element has been "duplicated" as many times as there are "entry" elements inside "data". Also, and this is the hard part, for each copy all "reference" element should have been replaced with the values of the correct element referenced to with the "name" attribute.

The problem is that inside the templates which do the reference replacement I have no idea on which entry I am (and I do not want to pass this information through parameters).

One solution I am trying is to generate a temporary document containing the current entry (via xsl:document element) and loading the temporary document (via the document() function). However, the document() function uses a cache and does not reload the document even if it has changed on disk.

Is there any way to disable this "caching" mecanism ? Ideally I would want the cache to be reset only each time the temporary document is modified.

Another question, is there any other means to save somewhere a global value (eventually using extensions) ?

Thanks in advance for any ideas.

Cheers,
Benjamin






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