W3C home > Mailing lists > Public > www-ql@w3.org > April to June 2005

RE: Variable references in path expressions

From: Michael Kay <mhk@mhk.me.uk>
Date: Thu, 28 Apr 2005 11:07:07 +0100
To: "'martin'" <martin@x-hive.com>
Cc: "'TAN Kuan Hui'" <kuanhui@xemantics.com>, "'Charles Brooking'" <charles.brooking@research.canon.com.au>, <www-ql@w3.org>
Message-ID: <E1DR5w3-00009B-Lr@maggie.w3.org>

> 
> 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

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 20:17:17 UTC