Custom functions #114
Replies: 4 comments 2 replies
-
Hi Zack, I'll let Steve speak on the technical aspects but absolutely we'd be interested in any contributions ye can provide! |
Beta Was this translation helpful? Give feedback.
-
As Daniel said, we welcome pull requests. The omission of extension functions and elements was semi-deliberate. When trying to finalise the 1.0 release, as soon as I read in the XSLT 1.0 spec that extensions are optional I decided that we could skip them and wait until someone requested it. And here we are ;-) Are you looking to add extensions by using xrust as an external library and compiling your own application, or do you want to be able to dynamically load a DLL/shared library into an executable? The former will be pretty easy, the latter will require a fair bit of investigation. For the moment, let's assume the former. We would need to work on the design of the extension mechanism to cover both functions and elements. At the moment, all functions and XSLT elements are hardcoded. It would be better to have a registry system that keeps track of functions and elements so that the xsl:function-available and xsl:element-available functions could then be implemented. Extension functions will be a lot easier. There is already support for the xsl:function element to declare a custom function in XSLT. We could build off that to callback into Rust code. Also, bear in mind that the transformation (and pattern) engine is separate from the syntax parsers of XPath, Pattern, and XSLT. So to implement an extension you would first need to introduce a new Transform component and then either register a new function in the XPath & Pattern parsers and/or register a new element for the xslt::to_transform function to use. |
Beta Was this translation helpful? Give feedback.
-
It turns out that for a side project I'm doing that is based on xrust I'm going to need extensions. So we might be implementing them sooner rather than later ;-) I'm starting to think about the design, starting with the transformation module. What are the requirements for extensions? Basically being able to invoke custom code with custom data. The data may be supplied at the time of defining the transform, or at runtime when the transform is invoked. |
Beta Was this translation helpful? Give feedback.
-
Now that the extensions branch has a working proof-of-concept for an extension function, to get this into the next release we need to:
|
Beta Was this translation helpful? Give feedback.
-
Hi all! My team and I are planning to modernize our tech stack and re-write our main back end API in Rust. One of the key features throughout our system is XSL transformation. One key functionality we utilize is extension functions with our current library. I browsed the xrust code base, correct me if I am wrong please, but it seems there is no way to register custom functions. Is this something y'all would be interested in taking pull requests on? If so, any ideas of how you would like this implemented?
Best
Beta Was this translation helpful? Give feedback.
All reactions