Link to home
Start Free TrialLog in
Avatar of go4java
go4java

asked on

Java/XSL: Return array to XSL

We need to return a resulting array to XSL. How to do in XSL?
Avatar of girionis
girionis
Flag of Greece image

Not sure what you are trying to do, but you will need to start here: http://xml.apache.org/xalan-j/index.html
Avatar of go4java
go4java

ASKER

Yes, that is known. Xalan is a Java XSLT engine.
My question is on how to RETURN a Java ARRAY to XSL script.
I've a Java method and the resulting array should be transferred to XSL...
When you say script you mean the xsl file that will do the transformation?
Avatar of go4java

ASKER

YES
How do you create the script? Do you do it via Java? If yes then you will need to loop through the array and write the proper values into the script.
Avatar of go4java

ASKER

The XSL script is been created with Stylus Studio, the Java servlet with NetBeans.
We need an XSL script on how to process the array returned by Java.
Sorry, I am lost again. You have an XSL script with some rules on how to turn XML into some content. Now you want to pass information from a Java array in there? Is this correct?
Avatar of go4java

ASKER

Basically, yes.
In XSL, you have the possibility to store data to 'variables' or 'parameters'.
I need to loop over the array which has to be imported from Java method.
You will have to recreate the XSL file and assign the values of the java array wherever you want them.
Are you treating the array as a single xml file for the xsl to parse through?
Then serialize the array, and pass the memory to an xsl processor as input.

Also, it may be simpler to have your xsl call java extension functions instead of the other way around.
Avatar of go4java

ASKER

We solved the problem as follows:
- Call a Java method to fill an array with file names
- Tokenize file list with a seperator, e.g. semicolon and store to String
- Return String to XSL and loop recursively through the file string
ASKER CERTIFIED SOLUTION
Avatar of CetusMOD
CetusMOD
Flag of Netherlands image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial