Scott --

I've been working on the Variable stuff for a couple of days and I had a
thought for you to ponder.  What do you think about creating a _qn field
in VariableStack that would be a QName array.  It would go hand-in-hand
with _sf and hold the QName represented by the corresponding _sf entry. 
We're not creating new objects here on a regular basis but we are going
through some extra processing every time we push a variable or parameter
on _sf.  Namely, we have to also push the corresponding QName, which is
always easily available as far as I can tell.

For non-extension processing, the _qn array would never be used but it
might somewhat dehack the current implementation.

Thoughts?

Gary

[EMAIL PROTECTED] wrote:
> 
> I'm about to check in org.apache.xpath.operations.Variable.java that has a
> rather nasty hack.  The issue is that extensions are building their xpaths
> on the fly, so they don't really have a chance to fix up their index lookup
> for the variable stack (this problem caught me a bit by surprise).  The
> variable stack itself no longer has any qname information... it's a
> straight index lookup to the variable value.  In order to work around this
> problem in the short term, I test whether fixupVariables has been called,
> and, if it hasn't, I take the current prefixResolver, *which must be set to
> the extension element* (it wasn't in the Redirect extension), test if it is
> a ElemTemplateElement (bad because we're not supposed to be coupled with
> the xalan package in xpath), and look at the previous sibling and ancestor
> previous siblings for a ElemVariable.  For each ElemVariable, I can then
> compare the qname, and, if a match, get the index from that element.  Right
> now it doesn't do anything special for global variables, and so errors can
> occur in this case if you have imports and includes and the like.  The hack
> is good enough right now to get fop codegen to work correctly.  I'll do
> some more work on this next week, or someone else can, and I'll try and
> figure out a way to do this without the visibility to xalan.
> 
> Anyway, I wanted to make sure I properly flagged the hack.
> 
> -scott

Reply via email to