Subject: Re: [xsl] current-dateTime() From: Michael Ludwig <mlu@xxxxxxxxxxxxx> Date: Fri, 18 Apr 2008 17:46:22 +0200 |
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 9.0.0.4) 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" xmlns:exsl="http://exslt.org/common" extension-element-prefixes="exsl" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <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')"/> <xsl:text> </xsl:text> <!-- Is the result of the call to document() cached? --> <xsl:for-each select="( document('')//node() )[ position() < 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)))"/> <xsl:value-of select="concat($new-url, ' ', document($new-url), ' ')"/> </xsl:for-each> </xsl:template> </xsl:transform>
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 9.0.0.4 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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] current-dateTime(), Abel Braaksma | Thread | Re: [xsl] current-dateTime(), Abel Braaksma |
Re: [xsl] current-dateTime(), Andrew Welch | Date | Re: [xsl] current-dateTime(), Dimitre Novatchev |
Month |