Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

3.5 Provide a mechanism for importing user-defined functions #49

Open
ndw opened this issue Aug 22, 2014 · 1 comment
Open

3.5 Provide a mechanism for importing user-defined functions #49

ndw opened this issue Aug 22, 2014 · 1 comment

Comments

@ndw
Copy link
Collaborator

ndw commented Aug 22, 2014

Experience with user-defined functions in XQuery and XSLT reveals that they can be a powerful addition to the language. Providing some feature that allowed users to extend the vocabulary of functions available in, for example, the test expressions on p:when elements would greatly simplify some pipelines.

Such a mechanism might take the form of the ability to load extension functions defined in, for example, XQuery, or it might include adding the ability to define functions in XProc.

@ndw ndw added this to the XProc 2.0 LC milestone Aug 25, 2014
@ndw
Copy link
Collaborator Author

ndw commented Mar 19, 2015

Proposal for p:import-functions instruction

It would be useful to be able to add user-defined functions to XProc. XProc steps themselves don't immediately lend themselves to this task because there's not a completely obvious mapping between step signatures and function signatures. However, most XProc engines are going to have access to XSLT and/or XQuery engines and both of those languages have a built-in mechanism for creating functions.

This proposal is for a p:import-functions element that can import externally-defined functions from languages such as XQuery or XSLT.

<p:import-functions
    href = xs:anyURI
    namespace? = xs:anyURI
    type? = xs:string
    />

This element instruct the XProc processor to load external functions from the specified library. It is a static error if the processor cannot access the URI or if the URI points to a format that the implementation does not recognize.

The namespace attribute specifies the namespace in which the imported functions must reside. It is a static error if the specified URI does not define functions in that namespace.

The type attribute specifies the expected type of the content. Implementations should support application/xslt+xml and application/xquery for XSLT and XQuery implementations. Support for other formats is impelementation-defined.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant