Re: Yet Another V2 Request: Extension Functions via XSLT 2

On 8 August 2013 02:36, Alex Milowski <alex@milowski.com> wrote:
> Let me explain the use case a bit better.  I have documents that are typed,
> often on the root element, with specific RDFa types.  The derived type is
> computed against the @vocab attribute (and others) along with the @typeof
> attribute.  I want to expose an extension function so I can do something
> like this:
>
> <p:choose>
> <p:when test="rdfa:is-type(/*,'http://example.com/Book')">

> So, I really just want a way in p:library to declare these functions.  I
> could imagine just importing an XSLT library directly but I wonder whether
> that is technical feasible given existing implementations.

its an interesting idea and I think it would leverage other XML
technologies reuse mechanisms. In MarkLogic land, allowing XSLT to
import xquery modules proves to be a big winner and I suspect the
reverse would be true as well.

We could consider overloading p:import to be able to load in
functions, in the scope of the current pipeline or a p:import in a
p:library. Heck … why not javascript as well or whatever else an impl
may decide ? We could add a content-type attribute as the means for
unambiguously identifying function library.

For example, with the xproc impl I am working on, it would be
straightforward to load in xquery modules whose functions could be
made available, though I don't know how this would work with XSLT and
would have to tinker about calabash/saxon as an example to fully
understand how an impl would achieve this.

 J

Received on Thursday, 8 August 2013 05:31:42 UTC