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 29187 - [editorial] Errors in string constructor examples
Summary: [editorial] Errors in string constructor examples
Status: RESOLVED FIXED
Alias: None
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: XQuery 3.1 (show other bugs)
Version: Proposed Edited Recommendation
Hardware: PC All
: P2 normal
Target Milestone: ---
Assignee: Jonathan Robie
QA Contact: Mailing list for public feedback on specs from XSL and XML Query WGs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-10-08 14:54 UTC by Josh Spiegel
Modified: 2015-10-08 21:41 UTC (History)
0 users

See Also:


Attachments

Description Josh Spiegel 2015-10-08 14:54:57 UTC
See:
https://lists.w3.org/Archives/Public/public-xsl-query/2015Oct/0034.html

(1)

    This is missing a back tick in the close of the string constructor:

      ``[`{ $i, ``[literal text]``, $j, ``[more literal text]`` }`]`

(2)

This example is a mix of XQuery and JSON:

    {
      "name": "Chris",
      "value": 10000,
      "taxed_value": 10000 - (10000 * 0.4),
      "in_ca": true
   }

Should it be?

   map {
      "name": "Chris",
      "value": 10000,
      "taxed_value": 10000 - (10000 * 0.4),
      "in_ca": true()
   }

(3) 

This example:

declare function local:prize-message($a) as xs:string
{
``[Hello `{$a.name}`
You have just won `{$a.value}` dollars!
…

Has the wrong lookup operator syntax.  It should be:

declare function local:prize-message($a) as xs:string
{
``[Hello `{$a?name}`
You have just won `{$a?value}` dollars!
…

(the same applies to the following 2 prize-message functions)

(4) 

For the <div> example, there are two spaces before the closing </div>.  I would remove the two spaces and then correct the output whitespace to this:

<div>
    <h1>Hello Chris</h1>
    <p>You have just won 10000 dollars!</p>
    <p>Well, 6000 dollars, after taxes.</p> 
</div>

(5) There is no indenting in the final prize-message function. 

(6) The final prize-message function is missing an interpolation: $a.value should be `{$a?value}`
Comment 1 Jonathan Robie 2015-10-08 21:41:18 UTC
Thanks! I just committed a fix.