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

RE: Variable references in path expressions

From: Michael Rys <mrys@microsoft.com>
Date: Thu, 28 Apr 2005 12:01:14 -0700
Message-ID: <BAE415CEAA831548800F68C44E905AF501FA5FFC@RED-MSG-60.redmond.corp.microsoft.com>
To: "Michael Kay" <mhk@mhk.me.uk>, "martin" <martin@x-hive.com>
Cc: "TAN Kuan Hui" <kuanhui@xemantics.com>, "Charles Brooking" <charles.brooking@research.canon.com.au>, <www-ql@w3.org>

That reminds of a recent conference paper I reviewed that was writing
/$a/$b/$c all the time as XPath expressions. It took me a while to
understand that they actually meant it would parameterize the path
expression....

Best regards
Michael

> -----Original Message-----
> From: www-ql-request@w3.org [mailto:www-ql-request@w3.org] On Behalf
Of
> Michael Kay
> Sent: Thursday, April 28, 2005 3:07 AM
> To: 'martin'
> Cc: 'TAN Kuan Hui'; 'Charles Brooking'; www-ql@w3.org
> Subject: 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 19:01:24 UTC

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