Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 28th, 2006, 07:37 AM
Registered User
 
Join Date: Jun 2006
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default Java to XSL // Return Array

Has somebody a working sample on how to return a Java array to XSLT for further processing?
I need to return a String[] to XSL and process the array within XSL.
There seem to be a solution by Saxon engine, but I didn't find any sample.

 
Old June 28th, 2006, 07:53 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

The class net.sf.saxon.om.NamePool contains a method with this signature:

    public static String[] parseClarkName(String expandedName) {..}

Here's an example of how to call it from XSLT:

    <xsl:variable name="parts" select="np:parseClarkName('{http://saxon.sf.net}evaluate')"
                  xmlns:np="java:net.sf.saxon.om.NamePool"/>
    <xsl:for-each select="$parts">
      <part><xsl:value-of select="."/></part>
    </xsl:for-each>

The output is:

<part>http://saxon.sf.net</part>
<part>evaluate</part>

For further information on calling Java extension functions in Saxon, see http://www.saxonica.com/documentatio...functions.html

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
 
Old June 29th, 2006, 06:40 AM
Registered User
 
Join Date: Jun 2006
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi,
maybe I didn't explain correctly what I want to do:
I have a Java method getFiles which reads an STRING array of file names and returns it to XSL.
Here is the point where I need help...
How can I read this array with XSL and split this array (file1, file2, file...) for processing?

 
Old June 29th, 2006, 06:05 PM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

I showed you an example of XSLT code that calls a Java method that returns an array of strings and then processes the strings. Sorry, I don't see what more I can do.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference





Similar Threads
Thread Thread Starter Forum Replies Last Post
return more then one array from class file Komila ASP.NET 2.0 Basics 4 June 27th, 2007 07:10 PM
Javascript Function return save in XSL Variable Vrokad XSLT 2 June 2nd, 2007 02:54 AM
How to return an array ? arulkumar ASP.NET 2.0 Professional 0 March 3rd, 2007 03:15 PM
how to return nodeset in template in xsl:variable alexshiell XSLT 3 March 18th, 2005 01:36 PM
How to return array value from a function nebpro BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 1 September 29th, 2004 12:14 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.