logo       

RE: some ... satisfies with positional variable: msg#00021

Subject: RE: some ... satisfies with positional variable
$fs:dot should not be accessible in XQuery directly. It is a
definitional construct of the formal semantics. You would write .
Instead. Also, for-clauses do not bind the context item. So if your
queries below work, your engine has a problem.

Best regards
Michael 

> -----Original Message-----
> From: talk-bounces-KUd/JJajPrLQT0dZR+AlfA@xxxxxxxxxxxxxxxx 
> [mailto:talk-bounces-KUd/JJajPrLQT0dZR+AlfA@xxxxxxxxxxxxxxxx] On Behalf Of 
> Benedikt Linse
> Sent: Friday, August 19, 2005 12:22 PM
> To: talk-KUd/JJajPrLQT0dZR+AlfA@xxxxxxxxxxxxxxxx
> Subject: [xquery-talk] some ... satisfies with positional variable
> 
> Hello,
> 
> Here's a question about an XQuery language construct I would 
> appreciate.
> 
> in for-clauses it is possible to include a positional 
> variable and return
> the context node $fs:dot - or any other node - based on the 
> position of
> its child elements.
> 
> for $x at $pos in child::tag0 return
>     if ($pos > 3) then return $fs:dot
> 
> If the context node has more than 4 children, the above 
> expression will
> return it more than once. This could be avoided by wrapping 
> the result in
> a distinct-doc-order function, but it wouldn't prevent the 
> compiler from
> executing extra work, does it?
> 
> Without positional variables extra work can be evaded by 
> using the some
> ... satisfies ... clause:
> 
> if (some $x in child::* satisfies (fn:node-name($x) == "tag2")))
> then $fs:dot
> else ()
> 
> This works fine, but I cannot include a positional variable in the
> conditional. What I need is a "some ... at ... in ... satisfies ... "
> construct similar to the following:
> 
> epxr1 =
> 
> if (some $x at $pos in child::* satisfies ($pos > 3))
> then $fs:dot
> else ()
> 
> But this is not provided by XQuery. XPath expressions won't help since
> they're normalized to for, if-clauses, etc.
> 
> Is there a special reason why a "some ... at ... in ... satisfies ..."
> construct is not provided by XQuery?
> 
> Is there any possibility to express expr1 in a way that no duplicate
> elements are returned?
> 
> Best regards,
> 
> Benedikt
> 
> 
> 
> _______________________________________________
> talk-KUd/JJajPrLQT0dZR+AlfA@xxxxxxxxxxxxxxxx
> http://xquery.com/mailman/listinfo/talk
> 



<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
boot-loaders.gr...    php.pear.genera...    debugging.valgr...    kde.redhat.user...    text.xml.xsl.ge...    culture.languag...    hardware.microc...    java.servicemix...    redhat.release....    web.zope.plone....    user-groups.lin...    opendarwin.webk...    video.mjpeg.use...    sysutils.bcfg2....    encryption.gpg....    lx-office.devel...    xfree86.forum/2...    mail.mutt.devel...    acpi.devel/2003...    qnx.openqnx.dev...    network.irc.irs...    freebsd.devel.m...   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe