Errata

XSLT Cookbook

Errata for XSLT Cookbook

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.

The following errata were submitted by our customers and have not yet been approved or disproved by the author or editor. They solely represent the opinion of the customer.

Color Key: Serious technical mistake Minor technical mistake Language or formatting error Typo Question Note Update

Version Location Description Submitted by Date Submitted
Printed Page 2
Page 2

This example has an error. I used the expression provided in the text on page 2 to select X elements and got no results in XMLSpy. The reason I tried was because I was certain the expression 'X' to select all child elements named X was not right. It should be //X. Below is the example presented in the book.

<Test id="descendants">
<parent>
<X id="1"/>
<X id="2"/>
<Y id="3">
<X id="3-1"/>
<X id="3-2"/>
<X id="3-3"/>
</Y>
<X id="4"/>
<X id="5"/>
<X id="6"/>
<X id="7"/>
<X id="8"/>
<X id="9"/>
</parent>
</Test>




Anonymous  Feb 10, 2017 
Printed, PDF, ePub Page 197
Bottom of page

The last part of the example for recipe 6.4 reads

<!-- z is a sequence of one or more strings. -->
<xsl:variable name="z" select="para[1]" as="xs:string?"/>

However, the question mark indicates that an element occurs once or not at all. The comment should read

<!-- z is a sequence of zero or one strings -->

Matthew Halverson  May 19, 2016 
Printed Page 282
Example 8-5

This example does not work as written, and the second version on the page can't be fixed. The simple fix for the first version is to drop the import of copy.xslt and change "apply-templates" to "copy-of". Alternatively, the copy.xslt template must be modified:

xsl:copy --> xsl:copy-of

Patrick Goetz  Apr 06, 2015 
Printed Page 205
last body paragraph

In the last body paragraph, I believe that instead of saying:

"The child element xsl:matching-substring is used to process the substring that matches the regex and xsl:non-matching-substring is used to process the substrings that match the regex..."

it should say something like:

"The child element xsl:matching-substring is used to process the substring that matches the regex and xsl:non-matching-substring is used to process the substrings that *don't* match the regex."

Also, in the fourth line, "parenthesis" should be "parentheses".

Anonymous  Sep 26, 2009 
Printed Page 376
10.2 Solution

The reference to SalesBySalesPerson.xml should point to Chapter 5, not Chapter 2.

Scott Vanderbilt  Aug 08, 2009 
Printed Page 153
Last paragraph

Incorrect reference. The paragraph says

Recipe 4.8

But the referenced template is in 4.7

Anonymous  May 22, 2009 
Printed Page 689
code example

<xsl:call-template name="{$aTemple}">
^^
should read

<xsl:call-template name="{$aTempl}">
^^

Prof. Dr. Dietmar Roesner  Jan 27, 2009 
Printed Page 474
2nd paragraph

Third to last line of the paragraph, Chapter 12 should be Chapter 13

Mark Ensign  Jan 19, 2009 
Printed Page 31
second comment in first code block

I think the second comment in the first code block on page 31 (8th line) should be changed from:

<!-- If it still contains the search string the recursively process -->

to:

<!-- If it still contains the search string then recursively process -->

Anonymous  Nov 28, 2008 
Printed Page 102
2nd paragraph

"The variance is then (sum-sq - sum2 / count) / count - 1" is formatted incorrectly and may cause readers to read the formula incorrectly.

Solution: the "2" in "sum2" should be superscript in order to indicate "sum", defined previously, should be squared.

Alternatively, write the sentence as:
"(sum-sq - (sum*sum) / count) / count - 1"

Anonymous  Aug 27, 2008 
Printed Page 104
xsl:function ckbk:variance

Missing "(" in xsl:sequence/@select attribute in ckbk:variance function.

Function definition should be:

<xsl:function name="ckbk:variance" as="xs:double">
<xsl:param name="nodes" as="xs:double*"/>
<xsl:variable name="sum" select="sum($nodes)"/>
<xsl:variable name="count" select="count($nodes)"/>
<xsl:sequence select="if ($count lt 2)
then 0
else
(sum(for $i in $nodes return $i * $i) -
$sum * $sum) div
($count * $count - $count)"/>
</xsl:function>

Anonymous  Aug 27, 2008 
Printed Page 103
XSLT 2.0 ckbk:median function

XSLT 2.0 <xsl:function name="ckbk:median"> is incomplete.

The last few lines of this function were not included.

Possible correction:
<xsl:function name="ckbk:median">
<xsl:param name="nodes" as="xs:double*" />

<xsl:variable name="count" select="count($nodes)"/>
<xsl:variable name="middle" select="ceiling($count div 2)"/>

<xsl:variable name="sorted" as="xs:double*">
<xsl:perform-sort select="$nodes">
<xsl:sort data-type="number"/>
</xsl:perform-sort>
</xsl:variable>
<xsl:sequence select="if (ceiling($count mod 2)=0) then ($sorted[$middle] + $sorted[$middle - 1]) div 2 else $sorted[$middle]"/>
</xsl:function>

Anonymous  Aug 27, 2008 
Printed Page 101
Median Function ckbk:median

4th paragraph
"On the other hand, if the number of nodes is odd,..."
should be:
"On the other hand, if the number of nodes is even,..."

Anonymous  Aug 27, 2008 
Printed Page 13
5th line of example following 3rd paragraph

"<xsl:otherwise>small</xsl.when>"

should read as follows:
"<xsl:otherwise>small</xsl.otherwise>"

Anonymous   
Printed Page 22
First line of third bullet

An "if" or a "when" is missing between "more" and "they are".

Anonymous   
Printed Page 209
top example

The <xsl:output-character> element has an attribute *char* in this example, but in
the XSL Transformations (XSLT) Version 2.0 W3C, Candidate Recommendation 8 June 2006
(http://www.w3.org/TR/xslt20/#element-output-character) the corresponding attribute
is called *character*.

Anonymous   
Printed Page 282
copy.xslt

This is actually an error in the files distributed online for version 2 of this
book (Chapter 8, copy.xslt). It shows the select statement as

select "@*, node()"

That gives a parser error.

Anonymous   
Printed Page 298
4th para

The solution says to use "salesBySalesPerson.xml from Chapter 4",
but the file is in Chapter 5.

Anonymous   
Printed Page 340
1st line of example 9-11

reviews> is missing the left angle bracket

Anonymous   
Printed Page 369
2nd line of 10.1 Solution code

line reads

<?xml-stylesheet type="application/xml" href="chapter.xsl"?>

The "application/xml" type breaks the example in IE7. "text/xsl" should be used instead, which works in both IE and Firefox.

Anonymous