xsl-list
[Top] [All Lists]

Re: Functions Returning Nodes in XSLT 2.0

2005-05-20 06:41:07

Michael,

  , a call to document() within xsl:copy-of can be regarded as a function that
  returns the document with the opposite guarantee, that you will get
  different nodes each time: which means that the source document will be read
  repeatedly rather than being stored in memory. In your case this is not the
  right strategy!

Is that 100% safe? Apart from the internal detail that internal node ids
are supposed to be preserved I always read the XSLT conditions on
document() as ensuring that I'd get the same text back even in the face
of the source document changing during the run of xslt.





given

<xsl:variable name="a">
 <xsl:copy-of 
select="document('http://www.worldtimezone.com/time/wtzresult.php?CiID=12008')"/>
</xsl:variable>
<xsl:variable name="b">
 <xsl:copy-of 
select="document('http://www.worldtimezone.com/time/wtzresult.php?CiID=12008')"/>
</xsl:variable>


(Ignoring the fact that this is returning html rather the xml, for now)

Can't I be assured that string($a) = string($b) is true?

(I agree that this is an edge case as transforming any document that is
changing rapidly enough for this to matter is always going to be an essentially
non-deterministic, and certainly non-repeatable, operation)




  Another new optimization that's coming along soon is that an expression like
  the one in your example will automatically use indexing without you asking
  for it. In the meantime, though, using xsl:key for this kind of construct is
  usually a good idea.

Ahh, you are just being kind to our key-less cousins over in
Xquery-land:-)

David

________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--