Re: About node references

"Michael Kay" <[email protected]> Mon, 15 Dec 2008 21:07:10 -0000
Newsgroups gmane.text.xml.xslt.extensions
Message-ID <3A939BA4DE58416AB8C7A11B4B0B629B@Sealion>
> What use case do we have for flatten()? It seems that just 
> using deref() is sufficient and also there might be cases 
> when flattening a sequence and processing it may have 
> different results than when processing and dereferencing on the go.

Reasonable question. There was a proposal that refs should be implicitly
dereferenced based on the expected type, similar to atomization, and in that
case it seems to be only a recursive dereference that makes sense. It can be
user-written, so it's not a big loss to drop it for now.
> 
> 
> I would like to add the function I already proposed:
> 
>    string refCopy(ref)
> 
> which is to be used any time we want to copy/save a ref. 
> Dereferencing a copied/saved ref will be guaranteed to be 
> successful only for strings obtained from refCopy(). This 
> eliminates the "leakage" problem.

Sorry, I absolutely don't understand how you see this working.

When you say a "string obtained from refCopy()", I'm not sure what you mean.
Would it also work on

codepoints-to-string(string-to-codepoints(refCopy(x))?

Michael Kay
http://www.saxonica.com/