Advanced Extension Element Question

Adam Jenkins <[email protected]>
Newsgroups gmane.text.xml.xalan.java.user,gmane.text.xml.xalan.devel
Message-ID <[email protected]>
Hi All,

I'm just wondering if there is a way to place a java object (not a tree fragment) into the context output results from an extension element, and have it stay as an object (and not have it turned into a Document node).

Here is the exact use case.  I have a custom extension that creates an object that is used later on throughout my xslt.  The use case I want is:

<xsl:variable name="somevarname">
   <custom:myobject>
      <custom:property name="blah" value="blah"/>
   </custom:myobject>
</xsl:variable>

The function myObject(XSLProcessorContext, ElemExtensionCall) on the object mapped to the prefix 'custom' creates a java object, and places it to the output tree thus:

context.outputToResultTree(context.getStylesheet(), myCreatedObject);

Now, when I try to reference that later, it's been turned into a text node on a Document object whos value is the value of the toString() method for 'myCreatedObject'.  So I think I'm using the wrong method here...and that perhaps there's a better method other than outputToResultTree??

So I'm guessing xalan <xsl:variable...> tag is creating a document fragment from my object as best it can.

So my question is...is there anyway, to pass myCreatedObject up to the previous <xsl:variable...> declaration without it being toStringed (another method somewhere).

My fallback is to declare a varName attribute on all my custom extension and put the object on the local variable stack myself, but that's a pain and looks ugly, I'd prefer to do it using xsl:variable.

This is for an open source (large) xalan extension library to be releases asap.

Cheers
Adam


      __________________________________________________________________________________
Win 1 of 4 Sony home entertainment packs thanks to Yahoo!7.
Enter now: http://au.docs.yahoo.com/homepageset/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.