Re: References in XPath that can be represented by a string andstill can be garbage collected

Dimitre Novatchev <[email protected]> Thu, 18 Dec 2008 09:10:15 -0800 (PST)
Newsgroups gmane.text.xml.xslt.extensions
Message-ID <[email protected]>
> 
> I seem to be having trouble explaining this. The problem is that the result
> of the expression
> 
> (ref($RM, $N), deref(RM, 'n123'))
> 
> depends on the order of evaluation of the two subexpressions.


This doesn't mean such objects cannot and should not be used in a useful way.

Even in "pure" XSLT we already have something similar:

 For this transformation:

<xsl:stylesheet version="2.0"
 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
 xmlns:xs="http://www.w3.org/2001/XMLSchema"
 xmlns:f="my:f"
 >
 
 <xsl:template match="/">
   <xsl:value-of select="(f:makeNode(), f:makeNode())/generate-id()"/>
 </xsl:template>
 
 <xsl:function name="f:makeNode">
   <myNode/>
 </xsl:function>
</xsl:stylesheet>

the result from Saxon 9.0.0.2J is:

d6e0 d6e2

If we have:

<xsl:value-of select="generate-id((f:makeNode(), f:makeNode())[last()-1])"/>

depending on the order of evaluation we could get either:

  d6e0

or 

  d6e2


To summarize, using XSLT 2.0 there could be cases of getting different results depending on the order of evaluation. This is something standard that we know about and it evidently does no harm.

In this respect an RM object brings nothing new.
  
Cheers,
Dimitre


> 
> Michael Kay
> http://www.saxonica.com/
> 
> _______________________________________________
> exslt mailing list
> [email protected]
> http://www.exslt.org/list