xml-xalan-j-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mk...@ca.ibm.com
Subject Re: extensions: creating nodes for return from custom extension elements
Date Tue, 08 Oct 2002 14:32:40 GMT

We use DTM to model the source xml. Since the DTM is immutable, you cannot
create a new node in the source document.

If you want to return a node which does not exist already, you can create
it using the DocumentBuilder from w3c DOM. This is also what we use when we
want to return a new nodeset from an extension. Please look at the tokenize
() interface in org.apache.xalan.lib.Extensions for an example usage.


Morris Kwan
XSLT Development
IBM Toronto Lab
Tel: (905)413-3729
Email: mkwan@ca.ibm.com

                      Simon Kitching                                                     
                      <simon@ecnetwork.        To:       xalan-j-users@xml.apache.org 
                      co.nz>                   cc:                                    
                                               Subject:  extensions: creating nodes for return
from custom extension elements       
                      10/08/2002 11:44                                                   

Hi All,

I need to write an extension element which returns a node with various
children, attributes, etc.

Does anyone know how I create nodes in my extension code? None of the
examples or standard Xalan extensions appear to do this, ie I can't find
any code to steal.

Normally, nodes are created via factory methods on the Document object
to which they are later going to be attached. However I can't see any
way to get at the Document object associated with the Result object to
which the results of the transformation are being written.

Looking at the XSLProcessorContext.outputToResultTree method, it looks
like the nodes that are returned from the extension are actually
expected to reside in the source document (ie are cloned when output to
the result), but I can't see any way to create new nodes in the source
document either.

The ElemExtensionCall object passed to the extension method inherits
from UnImplNode, which has a Node interface, but whose methods (like
getOwnerDocument) are not very useful :-).

I'm probably missing something very obvious....



View raw message