JDK-6409233 : XSLTC 'Could not compile stylesheet' 'Error checking type of the expression 'funcall( ... )'.'
  • Type: Bug
  • Component: xml
  • Sub-Component: javax.xml.transform
  • Affected Version: 5.0
  • Priority: P2
  • Status: Closed
  • Resolution: Not an Issue
  • OS: generic
  • CPU: generic
  • Submitted: 2006-04-05
  • Updated: 2012-04-25
  • Resolved: 2006-04-21
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Routinely hitting errors of the following form where the types should be compatible, but
xsltc is claiming they aren't.

ERROR:  'Error checking type of the expression 'funcall(matches, [literal-expr(aba), literal-expr(a)])'.'
FATAL ERROR:  'Could not compile stylesheet'

javax.xml.transform.TransformerConfigurationException: Could not compile stylesheet
	at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl.newTemplates(TransformerFactoryImpl.java:824)
	at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl.newTransformer(TransformerFactoryImpl.java:619)

WORK AROUND In order to execute this stylesheet with an XSLT 1.0 processor like XSLTC, the XPath 2.0 function call should be guarded using function-available(). See, http://www.w3.org/TR/xslt#function-function-available

EVALUATION XSLTC is reporting a type error because the function 'matches' is undefined. This function is not an XPath 1.0 function, so the stylesheet cannot be compiled. I do not see any problem with this behavior: there is not way the processor can evaluate an expression with an undefined function in it.

EVALUATION as a test case is provided, this CR is being accepted for evaluation. note that any fix may need to be applied to both Mustang & JAXP 1.3.x repositories.