Re: FO->Area as XSLT extension function

On 03/21/2013 05:56 AM, Jirka Kosek wrote:
> On 21.3.2013 3:02, Arved Sandstrom wrote:
>
>> After about 3 hours of reading Saxon Java API docs and hacking, the
>> closest I ever got was locating the DOMEnvelope class, but evidently
>> that's not the right thing either. I messed around with PJConverters but
>> they don't appear to understand DOM Nodes.
>>
>> It appears that Saxon passes the FO node tree variable in as a
>> TinyDocumentImpl, which implements no W3C DOM stuff.This is the nub of
>> the problem.
>>
>> Anyone way more familiar with the Saxon 9 HE Java API who might have
>> some ideas? Thanks.
> I think that for such Saxon specific question it will be better to ask
> at saxon-help mailing list
> (https://lists.sourceforge.net/lists/listinfo/saxon-help)
>
> IIRC Saxon can be configured to operate on DOM trees instead of its
> TinyTree object model -- then you will not be forced to convert back and
> forth DOM in order to interface with FOP.
>
> 				Jirka
>
Just needed to sleep on it. :-) I was in the right ballpark, just too 
tired last night to decipher all the API details.

TinyDocumentImpl item = (TinyDocumentImpl) sis[0].next();
Document foTree = (Document) DocumentOverNodeInfo.wrap(item);
...
Source src = new DOMSource(foTree);

(where 'sis' is a SequenceIterator[]) works nicely. Also, at the cost of 
somewhat more Java complexity the Saxon-based stylesheet is less 
XSLT-engine-specific.

I need to do a bit of refactoring but I ought to have a Saxon9HE 
integrated extension function mailed out NLT tomorrow.

Arved

Received on Thursday, 21 March 2013 10:44:48 UTC