[Top] [All Lists]

Re: [xsl] Return structured java Object (e.g. List) to XSLT for further processing

2014-12-15 05:16:11
This question is very Saxon-specific. In future, I would suggest using a 
Saxon-specific forum, e.g. saxonica.plan.io.

public Object footnote(Object nr, Object html) { … }
I can cast the nr (which is “//footnote/@nr”) and html (which is 
“//footnote/*”) to SequenceExtent.

You can't rely on them being supplied as instances of SequenceExtent. For 
example, if the value is a singleton or an empty sequence (or in future 
releases) a different class might be used.

Better to declare the argument types as net.sf.saxon.om.Sequence, and make no 
assumptions beyond them being a Sequence.

Now I can process the footnotes.
As result I want to return the processed footnotes, so that they can be 
processed by xsl as an result tree fragment.

Rather depends how you are constructing them. It might be easiest to use a tree 
model that's designed for manipulation in Java, e.g. JDOM2, and then return a 
JDOM2 DocumentWrapper. If you want to construct a Saxon tree, you can 
instantiate a Builder and then feed it startElement() and endElement() events, 
but that's not especially convenient. Ultimately, though, you want to return an 
instance of the class DocumentInfo.

Michael Kay
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/1167547
or by email: xsl-list-unsub(_at_)lists(_dot_)mulberrytech(_dot_)com
<Prev in Thread] Current Thread [Next in Thread>