so I'm having weird problems with an XSL transformation.
I am trying to get distinct values from files in a folder.
- Path to objects in folder:
<xsl:variable name="objects" select="collection('../../../../data/objects')"/>
- Variable for distinct values:
<xsl:variable name="something" select="$objects//tei:rs[@type='something' and @subtype='something']/@ref" as="xs:string"/>
Then I add various elements for each distinct value to $objects: <xsl:for-each select="distinct-values($something)"/>
I tested the transformation before and it worked out fine. Now I'm getting the error message "The required item type of the first operand of '/' is node(); the supplied value xs:base64Binary("AAAAAUJ1ZDEAB ...=") is an atomic value."
How can I fix this problem? I've read quite a bit about this problem, but just can't get my stylesheet to work.
I'm using Saxon-PE 9.9.1.7 in Oxygen XML Editor. The stylesheet is written in XSLT 2.0.
Thank you in advance!
CodePudding user response:
My guess would be that ../../../../data/objects
is a directory containing a file that isn't recognizably XML, and is therefore being treated as a binary value. The rules Saxon applies for detecting the content type of the files in a collection are quite complex and a little arbitrary, but there are various ways you can restrict the selection to contain only XML files.