[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: current-dateTime()

Subject: Re: current-dateTime()
From: Michael Ludwig <mlu@xxxxxxxxxxxxx>
Date: Fri, 18 Apr 2008 17:46:22 +0200
Re:  current-dateTime()
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 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>&#10;</xsl:text>
    <!-- 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)))"/>
      <xsl:value-of
        select="concat($new-url, ' ', document($new-url), '&#10;')"/>
    </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

Michael

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.