RE: Variable references in path expressions

> 
> I might be mistaken, but I think he wants to do this:
>  > let $a := (<a/>,<b/>,<c/>)
>  > let $b := (xs:QName("b"), xs:QName("c"))
>  > return $a/$b
> .. would lead to $a being filtered by $b's QNames on the 
> child axis, so 
> the result would be <b/>,<c/> (e.g. what you would get by 
> $a/element($b)). I've noticed that some people tend to understand 
> Variable references in XQuery PathSteps this way.

Yes, it's common enough for people to think that a variable holds a fragment
of an XPath expression that's treated as a macro and handled using textual
substitution. You see this a lot with people trying to write <xsl:sort
select="$sortkey"/> in XSLT. They've probably used other languages such as
shell scripts that use $ to introduce a macro variable.

But I didn't recognize that particular error here!

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

Received on Thursday, 28 April 2005 10:08:06 UTC