[XML-SIG] XSLT parser interface

Uche Ogbuji uche.ogbuji@fourthought.com
Mon, 29 Jan 2001 13:47:04 -0700


> [This was sent to python-dev by mistake; my apologies - MvL]
> 
> Based on my previous IDL interface for XPath parsers, I've defined an
> API for a parser that parsers XSLT pattern expressions. It is an
> extension to the XPath API, so I attach only the additional functions.
> 
> Any comments are appreciated.
> 
> Martin
> 
> module XPath{
>   // XSLT exprType values
>   const unsigned short PATTERN = 17;
>   const unsigned short LOCATION_PATTERN = 18;
>   const unsigned short RELATIVE_PATH_PATTERN = 19;
>   const unsigned short STEP_PATTERN = 20;

I think we might want to space out these module-level constants a bit to allow 
for user extension.  Or should all extensions use numbers above a certain 
ceiling?

>   interface Pattern;
>   interface LocationPathPattern;
>   interface RelativePathPattern;
>   interface StepPattern;
> 
>   interface PatternFactory:ExprFactory{
>     Pattern createPattern(in LocationPathPattern first);
>     // idkey may be null, represents IdKeyPattern

Minor nit, but it puzzled me for a few seconds.  the comman above should be a 
colon, or just rephrase to

"If idkey is non-Null, this is an IdKeyPattern

>     // if parent is true, it is '/', else '//'
>     // rel may be null
>     LocationPathPattern createLocationPathPattern(in FunctionCall idkey,
> 						  boolean parent,
> 						  in RelativePathPattern rel);
>     // if parent is true, it is /, else //
>     RelativePathPattern createRelativePathPattern(in RelativePathPattern rel,
> 						  boolean parent,
> 						  in StepPattern step);
>     StepPattern createStepPattern(in AxisSpecifier axis,
> 				  in NodeTest test,
> 				  in PredicateList predicates);
>   };

Some of these take an approach that's a bit cute (for instance, the boolean 
parent idea), but since it's really a developer-only interface, this should be 
fine.

>   typedef sequence<LocationPathPattern> LocationPathPatterns;
>   interface Pattern:Expr{
>     readonly attribute LocationPathPatterns patterns;
>     void append(in LocationPathPattern pattern);
>   };
> 
>   interface LocationPathPattern:Expr{
>     readonly attribute FunctionCall idkey;
>     readonly attribute boolean parent;
>     readonly attribute RelativePathPattern relative_pattern;
>   };

I forgot whether Expr defines a pprint method.  If not, I think it should.  
this is a *very* handy debugging aid (and required by 4XDebug).

>   interface RelativePathPattern:Expr{
>     readonly attribute RelativePathPattern relative;
>     readonly attribute boolean parent;
>     readonly attribute StepPattern step;
>   };
> 
>   interface StepPattern:Expr{
>     readonly attribute AxisSpecifier axis;
>     readonly attribute NodeTest test;
>     readonly attribute PredicateList predicates;
>   };
> 
>   interface XSLTParser:Parser{
>     Pattern parsePattern(in DOMString pattern);
>   };
> };

Other than that, looks great.  Jeremy?


-- 
Uche Ogbuji                               Principal Consultant
uche.ogbuji@fourthought.com               +1 303 583 9900 x 101
Fourthought, Inc.                         http://Fourthought.com 
4735 East Walnut St, Ste. C, Boulder, CO 80301-2537, USA
Software-engineering, knowledge-management, XML, CORBA, Linux, Python