Jason --
Just FYI, there is already such an extension function in Xalan called
nodeset (http://xml.apache.org/xalan-j/extensionslib.html#nodeset) that
does what you want, I think.
Gary
jason heddings wrote:
>
> Gary-
>
> Thanks for looking into this! I am able to use a Node in the argument
> list and the processor does find the function. Thank you very much!
>
> Here's what I was able to accomplish (in case you're curious):
>
> I was trying to mimic the XSL 1.1 spec behavior of creating a tree
> fragment in an XSL variable and being able to use that tree as a node
> set (i.e. call apply-templates on it). According to XSL 1.0, you can
> only copy that tree to the output, or use it to pass to other
> functions. With this extension function, I am able to return a Node of
> the fragment and call apply-templates against it.
>
> OK, so the only thing my extension does is:
>
> <java-source>
>
> /** Converts a DocumentFragment to a NodeSet.
> */
> public Node nodetree( Node frag ) {
> return frag ;
> }
>
> </java-source>
>
> Not terribly exciting, but it was the only way I could get it to work,
> so it's actually very cool! Thanks again!
> --jah
>
> Gary L Peskin wrote:
> >
> > Jason --
> >
> > Hi. The problem is that we don't currently support DocumentFragment as
> > an argument in a java extension for receiving an RTF. I seem to recall
> > that there was a good reason for this but I don't remember that reason
> > at the moment. So, I'll do some more thinking and either come up with
> > the reason or add in the support for the java argument being a
> > DocumentFragment.
> >
> > In the meantime, can you substitute a NodeIterator or NodeList or Node?
> > The Node will get you the first child of the DocumentFragment.
> >
> > Gary
> >
> > jason heddings wrote:
> > >
> > > Hello!
> > >
> > > I am trying to create an extension that will accept a Result Tree
> > > Fragment as it's argument. From the Xalan Extensions doc on the site, I
> > > gathered this is of type org.w3c.dom.DocumentFragment and I created a
> > > method that accepts this argument. The processor is unable to find this
> > > method, however.
> > >
> > > As a sanity check just to make sure that the class and method were
> > > found, I changed the method to accept a String and it worked fine.
> > >
> > > <java-source>
> > >
> > > public String parse( DocumentFragment frag ) {
> > > return "running parse( )" ;
> > > }
> > >
> > > </java-source>
> > >
> > > <xsl-source>
> > >
> > > <xsl:variable name="tree-frag">
> > > <new-element>
> > > <child />
> > > </new-element>
> > > </xsl:variable>
> > >
> > > <xsl:value-of select="ext:parse( $tree-frag )" />
> > >
> > > </xsl-source>
> > >
> > > Should this work?
> > >
> > > Thanks in advance for any help!
> > > --jah
>
> --
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> \\\|/// Jason Heddings ((
> \\ ~ ~ // 303.272.5166 (x75166) C|~~|
> (/ @ @ /) [EMAIL PROTECTED] `__'
> ~~oOOo~(_)~oOOo~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~