You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by John Gentilin <ge...@eyecatching.com> on 2002/09/20 22:27:06 UTC

Help with an extension function

I have a Java method that wants to return a String array. I am looking
for a
efficient way to return the String array so that I can work with in my
stylesheet.

 I.e. I could create a Document and add in each element of the String
array as
a Node then return the Document but that seems a bit extreme.

Any ides for a simpler mechanism ??

Regards
John G




Re: Help with an extension function

Posted by Joseph Kesselman <ke...@us.ibm.com>.
If you just want to pass it to another extension, you can return the array 
and we'll pass it through.

But XSLT itself can only process XSLT's native datatypes, and in XSLT 1.0 
there's nothing that corresponds to array-of-strings. You need to convert 
it into something we can handle -- a single string separated by delimiters 
(which means you have to tease it apart again, which is painful), or a set 
of nodes (which currently seems to be possible only by returning a DOM 
fragment) would seem to be your best choices.

XSLT 2.0 adds the concept of "sequence"; as we move in that direction we 
might want to enhance extension support so it can treat returned arrays or 
vectors as sequences (and vice versa when passing parameters to an 
extension). But our XSLT20 code is still in early-draft stages, and 
sequences are one of the major reason it's been slow going (along with 
other datatype changes).

______________________________________
Joe Kesselman  / IBM Research