xsl-list
[Top] [All Lists]

Re: methods of converting an xml string to xml nodes

2002-11-07 08:24:36
I'm using xalan processor. And what I need is to convert
an xml string to xml nodes so it can be read from stylesheet.

Write an extension function which invokes an XML parser to convert the 
string to DOM nodes, return the top-level node or a DOM NodeList to Xalan, 
and it'll be treated as an XSLT nodeset.

If your string can't be interpreted as a well-formed document, you'll have 
to find a parser which can handle document fragments.

See http://xml.apache.org/xalan-j/extensions.html for more information 
about how to write and invoke Xalan extension functions.


Alternatively: Write an Entity Resolver which recognizes a specific URI as 
a request to read from your string buffer, plug it into the Xalan/Xerces 
system, then use the XSLT document() function to request that URI. This is 
a bit more obscure but may be more efficient since you don't need to take 
the intermediate step of generating the DOM nodes.


______________________________________
Joe Kesselman  / IBM Research

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



<Prev in Thread] Current Thread [Next in Thread>