Errata

Java and XSLT

Errata for Java and XSLT

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 Example 5.7
CSVXMLReader.java

Not sure what's changed but with the current version of Xalan (2.4.1) the
CSVXMLReader needs modification. It runs fine with one argument to produce straight
xml. However if you run it with the xslt as the second arg the only output you get is
a blank table.

I managed to get things to work by changing the calls to startElement() and
endElement() :

Was :
ch.startElement("","","csvFile",EMPTY_ATTR);
Becomes:
ch.startElement("","csvFile","csvFile",EMPTY_ATTR);

Similarly:
ch.endElement("","","csvFile");
Becomes
ch.endElement("","csvFile","csvFile");

Repeated for calls on "line" and "value".

BTW not sure if you know but a very similar csv parser is apparently authored by Matt
Liotta
http://archive.devx.com/java/free/articles/ml040802/ml040802-1.asp

I can't see any acknowledgement to your work in his article which I think is most
unprofessional on his part.

Anonymous   
Printed Page 2
fig 1.1

Database component should appear on the right and Web browser should appear
on the right.

Anonymous   
Printed Page 2
Figure 1.1

The flow on the figure is incorrect.

XML Data should be coming from the Database - not the Web Browser!

HTML output should be going to the Web Browser - not the Database!

Anonymous   
Printed Page 21-23
Example 1-5

Change all addAttribute() to setAttribute().

Same errors [addAttribute()]in downloaded source code LibraryJDOMCreator.java. Source
code for class LibraryJDOMCreator also have extra brackets "(" at lines 58,59,66 and
68.

Anonymous   
Printed Page 30
end of "SAXON" section

On the command line to transform the presidents.xml file, the stylesheet is named
"presidents.xslt". There is no such file in the examples. Works fine with
"presidentsToCSV.xslt".

Anonymous   
Printed Page 31
5th paragraph on browser plug-ins

I would like a web site or list of browser plug-ins that currently exist that support
XSLT. I have a Linux machine running Netscape 6.2, which seems to work with XSLT. I do
most of my work on my iMac and using IE 5.1 on Mac OS X does not have MSXML available.
I am willing to use another browser if I could find one that works. Maybe even a list
of web browsers and how to get them to work with XSLT in a development environment as
that would be very helpful. I may try using Opera next on my iMac to see if it works.

Anonymous   
Printed Page 31
4th paragraph on Netscape

Netscape 6.2 supports XSLT to some extent as I can load XML files directly in the
browser and they work to some extent.

Anonymous   
Printed Page 40
2nd Paragraph

Under "Trying It Out", the text tells the reader to add "erces.jar" to their
classpath. This should probably be "xerces.jar"

Anonymous   
Printed Page 40
Paragraph: trying it out

intead of "chap 1" there should be chap 2
Printing date: Sept 2001

Anonymous   
Printed Page 50
near top (html tag)

The xmlns attribute of the html tag should be moved to the xsl:stylesheet tag (where
the xsl namespace is defined). Otherwise, some of the tags in the output won't have a
namespace; and, therefore, the page will not be rendered correctly in some browsers
(i.e Mozilla).

Anonymous   
Printed Page 50
line 15 in source for schedule.xslt containing "<xml:text"

&amp;nbsp; does not work with Netscape 6.2 when I try to load the schedule.xml
directly. It produces "Eric&nbsp;Burke's Schedule". I understand from the text
how it should work, but it does not. It only works when I change this line to:

<xml:text> </xml:text>

When I create the schedule.xhtml by using the following java command and loading it into
any web browser it works correctly:

$ java -classpath /home/rick/xerces/xercesImpl.jar:/home/rick/9780596001438/lib/xalan_2.1.jar:/home/rick/javaxslt/lib/jaxp_1.1.jar:/home
/rick/9780596001438/lib/jdom_beta6.jar org.apache.xalan.xslt.Process -IN schedule.xml -XSL schedule.xslt > schedule.xhtml

Anonymous   
Printed Page 50
line 15 in source for schedule.xslt containing "<xml:text"

&amp;nbsp; should be &amp;&nbsp;

Anonymous   
Printed Page 57
presidents.xml in downloaded examples

The presidents.xml file as it exists in the downloaded ZIP file points to an
non-existing XSLT file:

<?xml-stylesheet type="text/xsl" href="chap9/stress.xslt"?>

should point to the one listed on page 57 as Example 2-8:

<?xml-stylesheet type="text/xsl" href="chap2/xpathExamples.xslt"?>

Anonymous   
Printed Page 60
1st paragraph

The XPath expression

//name

selects all name descendants of the *root node*, not of
the context node as stated.

.//name selects all name descendants of the context node

Anonymous   
Printed Page 64
<xsl:attribute> paragraph

