Is a package-version a required option for fn:transform when using a package?
Added by Martin Honnen over 4 years ago
I tried to use one of the packages presented today at Balisage using fn:transform
:
declare namespace output = "http://www.w3.org/2010/xslt-xquery-serialization";
declare option output:method 'json';
declare option output:indent 'yes';
transform(
map {
'package-name': 'http://www.obdurodon.org/linear-algebra-lib',
'initial-function': QName('http://www.obdurodon.org', 'transpose-matrix'),
'function-params': [[[1, 2], [3, 4]]],
'delivery-format': 'raw',
'vendor-options': map {
QName('http://saxon.sf.net/', 'configuration'): doc('https://raw.githubusercontent.com/djbpitt/plot/master/he-config.xml')
}
}
)?output
SaxonHE10-1J doesn't like that attempt and outputs:
nulljava.lang.NullPointerException
at net.sf.saxon.style.PackageVersionRanges.<init>(PackageVersionRanges.java:88)
at net.sf.saxon.s9api.XsltCompiler.obtainPackage(XsltCompiler.java:750)
at net.sf.saxon.functions.TransformFn.getStylesheet(TransformFn.java:496)
at net.sf.saxon.functions.TransformFn.call(TransformFn.java:613)
at net.sf.saxon.expr.FunctionCall.iterate(FunctionCall.java:543)
at net.sf.saxon.expr.Expression.evaluateItem(Expression.java:852)
at net.sf.saxon.expr.LookupExpression.iterate(LookupExpression.java:330)
at net.sf.saxon.expr.Expression.process(Expression.java:949)
at net.sf.saxon.query.XQueryExpression.run(XQueryExpression.java:453)
at net.sf.saxon.s9api.XQueryEvaluator.run(XQueryEvaluator.java:370)
at net.sf.saxon.Query.runQuery(Query.java:895)
at net.sf.saxon.Query.doQuery(Query.java:423)
at net.sf.saxon.Query.main(Query.java:97)
Fatal error during query: java.lang.NullPointerException: (no message)
When I add a package-version
, as in
transform(
map {
'package-name': 'http://www.obdurodon.org/linear-algebra-lib',
'package-version': '1.0',
'initial-function': QName('http://www.obdurodon.org', 'transpose-matrix'),
'function-params': [[[1, 2], [3, 4]]],
'delivery-format': 'raw',
'vendor-options': map {
QName('http://saxon.sf.net/', 'configuration'): doc('https://raw.githubusercontent.com/djbpitt/plot/master/he-config.xml')
}
}
)?output
the code works fine with that Saxon version.
https://www.w3.org/TR/xpath-functions/#func-transform says you need to provide "package-name plus optionally package-version" and says about package-version
:
The version of the top-level stylesheet package to be invoked. [...] Default: "*" (any version)
Doesn't that mean the attempt not providing a package-version should work?
Replies (1)
RE: Is a package-version a required option for fn:transform when using a package? - Added by Martin Honnen over 4 years ago
https://saxonica.plan.io/issues/3614 seems to be about the same problem, but supposed to be fixed since a while. Perhaps not in the context of fn:transform
?
Please register to reply