[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Has anybody started working on an XPath API yet?

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
chau download context editor
> -----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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.