Class TPathCache

java.lang.Object
eu.bandm.tools.xslt.base.TPathCache

public class TPathCache extends Object
Maintains a cache for parsing and analyzing xpath/tpath expressions in context of txsl. All these expressions are values of attributes in an xslt document, i.e. of xslt elements or of result elements. This cache supports two disjoint sets of keys, i.e. two different front-end formats, namely (a) values of dedicated xslt attributes, which are always an xpath source as a whole, (b) attribute value templates (AVTs), containing xpath expressions embedded into constant data, limited by reserved escape characters. The latter can appear in every attribute of a result element, or in dedicated xslt attributes.

The syntax constraints on attribute values are different than in pure XML: Whenever an embedded xpath expressions is indicated by an escape character, the further contents must be parsable as such. So "{@code a{}" is a valid value for any CDATA attribute in XML, but not in xslt result elements. <p> The involved compiler for AVTs is {@link AttributeValueTemplate}. It always delivers a {@link TPath.Expr}; if there are no opening brackets in the source, this will be one single constant literal expression. <br/> This value is turned into a an {@link ExprClassified}, which contains the parsed code and analysis results (or "null" in the code field iff there had been errors.) <p> Look-up and memorization go in two steps: (1) first look for verbatim cached source. (2) Then parse and look up for canonical source text. If look-up fails, perform analyses and store accordingly. <br/> + FIXME: List of all variable names collected !?!? <p> Additionally, the "sensitivity" on the context is calculated: <br/> None -> needs evaluation only once, is constant<br/> Session -> depends only on global variables, needs evaluation only once per application<br/> Multi -> depends on context (=input focus, local vars), needs always re-evaluation<br/> <br/> FIXME variable access is context depended. <br/> FIXME But if ALL appearing variable NAMES appear only on global level, this raises sensivity only to "session", not to "multi". <br/> FIXME the "union of relative and absolute" is not yet supported, (????) code has to be unified with <mt>/tpath/Util.isAbsolute() !!!!