[xsl] How to: Returning HTML Elements From a Saxon Extension Function (6.5.x)

Subject: [xsl] How to: Returning HTML Elements From a Saxon Extension Function (6.5.x)
From: "W. Eliot Kimber" <eliot@xxxxxxxxxx>
Date: Thu, 17 Apr 2003 13:39:22 -0500
I want to make sure I'm thinking about a small XSLT puzzle correctly: my requirement is to provide a Saxon extension function that returns a restult tree (or a string that will become a result tree). What I'm doing is building a navigation bar based on configuration information held in an external file and accessed through an external Java library.

If I just return the markup as a string (e.g., return "<a href="#foo">bar</a>";) then it gets escaped, as you would expect.

Looking through the docs for extension functions, it appears that I need to return a NodeInfo node that contains nodes for the markup. NodeInfo is a Saxon-specific DOM implementation. The Saxon DOM implementation is read-only, and if I'm understanding the docs correctly, I have to use a SAX process to construct new nodes.

This leads to two questions:

1. Is my analysis correct or have I missed some easy way to return this markup?

2. If my analysis is correct, does anyone have an example of doing this sort of off-the-cuff SAX processing I could crib from? I didn't find any examples in the Saxon-supplied samples.

Thanks,

Eliot
--
W. Eliot Kimber, eliot@xxxxxxxxxx
Consultant, ISOGEN International

1016 La Posada Dr., Suite 240
Austin, TX  78752 Phone: 512.656.4139


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



Current Thread