Loading TOC...

plugin:asset

plugin:asset(
   $pid as xs:string,
   $scope as xs:string,
   $asset-path as xs:string
) as node()?

Summary

Returns the named asset, which must exist in the assets/ directory of the plugin, as stored in the Extensions database. This will only return a value for Library Module plugins.

Parameters
pid A plugin ID.
scope A scope identifier. This must be a "dotted" package-style path, which will be resolved relative to the marklogic-dir/Assets/plugins directory. For example, a $scope value of my-plugin-scope is resolved to the marklogic-dir/Assets/plugins/myplugin-scope directory and a $scope value of my.plugin.scope is resolved to the marklogic-dir/Assets/plugins/my/plugin/scope directory.
asset-path The filename (omitting any path information) of an asset in this plugin space.

Example

xquery version "1.0-ml"; 
 
import module namespace plugin = "http://marklogic.com/extension/plugin" 
      at "/MarkLogic/plugin/plugin.xqy";

plugin:asset-exists("collector-test", "marklogic.appservices", "picture.gif")

(: Returns the asset, 'picture.gif,' used by the collect-test plugin
   located in the Extensions database. :)      
      

Stack Overflow iconStack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.