#107 Conflicts in xsl:strip-space

Michael Kay

XSLT 1.0 (see erratum 30) says that it is a recoverable
error to have two xsl:strip-space or xsl:preserve-space
declarations that match the same element. Previous
releases of Saxon took the recovery action: no error
was reported. Saxon 7.3 detects the error, and falls
over with a NullPointerException trying to report it.
Further, if Crimson is being used as the XML parser,
this NullPointerException is not actually reported,
because of bug 941940. All that happens is the single
line message "Transformation failed - run-time errors
were reported".

The NullPointerException occurs in method
reportAmbiguity of class net.sf.saxon.trans.Mode, while
trying to call Navigator.getPath. This doesn't work
because the element node used for strip-space testing
is a dummy node, and doesn't support all the properties
of a real node. Also, the patterns used for strip-space
testing have no location information, so the line
number and system ID are wrong.

Previous releases avoided the problem as an accidental
consequence of the fact that no ambiguity was reported
in the case of two patterns having the same line number
(which was taken to mean that they were probably
components of a union pattern in the same template rule).


  • Michael Kay

    Michael Kay - 2002-11-21

    Logged In: YES

    Source code fixed.

    Test case added: whte19

  • Michael Kay

    Michael Kay - 2002-12-10

    Logged In: YES

    Fixed in 7.3.1