The chap2/links.xslt does not matching the book and it generates invalid HTML:

<xsl:attribute name="href">
http://www.amazon.com/exec/obidos/ASIN/
<xsl:value-of select="@isbn"/>
</xsl:attribute>

It produces links with spaces and tabs in them which never work:

<a href="%0A%09%09%09%09%09http://www.amazon.com/exec/obidos/ASIN/%0A%09%09%09%09%091565927095">XML Pocket Reference</a>

The code work if changes to match the book contents of:

<xsl:attribute name="href">
<xsl:text>http://www.amazon.com/exec/obidos/ASIN/</xsl:text>
<xsl:value-of select="@isbn"/>
</xsl:attribute>

Anonymous   
Printed Page 69
Example 3-1 (continued) line 26

Typo:
The line is '<xsl:text> disable-output-escaping="yes">'
but should: '<xsl:text disable-output-escaping="yes">'.

Anonymous   
Printed Page 71
example continued - top of page line 1

Typo:
The line is '<xsl:text> disable-output-escaping="yes">'
but should: '<xsl:text disable-output-escaping="yes">'.

Anonymous   
Printed Page 77
4th paragraph

missing the <xml:param name="ssn" select="'000000000'"/> line in the Example 3-3
namedTemplate.xslt. The example code downloaded in the ZIP file has the line but
it is missing in the book. It should be the first line at the top of page 77, in
Example 3-3 namedTemplate.xslt (continued).

Anonymous   
Printed Page 83
Example 3-7 lines 12 and 23

Typo:
The line is '<xsl:text> disable-output-escaping="yes">'
but should: '<xsl:text disable-output-escaping="yes">'

Anonymous   
Printed Page 95
Example 3-12

When I create the resulting XSLT file I see a formatting difference that is strange.
It seems like the following lines are not processing correctly when using indent="yes":

<xsl:element name="text">
<xsl:value-of select="@text"/>
</xsl:element>

When I run the following command:

java -classpath /home/rick/xerces/xercesImpl.jar:/home/rick/9780596001438/lib/xalan_2.1.jar:/home/rick/javaxslt/lib/jaxp_1.1.jar:/home/r
ick/9780596001438/lib/jdom_beta6.jar org.apache.xalan.xslt.Process -IN log.xml -XSL schemaChange.xslt > result.xslt

I see the following lines in result.xslt:

<message type="ERROR">
<text>input parameter was null</text>

<timestamp time="03:12:18" day="15" month="01" year="2000"/>

For some reason the line before timestamp has TABs in it and the <text> line does not. This is a minor point, but I am trying to le
arn and understand XSLT so I can use it on a major project I am working on.

Anonymous   
Printed Page 155
Middle Figure 5-3

Figure 5-3 on the right side it depicts the JAXP Result interface. It subclasses this with a DOMResult, StreamResult, and SAXResult. Under the StreamResult java.io.File, java.io.InputStream, and java.io.Reader are specified. These are incorrect. Since it is a Result interface these should be java.io.File, java.io.OutputStream, and java.io.Writer.

Anonymous   
Printed Page 174
Example 5-9 line 24

Typo:
The line reads '<xsl:text> disable-output-escaping="yes">'
but shound read '<xsl:text disable-output-escaping="yes">'.

Anonymous   
Printed Page 179
Figure 5-6

At bottom of the figure, there is a space missing in the text and should be "Many users/threads can share".

Anonymous   
Printed Page 191
1st paragraph

jar -cvfM ../appname.war
should be
jar -cvfM ../appname.war *
A minor typo, but it caused some puzzling error messages and took me about an hour of
work to sort out - luckily I had another servlets book that had the answer.

Anonymous   
Printed Page 271
MySQL dump

I understand that MySQL table names are case sensitive under Unix. I am running Redhat Linux 7.1.

The file discussion/design/mysql_forum_dump.txt uses lower case for table names, but the Java source code uses mixed case for the table names. I imported the text file to generate the tables, and this caused errors when running the forum app to the effect that the table did not exist.

Changing the text file to use mixed case tables names and then recreating the database solved the problem.

{example code}
This is a problem with the example presidents.xml file in the examples. It points to an xslt file that doesn't exist:

<?xml-stylesheet type="text/xsl" href="chap9/stress.xslt"?>

when i open in Internet Explorer I get this error:

The system cannot locate the object specified. Error processing resource 'file://C:xslt9780596001438_examples_02Sep2001javaxsltchapterschap9stress.xslt'.

Tried searching all the files, but none appears.

i downloaded the zip version.

Anonymous   
Printed Page 507
middle of second column

The page number for the index item "XML to XML" under "transformations" should read
"91" rather than "90".

Anonymous