You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by Shawn Bayern <ba...@essentially.net> on 2001/10/25 21:59:29 UTC

XPath variables without XSLT

Hi there.  I'm writing as the reference-implementation lead for the JSP
Standard Tag Library, which is hosted under another Apache subproject
(Jakarta Taglibs).

The JSP Standard Tag Library (JSPTL) will specify a number of tags in
support of XPath operations on DOMs.  For the reference implementation, we
would clearly like to use JAXP + Xalan, but we've run into an issue that I
think requires a minor change to one or two of the org.apache.xpath
classes in Xalan-Java 2.2.D11.

Specifically, we have a requirement involving XPath variables: we want to
evaluate them lazily using arbitrary logic, to allow JSP application data
to be referenced by XPath variables.  In org.apache.xpath, XPathContext
does allow for a pluggable VariableStack to be "installed" into the XPath
evaluation context, and VariableStack indeed has a method at exactly the
level of abstraction we need (getVariableOrParam(), which essentially maps
a QName to an XObject).  However, VariableStack is final, so I can't
supply a subclass that implements the logic we need.

The simplest solution to our particular problem might be just to make
VariableStack extensible.  For the most general case, it might be ideal to
look at VariableStack as a subclass of a more general VariableBindings
type, but I wouldn't necessarily want to propose that since it would imply
a change to the signature of some of XPathContext's methods.  The major
conceptual difference between our needs and the support that VariableStack
provides is that our variables are not arranged in occlusive, static
stacks but in a single flat level of arbitrary, orthogonal namespaces
requiring dynamic logic for initial binding resolution.  (I believe
XUnresolvedVariable comes close to what we need, conceptually, but it is
tied to XSLT in ways that don't seem obviously circumventable -- though
please do let me know if I'm missing anything.)

I'm happy to provide any more information, if that would be helpful.
Many thanks,

Shawn