Type error XPTY0004: Required item type of first argument of collection() is node(); supplied value has item type xs:base64Binary
Reported by user:
I presumed no config was necessary, because per http://www.saxonica.com/documentation/index.html#!sourcedocs/collections "the URIs listed in the doc elements are treated like URIs passed to the doc() function" and in the test XSL, doc-available() succeeds with the same url immediately before collection().
Anyway, I tried -config of the mappings from "rdf" to "text/xml". The same error. The test files are attached.
P:\test>java -classpath saxon9ee.jar net.sf.saxon.Transform -config:config.xml -it:main -t -xsl:test.xsl Saxon-EE 220.127.116.11J from Saxonica Java version 1.8.0_91 ...
Type error XPTY0004: Required item type of first argument of collection() is node(); supplied value has item type xs:base64Binary Required item type of first argument of collection() is node(); supplied value has item type xs:base64Binary
#1 Updated by O'Neil Delpratt over 5 years ago
- Status changed from New to Resolved
- Applies to branch 9.8 added
- Fix Committed on Branch 9.7, 9.8 added
The problem is content types not known by the AbstractResourceCollection are assumed to be binary. The fix was to add the rdf+xml to the map of known resources (i.e. resourceFactoryMapping in the AbstractResourceCollection).
Bug fixed and committed to svn on the 9.7 and 9.8 branches.
#2 Updated by O'Neil Delpratt over 5 years ago
It seems like setting the resource fileExtension mapping in the config file does not take effect:
<configuration edition="EE" xmlns="http://saxon.sf.net/ns/configuration"> <global expandAttributeDefaults="false" validationComments="true" /> <xslt recoveryPolicy="doNotRecover" /> <serialization saxon:indent-spaces="4" xmlns:saxon="http://saxon.sf.net/" /> <resources> <fileExtension extension="rdf" mediaType="application/xml" /> </resources> </configuration>
Opening this as a new bug. see #2750
#4 Updated by Michael Kay over 5 years ago
- Status changed from In Progress to Resolved
The bad error message appears to arise as follows.
In CollectionFn line 201, if the XPath version is 3.0 or less (i.e. not 3.1), the collection() function is required to return a sequence of nodes. So we add an item checker to ensure that this is the case. But the RoleDiagnostic (which determines the error message) is set up to report that the error relates to the first argument.
If we're not going to allow items other than nodes to be returned, then perhaps the CollectionFinder shouldn't even consider the possibility, and should parse everything as XML. But the immediate thing is to fix the error message, which I have done.
Please register to edit this issue