Re: [xsl] current-dateTime()

Subject: Re: [xsl] current-dateTime()
From: Michael Ludwig <mlu@xxxxxxxxxxxxx>
Date: Fri, 18 Apr 2008 16:46:32 +0200
Robert Koberg schrieb:
You could make a call with the document function (in a non-functional
way :) ) to a back end that uses a custom uri resolver that, when
receives a certain href, logs/writes the /real/ current-dateTime and
returns <nothing/>.

That would probably not work. I tested this the other day, just out of curiosity, calling a script that incremented a number, and found that the result was cached when using LibXSLT, Saxon and Xalan.

mludwig@forelle:~/Werkstatt/xsl > expand -t2 ~/www/xml.php
<?php
$fnam = 'xml.php.dat';
if (file_exists($fnam)) {
  $i = file_get_contents($fnam);
  file_put_contents($fnam, $i + 1);
}
else {
  $i = 0;
  file_put_contents($fnam, $i);
}
echo "<Int>$i</Int>\n";

mludwig@forelle:~/Werkstatt/xsl > expand -t2 document-function-en.xsl
<?xml version="1.0" encoding="UTF-8"?>
<xsl:transform version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
<xsl:output indent="yes"/>
<xsl:variable name="url" select="'http://localhost/mlu/xml.php'"/>
<xsl:template match="/">
<Urmel>
<Prozessor>
<xsl:value-of select="system-property('xsl:vendor')"/>
</Prozessor>
<Frage> Is the result of the call to document() cached? </Frage>
<xsl:copy-of select="document($url)"/>
<xsl:copy-of select="document($url)"/>
<xsl:copy-of select="document($url)"/>
<Antwort> Yes, it is. LibXSLT, Xalan and Saxon cache the result.</Antwort>
</Urmel>
</xsl:template>
</xsl:transform>


mludwig@forelle:~/Werkstatt/xsl > xsltproc document-function-en.xsl urmel.xml
<?xml version="1.0"?>
<Urmel>
<Prozessor>libxslt</Prozessor>
<Frage> Is the result of the call to document() cached? </Frage>
<Int>52</Int>
<Int>52</Int>
<Int>52</Int>
<Antwort> Yes, it is. LibXSLT, Xalan and Saxon cache the result.</Antwort>
</Urmel>


Michael

Current Thread