Re: [xsl] current-dateTime()

Subject: Re: [xsl] current-dateTime()
From: Michael Ludwig <mlu@xxxxxxxxxxxxx>
Date: Fri, 18 Apr 2008 17:46:22 +0200
Abel Braaksma schrieb:
Michael Ludwig wrote:
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.

you forgot to add the generate-id + a newly created node to add to the URI. However, the processors you mention use XSLT 1.0. To get the same behavior in XSLT 1.0 you need to be a little bit more creative and use the extension function exslt:node-set (or equivalent for your processor).

I felt creative enough calling an external script, so I forgot to be more creative :-) Now, following your example: This works for Saxon (both 6.5.5 and and for Xalan-J 2.7.1, but not for Xalan-C 1.10.0 and LibXSLT 1.1.22. The latter do not seem to generate new nodes, so no new IDs are generated either.

<xsl:transform version="1.0"
  <xsl:output method="text"/>
  <xsl:variable name="url" select="'http://localhost/mlu/xml.php'"/>
  <xsl:template match="/">
    <xsl:text>Prozessor: </xsl:text>
    <xsl:value-of select="system-property('xsl:vendor')"/>
    <!-- Is the result of the call to document() cached? -->
    <xsl:for-each select="( document('')//node() )[ position() &lt; 4 ]">
      <xsl:variable name="new-node"><xsl:comment/></xsl:variable>
      <xsl:variable name="new-url"
        select="concat($url, '?', generate-id(exsl:node-set($new-node)))"/>
        select="concat($new-url, ' ', document($new-url), '&#10;')"/>

Prozessor: SAXON 6.5.5 from Michael Kay
http://localhost/mlu/xml.php?d2 91
http://localhost/mlu/xml.php?d4 92
http://localhost/mlu/xml.php?d6 93

Prozessor: SAXON from Saxonica
http://localhost/mlu/xml.php?d3 94
http://localhost/mlu/xml.php?d5 95
http://localhost/mlu/xml.php?d7 96

Prozessor: libxslt [1.1.22]
http://localhost/mlu/xml.php?id2242687 97
http://localhost/mlu/xml.php?id2242687 97
http://localhost/mlu/xml.php?id2242687 97

Prozessor: Apache Software Foundation [Xalan-C 1.10.0]
http://localhost/mlu/xml.php?N0x8081df0N0x8076d80 98
http://localhost/mlu/xml.php?N0x8081df0N0x8076d80 98
http://localhost/mlu/xml.php?N0x8081df0N0x8076d80 98

Prozessor: Apache Software Foundation [Xalan-J 2.7.1]
http://localhost/mlu/xml.php?N30000 99
http://localhost/mlu/xml.php?N30002 100
http://localhost/mlu/xml.php?N30004 101


Current Thread