Bug 51028 - Build fails if Saxon 9 is on Ant's classpath
Summary: Build fails if Saxon 9 is on Ant's classpath
Status: RESOLVED FIXED
Alias: None
Product: Tomcat 7
Classification: Unclassified
Component: Packaging (show other bugs)
Version: trunk
Hardware: PC Windows XP
: P2 normal (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-04-06 05:13 UTC by Michael Osipov
Modified: 2011-04-06 10:38 UTC (History)
0 users



Attachments
Build failure logfile (8.03 KB, application/octet-stream)
2011-04-06 05:13 UTC, Michael Osipov
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Osipov 2011-04-06 05:13:52 UTC
Created attachment 26860 [details]
Build failure logfile

I am not able to build Tomcat with "ant release" because the XSL stylesheets fail with saxon. They contain illegal chars.

If I remove Saxon from Ant's classpath the work again. So there something with the stylesheets and Saxon.
I have found this post from Michael Kay which says that the stylesheets are invalid and have to be fixed: http://web.archiveorange.com/archive/v/rNJIEC48MBLYfxAORgpH
A logfile is attached too.
Comment 1 Sebb 2011-04-06 07:00:33 UTC
Which version of Tomcat7 ?

I've had a look at the file in SVN and the current XSL code does not match what you are reporting.

What does the $Id line near the top of the XSL file say? 
It should start like this:

<!-- $Id: tomcat-docs.xsl
Comment 2 Mark Thomas 2011-04-06 07:07:07 UTC
Reduce severity since, assuming this issue is valid, there is a simple workaround (remove Saxon from Ant's classpath).
Comment 3 Michael Osipov 2011-04-06 09:11:14 UTC
(In reply to comment #1)
> Which version of Tomcat7 ?
> 
> I've had a look at the file in SVN and the current XSL code does not match what
> you are reporting.
> 
> What does the $Id line near the top of the XSL file say? 
> It should start like this:
> 
> <!-- $Id: tomcat-docs.xsl

SVN revision is 1089355
$Id$ of file is <!-- $Id: tomcat-docs.xsl 1036949 2010-11-19 17:18:04Z markt $ -->
Comment 4 Michael Osipov 2011-04-06 09:12:04 UTC
(In reply to comment #2)
> Reduce severity since, assuming this issue is valid, there is a simple
> workaround (remove Saxon from Ant's classpath).

This cannot be done unless you have root priviliges on the System to modify the global installation. Eventhough if I had, the removal would affect others.
Comment 5 Michael Osipov 2011-04-06 09:15:55 UTC
(In reply to comment #1)
> Which version of Tomcat7 ?
> 
> I've had a look at the file in SVN and the current XSL code does not match what
> you are reporting.
> 
> What does the $Id line near the top of the XSL file say? 
> It should start like this:
> 
> <!-- $Id: tomcat-docs.xsl

I am building from trunk.
Comment 6 Sebb 2011-04-06 09:27:47 UTC
The relevant part of the log file says:

     [xslt] Processing E:\Projekte\tomcat-trunk\webapps\docs\changelog.xml to E:\Projekte\tomcat-trunk\output\build\webapps\docs\changelog.html
     [xslt] E:\Projekte\tomcat-trunk\webapps\docs\tomcat-docs.xsl:470: Fatal Error! Illegal HTML character: decimal 150

Line 470 of tomcat-docs.xsl is

  <xsl:template match="changelog/fix">
    <tr>
      <xsl:variable name="src"><xsl:value-of select="$relative-path"/>/images/fix.gif</xsl:variable>
      <td><img alt="fix" class="icon" src="{$src}"/></td>
      <td><xsl:apply-templates/></td> <!-- 470 -->
    </tr>
  </xsl:template>

The character 150 is clearly not present in the XSL file.
The Saxon error message is somewhat misleading, as the invalid character seems to be in changelog.xml at line 1488:

        <bug>49428</bug>: Re-implement the fix for bug <bug>49428</bug> &#150;

Perhaps you can try temporarily editting that out, and see if that makes Saxon happy.
Comment 7 Michael Osipov 2011-04-06 09:57:27 UTC
(In reply to comment #6)
> The relevant part of the log file says:
> 
>      [xslt] Processing E:\Projekte\tomcat-trunk\webapps\docs\changelog.xml to
> E:\Projekte\tomcat-trunk\output\build\webapps\docs\changelog.html
>      [xslt] E:\Projekte\tomcat-trunk\webapps\docs\tomcat-docs.xsl:470: Fatal
> Error! Illegal HTML character: decimal 150
> 
> Line 470 of tomcat-docs.xsl is
> 
>   <xsl:template match="changelog/fix">
>     <tr>
>       <xsl:variable name="src"><xsl:value-of
> select="$relative-path"/>/images/fix.gif</xsl:variable>
>       <td><img alt="fix" class="icon" src="{$src}"/></td>
>       <td><xsl:apply-templates/></td> <!-- 470 -->
>     </tr>
>   </xsl:template>
> 
> The character 150 is clearly not present in the XSL file.
> The Saxon error message is somewhat misleading, as the invalid character seems
> to be in changelog.xml at line 1488:
> 
>         <bug>49428</bug>: Re-implement the fix for bug <bug>49428</bug> &#150;
> 
> Perhaps you can try temporarily editting that out, and see if that makes Saxon
> happy.

Sebb,

I removed the suspicious ref and it worked. I started digging and realized that the document is really broken. In contrast to the built-in Xalan Saxon is not lenient and strictly follows the specs.
The change was made by Konstantin, he doesn't seem to be encoding-savvy. If you check the changelog.xml's encoding, you'll see UTF-8 is set in the XML prolog. The entity ref '&#150;' (0x96, char 'en dash') (http://en.wikipedia.org/wiki/Dash#Common_dashes) does only exist in Windows 1252 (http://en.wikipedia.org/wiki/Windows-1252#Codepage_layout) but translated to Unicode, this is a contol char which is forbidden in XML.
To make this work, you have to reference a valid Unicode char. In this case it would be '&#8211;' (U+2013) see http://www.utf8-zeichentabelle.de/unicode-utf8-table.pl?start=8192

I changed that and 'ant release' ran perfectly. I guess this is a really simple fix in SVN and the build should work on both XSLT processors.
Comment 8 Konstantin Kolinko 2011-04-06 10:38:28 UTC
So, the bug is not in the XSLT sheet, but in the data that it was processing.
Fixed with r1089469