XQuery

Errata for XQuery

Submit your own errata for this product.


The errata list is a list of errors and their corrections that were found after the product was released. If the error was corrected in a later version or reprint the date of the correction will be displayed in the column titled "Date Corrected".

The following errata were submitted by our customers and approved as valid errors by the author or editor.

Color Key: Serious Technical Mistake Minor Technical Mistake Language or formatting error Typo Question Note Update



Version Location Description Submitted By Date Submitted Date Corrected
Printed
Page 4
Example 1-6

The right-hand side of the 'let' statement refers to 'named'. Should that be 'name'? let $name := $product/named vs. let $name := $product/name

Anonymous   
Printed
Page 8
Second paragraph from bottom

The end of the sentence should read "h1 element" not "ul element", so the sentence is "The content outside the curly braces, namely the strings "There are " and " products." appear literally in the results, as textual content of the h1 element.

Anonymous   
Printed
Page 34
2nd paragraph in "Useful Function" box

The description of the function states that it performs a "value comparison", but the source code shows it as performing a "general comparison".

Anonymous   
Printed
Page 38
Table 3-5

There is an extra space in the path expression in the third row of the first column of Table 3-5. I think it should be: not(doc("catalog.xml")/catalog/product)

Anonymous   
Printed
Page 45
last row of Table 4-4

Page 45, last row of Table 4-4: 'parent::node/number' should be 'parent::node()/number'.

Pekka Kilpeläinen  Apr 13, 2009 
Printed
Page 45
Table 4-4

In Table 4-4 of page 45 child::product/descendant::name = product//name However on the end of page 48 it states that there is difference between doc("catalog.xml")/catalog/descendant::name[1] and doc("catalog.xml")/catalog//name[1] Is here not a conflict?

Note from the Author or Editor:
Adding the [1] changes things. The two examples from Table 4-4 do return the same result. Once you add the [1], though, you are talking about the first item that is returned by the step. In the first case, all the descendants are returned by the step at once, so the first item is the first name descendant anywhere in the document. In the second case, each name element is returned by the step individually, as a child of its parent, so you only get the name children that are first child in each parent. Technically, to be more of an exact comparison, Table 4-4 should say: child::product/descendant-or-self::*/name = product//name

Anonymous  Nov 19, 2010 
Printed
Page 79
line 6-7

Page 79, line 6-7: It is erroneous, or at least misleading, to say that a variable "should not be referenced in the let clause itself, as in: let $count := $count + 1 ". The above does not refer to the variable $count that is being declared. According to Section 3.8.1 of the XQuery 1.0 Recommendation, "The scope of a variable bound in a for or let clause [...] does not include the expression to which the variable is bound." Thus, the right-hand side of the above let clause either (a) refers to a previously declared $count variable or (b) it is erroneous (XPST0008: Variable $count has not been declared).

Note from the Author or Editor:
The end of the first paragraph on page should be changed from "and it should not be referenced in the let clause itself, as in:" to "and it cannot be referenced in the let clause itself, as in:" (should not --> cannot). Also, the first sentence of second paragraph should be changed from "This is not illegal, but it will have unexpected..." to "This is not illegal, but it is actually declaring a new variable with the same name, so it will have unexpected..."

Pekka Kilpeläinen  Apr 13, 2009 
Printed
Page 108
Example 8-2

let $actualDiscount := min(($maxDiscount, $discount)) should be let $actualDiscount := min(($maxDiscount, $newDiscount)) $discount => $newDiscount

Anonymous  Nov 23, 2010 
Printed
Page 158
3rd paragraph

same heading as paragraph 4 of page 158 Suggestion: Casting from xs:string or xs:untypedAtomic

Anonymous   
Printed
Page 299
1st paragraph

(matches($prod/name, 'F.*') or matches($prod/name, 'G.*')) should be (matches($prod/name, '^F') or matches($prod/name, '^G')) F.* => ^F G.* => ^G

Note from the Author or Editor:
Yes, and two examples later there is another place where "F.*" should be changed to "^F".

Anonymous  Dec 03, 2010