Bug #4419

fn:normalize-unicode fails when DTD-based validation of source data is turned on

Added by Martin Latterner 9 months ago. Updated 7 months ago.

Start date:
Due date:
% Done:


Estimated time:
Legacy ID:
Applies to branch:
9.9, trunk
Fix Committed on Branch:
9.9, trunk
Fixed in Maintenance Release:



I am running Saxon-EE on Java from the command line.

When I turn on DTD-based validation of source data (-dtd:on), then my stylesheet using fn:normalize-unicode fails.

Here is XSL to demonstrate the problem:

<xsl:stylesheet xmlns:xsl="" version="3.0">
        <xsl:output encoding="ASCII" omit-xml-declaration="yes"/>
        <xsl:template match="/">                
                <xsl:value-of select="normalize-unicode('M&#252;ller', 'NFKD')"/>

The source does not matter as long as it's XML that's valid against a DTD. For example:

<!DOCTYPE article SYSTEM "">

When I run this with -dtd:off, I get the expected output:


When I switch -dtd:don, then the transformation fails:

Recoverable error on line 2 column 13 of normalizationData.xml:
  SXXP0003: Error reported by XML parser: Document is invalid: no grammar found.
Recoverable error on line 2 column 13 of normalizationData.xml:
  SXXP0003: Error reported by XML parser: Document root element "UnicodeData", must match
  DOCTYPE root "null".
Error at char 18 in xsl:value-of/@select on line 7 column 68 of x.xsl:
  The XML parser reported two validation errors
net.sf.saxon.trans.XPathException: The XML parser reported two validation errors

It seems to me I should be able to use fn:normalize-unicode with -dtd:on.

random_valid_xml.xml (140 Bytes) random_valid_xml.xml source file Martin Latterner, 2020-01-07 14:07
xsl.xsl (281 Bytes) xsl.xsl xslt file Martin Latterner, 2020-01-07 14:16


#1 Updated by Michael Kay 9 months ago

Thanks for reporting it. It looks as if it's incorrectly applying DTD validation to one of the internal documents that holds the normalization tables.

#2 Updated by Michael Kay 8 months ago

  • Category set to Internals
  • Status changed from New to Resolved
  • Assignee set to Michael Kay
  • Priority changed from Low to Normal
  • Applies to branch 9.9, trunk added
  • Fix Committed on Branch 9.9, trunk added

I have fixed this on 9.9 and trunk.

I have reviewed all the places were we are parsing internal or system files where DTD validation is likely to be inappropriate, not just the issued files containing normalization and regex data, but also for example SEF files, configuration files, catalog files, and so on, and explicitly set DTD (and where necessary schema validation) off to override a request for DTD validation at the global configuration level.

#3 Updated by O'Neil Delpratt 7 months ago

  • Status changed from Resolved to Closed
  • % Done changed from 0 to 100
  • Fixed in Maintenance Release added

Patch applied in the maintenance release.

Please register to edit this issue

Also available in: Atom PDF