[XQuery Talk Mailing List Archive Home] [By Date] [By Thread] [By Subject] [By Author] [Recent Entries] [Reply To This Message]

Context item dependant function in a step of a pathexpression

Michael Kay mike at saxonica.com
Sat Aug 18 17:24:48 PDT 2007


  Context item dependant function in a step of a
	pathexpression
The string() function is called once for each item in $a/B. There are no
items in $a/B, so string() is called zero times, so it doesn't matter what
its arguments are. Similarly, because $a/B/string() is an empty sequence,
the string-length() function is called zero times, so it doesn't matter what
its arguments are either.

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

> -----Original Message-----
> From: http://x-query.com/mailman/listinfo/talk 
> [mailto:http://x-query.com/mailman/listinfo/talk] On Behalf Of Pierrick Brihaye
> Sent: 17 August 2007 21:46
> To: http://x-query.com/mailman/listinfo/talk
> Subject:  Context item dependant function in a 
> step of a pathexpression
> 
> Hi,
> 
> With Saxon 8.9J, this XQuery :
> 
> let $a := <A/>
> for $b in $a/B/string()
> return string-length($b)
> 
> ... returns an empty sequence (0, if wrapped by count()).
> 
>  From http://www.w3.org/TR/xpath-functions/#func-string :
> 
> > If no argument is supplied, the context item (.) is used as the 
> > default argument. The behavior of the function if the argument is 
> > omitted is exactly the same as if the context item had been 
> passed as 
> > the argument.
> 
> then
> 
> > If $arg is the empty sequence, the zero-length string is returned.
> 
> I would thus have expected 0 as the result (1, if wrapped by 
> count()) since I understand the context item as being 
> "empty"... which is a concept which is not very conformant 
> with the specs I conceed.
> 
> But, maybe, the processing of a context item dependant 
> function when there is no context item (which is not the same 
> as being an "empty" 
> context item and would thus be more conformant with the specs 
> I guess) has to be skipped ; that would explain Saxon's 
> behaviour (and make much sense BTW)...
> 
> In such a case, how would such a behaviour cope with the 
> specs ? I couldn't find anything that would answer to this question.
> 
> Thank you for your answers,
> 
> Cheers,
> 
> p.b.
> 
> 
> 
> 
> 
> 
> _______________________________________________
> http://x-query.com/mailman/listinfo/talk
> http://x-query.com/mailman/listinfo/talk



Purchase Stylus Studio Online Today!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2007 All Rights Reserved.