[xsl] Re: Re: generating a repeatable unique id

Subject: [xsl] Re: Re: generating a repeatable unique id
From: Dimitre Novatchev <dnovatchev@xxxxxxxxx>
Date: Sun, 29 Jul 2001 12:56:36 -0700 (PDT)
Michael Beddow wrote:

> Ouch! Looks like I've got the wrong end of yet another stick. I know
> that different XSLT processors aren't obliged (or even likely) to return
> the same value for generate-id called on a given node, but is it in fact
> permissible for the same processor to return a different generated id
> for the same node on different runs? If so, I have a whole lot of
> problems lurking that I'm not prepared for. So far, Xalan has always
> behaved deterministically, returning the same value for identical nodes
> in identical contexts over different runs. I was careless enough to
> assume things were meant to be that way, and I've quite a bit of
> important code that will break if that assumption ever proves false.

Acccording to the spec "An implementation is under no obligation to generate the
same identifiers each time a document is transformed."

This is exactly the case with MSXML -- as recently explained by Andrew Kimball in
one of the MS newsgroups, "MSXML implements generate-id() by simply taking the
address of the node in memory and converting it to a base-32 string.  There are some
special cases having to do with default attributes and namespace nodes that require
special handling, but the basic operation is very fast.  I'm not surprised that 
it's faster than the count() method."

The memory address (for a COM object this is most probably the address of its
IUnknown interface) of an object will be different on different transformations.

Cheers,
Dimitre Novatchev.


__________________________________________________
Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger
http://phonecard.yahoo.com/

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread