This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 9532 - Invalid example in section B.3.
Summary: Invalid example in section B.3.
Status: CLOSED FIXED
Alias: None
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: Scripting Extensions 3.0 (show other bugs)
Version: Working drafts
Hardware: PC Linux
: P2 normal
Target Milestone: ---
Assignee: John Snelson
QA Contact: Mailing list for public feedback on specs from XSL and XML Query WGs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-04-15 20:39 UTC by Nikolay Ognyanov
Modified: 2010-05-13 21:00 UTC (History)
1 user (show)

See Also:


Attachments

Description Nikolay Ognyanov 2010-04-15 20:39:15 UTC
The example in section B.3.1. is apparently meant to be

let $uid := doc("users.xml")/users/user_tuple[name = "Roger Smith"]/userid
let $topbid := max(doc("bids.xml")/bids/bid_tuple[itemno = 1007]/bid)
let $newbid := $topbid * 1.1
return
  if($newbid <= 240) then block {
    insert nodes
      <bid_tuple>
        <userid>{ data($uid) }</userid>
        <itemno>1002</itemno>
        <bid>{ $newbid }</bid>
        <bid_date>1999-03-03</bid_date>
      </bid_tuple>
    into doc("bids.xml")/bids;
    exit returning <new_bid>{ $newbid }</new_bid>;
  } else block {
    exit returning <top_bid>{ $topbid }</top_bid>;
  }

but is missing "block" in front of blocks.

Transformed representation in B.3.3. is also missing the ';' terminator at the end of apply expressions.
Comment 1 John Snelson 2010-04-19 22:35:43 UTC
I can confirm this error, which appears in the XQueryX appendix:

http://www.w3.org/TR/2010/WD-xquery-sx-10-20100408/#id-xqsx-xqueryx-xq-rep
Comment 2 Jim Melton 2010-05-13 01:06:21 UTC
Thanks for this report.  The example in B.3.1 is indeed missing the now-required keyword "block" preceding the open brace "{" of a block.  That will be fixed in the next publication of the XQuery Scripting Extension spec.  Although you didn't mention it, the omission also occurs in the generated XQuery text in B.3.3; that omission will also be corrected in the next publication. 

The transformed representation in B.3.3 is, as you point out, missing the ";" following the two "apply expressions" in the 'then' branch of the 'if'.  Research into why they were missing revealed a couple of subtle bugs in the XML schema and the stylesheet, which will also be corrected in the next publication. 

Based on the corrections I've made, I've marked this bug as RESOLVED/FIXED.  If you trust my statement that the change has been made, please mark the bug as CLOSED.  If not, then try to remember to mark it CLOSED when we do publish the next draft of the XQuery Scripting Extension document and you can confirm the fixes.
Comment 3 Nikolay Ognyanov 2010-05-13 21:00:58 UTC
Thank you.

Regards
Nikolay