eXist - loading XSLT collection() - Exception thro

2019-03-04 04:34发布

问题:

Environment: eXist-db 4.2.1 , XQuery 3.1, XSLT 2.0

In eXist-db I am loading an XSLT file which includes a reference to a collection in eXist (in order to perform a search on documents found there, using a key). This reference seems to throw an error from Saxon.

Exception while transforming node: Exception thrown by URIResolver

  • XML docs are located at /db/apps/deheresi/data/
  • XSLT docs are located at /db/apps/deheresi/data/styles

In the transform function, I am passing a parameter from XQuery to the XSLT file for the absolute path to the data folder:

<param name="paramDatauri" 
  value="xmldb:exist:///db/apps/deheresi/data/"/>

In the XSLT file, this parameter is received and injected into a variable:

 <xsl:variable name="coll" 
  select="collection(concat($paramDatauri,'?select=*.xml'))"/>

I've looked at possible parameters that Saxon might need, but I've not identified any that can resolve this problem.

EDIT #1: I've tried to pass an attribute in XQuery transform()

 <attributes>
    <attr name="paramSax" value="COLLECTION_URI_RESOLVER"/>
 </attributes>

per Saxonica documentation, but I get the message

 `Unable to set up transformer: Unknown configuration property`

I don't know if this is redundant/unnecessary, or if I've configured the attribute incorrectly.

EDIT #2: I've attempted to hardcode the absolute path into the XSL file:

<xsl:variable name="coll" 
  select="collection('xmldb:exist:///db/apps/deheresi/data/?select=*.xml')"/>

As well a relative path:

<xsl:variable name="coll" 
  select="collection('/db/apps/deheresi/data/?select=*.xml')"/>

Always returning the same error Exception thrown by URIResolver.

This is the first time I've tried to use a collection() function within a XSLT within eXist-db.

Many thanks.