Re: [xml] XPath extension API

Le 15/05/01 11:55:40, Daniel Veillard a écrit :
    Functions called by the XPath processor would just be wrappers
    managing arity checking, type casting, stack popping/pushing,

This is what I'm doing for EXSLT. Code is easier to read and functions
are easier to reuse.

  Only drawback it make more function calls ... 

If this come to be a real problem, shared code can be "exported" into a
Drawback: code is less easier to read than using only functions.

Functions expecting a node-set argument and working only on the first
node in document order (f.i., name()) use xmlXPathNodeF where is the
same as in the first naming scheme above (xmlXPathNodeName)

...and expect an xmlNodePtr argument. There should still be the xmlXPathF
function with a node-set argument.

I just add a new one:
Functions expecting a node-set argument and working on a sorted node-set
define another function: xmlXPathFSorted. Such a function assumes the
node-set passed as argument is already sorted in document order (this is
similar to xmlXPathNodeSetAddUnique which assume the node isn't already in
the node-set.

For exemple, for the EXSLT - Sets distinct() function, we have:
  xmlNodeSetPtr exslSetsDistinctSorted (xmlNodeSetPtr nodes);
  xmlNodeSetPtr exslSetsDistinct (xmlNodeSetPtr nodes);
  void exslSetsDistinctFunction (xmlXPathParserContextPtr ctxt,
                                 int nargs);

 · add functions for creating external types. An external type should
   reference conversion functions to basic types (Number (int),
   Boolean (double) and String (xmlChar*)).

Actually, XSLT 1.1 says:
  An external object represents an
 object that is not convertible to one
of the four XPath data types

  But XSLT-1.1 is dropped ...

I know that. But since XSLT 1.0 says nothing about external objects and we
don't have any other ressource (neither XPath 2.0 Requirements nor XSLT 2.0
Requirements seem to deal with external objects (I just looked for the
words "extension" or "external"))...

It is clear that XPath 2.0 will merge with XQuery on the data model

So an "external object" as it was defined by XSLT 1.1 is likely to become
an object of "user-defined datatype".
XQuery, 2.10 User-Defined Datatypes, states "In addition to the primitive
and derived datatypes of XML Schema, any datatype that can be constructed
using the definition facilities of XML Schema can be used as an XQuery

This of course is not enough for XSLT "external objects". What would become
a SAXON precompiled XPath expression, or the XConnection object used for
the Xalan SQL extension?


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]