[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

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


Subject: Re: [xsl] Return structured java Object (e.g. List) to XSLT for further processing
From: "Michael Kay mike@xxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 15 Dec 2014 11:16:04 -0000

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
Saxonica


Current Thread
Keywords
xsl