I've implemented the strategy below on a local copy and it seems to work fine, 
comments on the attached patch are very welcome.

What is the escalation process to have a patch like this incorporated into the 
next release?

--- On Sun, 15/11/09, Adam Jenkins <adamjenkinstmpredir...@yahoo.com.au> wrote:

> From: Adam Jenkins <adamjenkinstmpredir...@yahoo.com.au>
> Subject: Re: Advanced Extension Element Question
> To: xalan-dev@xml.apache.org
> Received: Sunday, 15 November, 2009, 8:49 AM
> damn it...every single avenue I go
> down for adding a variable value from an extension element
> is a dead end (and I'm pullin' some crazy hacks at this
> stage).
> 
> this seems like a pretty big deficiency in the extension
> element framework...I have an open source library that does
> some pretty cool stuff scheduled for release, however the
> only limitation is that for two of the new elements, I can't
> add variables to the stack from an extension element.
> 
> Is there anyway we can get this into the next release of
> Xalan, I'm happy to code it up myself and submit a patch if
> someone can give architectural guidance?
> 
> My perfect world scenario would be for something like
> this:
> 
> <xsl:variable name="somename">
>    <my:extensionElement
> someattr="value"/>
> </xsl:variable>
> 
> And have the method of the extension element somehow supply
> an XObject back to the parent.
> 
> This may be a simple as adding a method to the ElemVariable
> class that is something like setChildDrivenSelect(XPath p)
> and modify the getValue() method so that if that method is
> called during child evaluation, it returns the evaluation of
> the supplied XPath rather than returning the XRTreeFrag from
> the child.
> 
> That way if we wanted to do this functionality we could
> code our extension elements thus:
> 
> public void extensionElement(XSLProcessorContext ctx,
> ElemExtensionCall elem){
>    Object myValue = ...do some stuff...
>    ElemVariable varElement =
> (ElemVariable)elem.getParent();
>    varElement.setChildDrivenSelect(new
> XPath(new XObject(myValue)));
> }
> 
> How does everyone feel about that change?  It's quick,
> easy and offers some pretty spectacular functionality for
> very little modification.  We'd just have to replace
> the line in ElemVariable.getValue() 
> 
> var = new XRTreeFrag(df, xctxt, this);
> 
> with
> 
> if(childPopulatedXPath == null) var = new XRTreeFrag(df,
> xctxt, this);
> else var = childPopulatedXPath.execute(xctxt, sourceNode,
> this);
> 
> Thoughts/Comments?
> 
> Doing this allows for some pretty cool extension elements
> to be built which would really take Xalan to another level.
> 
> Cheers
> Adam
> --- On Sat, 14/11/09, kesh...@us.ibm.com
> <kesh...@us.ibm.com>
> wrote:
> 
> > From: kesh...@us.ibm.com
> <kesh...@us.ibm.com>
> > Subject: Re: Advanced Extension Element Question
> > To: 
> > Cc: xalan-dev@xml.apache.org,
> xalan-j-us...@xml.apache.org
> > Received: Saturday, 14 November, 2009, 8:29 AM
> > > Can anyone tell me
> > if there's any way to add an
> > object (not node or 
> > 
> > > tree fragment) variable to the variable stack
> from an
> > extension element?
> > 
> > 
> > 
> > From an extension _element_... I
> > don't think so.
> > 
> > 
> > 
> > 
> > 
> > From an extension _function_, yes. If
> > the returned
> > value is not an instanceof one of the types called out
> in
> > the mapping table
> > (http://xml.apache.org/xalan-j/extensions.html#ext-functions),
> > it will be returned as an object reference. Generally
> you
> > can't do much
> > with those except store them in variables and/or pass
> them
> > as parameters
> > to other extensions.
> > 
> > 
> > 
> > If your returned value *is* an
> > instanceof one of those
> > types... The best suggestion I can give you is to set
> up a
> > wrapper object
> > which does not implement those types, return the
> wrapper,
> > and have whoever
> > is using the value unwrap it again before accessing
> > it.
> 
> 
>      
> __________________________________________________________________________________
> Win 1 of 4 Sony home entertainment packs thanks to
> Yahoo!7.
> Enter now: http://au.docs.yahoo.com/homepageset/
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xalan-dev-unsubscr...@xml.apache.org
> For additional commands, e-mail: xalan-dev-h...@xml.apache.org
> 
>


      
__________________________________________________________________________________
Win 1 of 4 Sony home entertainment packs thanks to Yahoo!7.
Enter now: http://au.docs.yahoo.com/homepageset/

Attachment: ElemVariableMod.patch
Description: Binary data

---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscr...@xml.apache.org
For additional commands, e-mail: xalan-dev-h...@xml.apache.org

Reply via email to