Subject: RE: Has anybody started working on an XPath API yet? From: Kay Michael <Michael.Kay@xxxxxxx> Date: Fri, 17 Dec 1999 12:00:10 -0000 |
> -----Original Message----- > From: Khun Yee Fung [mailto:kyeefung@xxxxxxxxxx] > Sent: 16 December 1999 21:14 > To: xsl-list@xxxxxxxxxxxxxxxx > Subject: Has anybody started working on an XPath API yet? > > > Just wondering, has anybody started working on an XPath API > specification > yet? I would love to be part of the effort doing whatever is > needed. Just to give you a feel for what the core of this API looks like in SAXON: static Expression Expression.make(String xpathExpression, StaticContext sc) takes an xpath Expression as a string and parses it to create an Expression object. StaticContext is a class that provides information about things known at compile time: notably, the set of namespace declarations in force, the set of variable declarations that are in scope, the availability of extension functions, and (needed for XSLT functions only) the URI of the entity containing the expression. Expression has the method Value value = expression.evaluate(Context context) Context is a class that provides information about things known at run time: notably, the context node, context position, and context size; the current values of all variables. Other things such as the names of keys and decimal-formats are needed for XSLT additional functions; a pure XPath API would generalise this requirement. so there is: Node node = context.getContextNode() int pos = context.getContextPosition() int last = context.getContextSize() Value value = context.getValue(VariableBinding variable) Value is a class that has subclasses StringValue, NumericValue, BooleanValue, and NodeSetValue. (Plus FragmentValue for XSLT use only). All of these are reasonably easy to define except NodeSetValue - where a standardized API ought presumably to reuse interface definitions from the DOM, except that the DOM doesn't always precisely reflect the conceptual InfoSet used by XPath. Similarly, the context node in the Context object should presumably be a DOM Node object, subject to the same reservations. Obviously there are a lot of helper methods around as well, e.g. to do value conversions, but these are not essential to the core. Mike Kay XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Has anybody started working on an X, Khun Yee Fung | Thread | unsubcribe, chau pham |
RE: <xsl:copy-of> question, Kay Michael | Date | RE: well-formed output XML (was: wh, Kay Michael |
Month |