Project

Profile

Help

Bug #3251

closed

Possible error in XSLT when choosing overloaded method in reflexive function

Added by Nick Nunes over 7 years ago. Updated over 7 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Saxon extensions
Sprint/Milestone:
-
Start date:
2017-06-08
Due date:
% Done:

100%

Estimated time:
Legacy ID:
Applies to branch:
Fix Committed on Branch:
9.8
Fixed in Maintenance Release:
Platforms:

Description

I'm attempting to write a function which will allow me to perform XPath syntax checking (without evaluating the context, in scope prefixes or variables). My initial approach was to use reflexive extension functions and the s9api, as I'm not sure I will have control over the classpath where the function is executed (but I do know it will be using Saxon). I understand that reflexive functions are not ideal but speed is not of particular concern, ease of use is favored in this situation.

My intention was to follow this documentation http://www.saxonica.com/html/documentation/xpath-api/s9api-xpath.html and simply catch a failure to compile(). However, I ran into difficulty creating the Processor. Regardless of the types of the arguments supplied to Processor:new() it always selects the constructor which expects a javax.xml.transform.Source. I've attempted calling Processor:new() with an xs:boolean argument, a java Boolean, and a net.sf.saxon.Configuration argument. This is the error message I get from a -TJ trace while passing in a Configuration:

Finding best fit method for arguments
Trying option 1: public net.sf.saxon.s9api.Processor(javax.xml.transform.Source) throws net.sf.saxon.s9api.SaxonApiException
Conversion preferences are [22]
Trying option 2: public net.sf.saxon.s9api.Processor(net.sf.saxon.Configuration)
Conversion preferences are [80]
Trying option 3: public net.sf.saxon.s9api.Processor(boolean)
Conversion preferences are [80]
Eliminating option 1
Eliminating option 2
Number of candidate methods remaining: 1
Error on line 17 column 89 of check.xpath.xsl:
  External object has wrong class (is net.sf.saxon.Configuration, expected javax.xml.transform.Source)

This appears to reject the constructor with the javax.xml.transform.Source signature, then proceeds to generate an error consistent with not rejecting it. Perhaps I'm misinterpreting the trace messages though.

I've attached a stylesheet which triggers this error.


Files

check.xpath.xsl (964 Bytes) check.xpath.xsl Nick Nunes, 2017-06-09 00:48

Please register to edit this issue

Also available in: Atom PDF