XML Editor
Sign up for a WebBoard account Sign Up Keyword Search Search More Options... Options
Chat Rooms Chat Help Help News News Log in to WebBoard Log in Not Logged in
Show tree view Topic
Topic Page 1 2 3 4 5 6 7 8 9 Go to previous topicPrev TopicGo to next topicNext Topic
Postnext
Mark  SpittleSubject: Native Java types and extension functions
Author: Mark Spittle
Date: 18 May 2006 03:58 AM
I have written some extension functions in Java, one of these returns a Vector of a class defined within the extension function class.

I yould like to iterate over this vector in xsl, passing each member of the vector to a tremplate as a param. Then call other extension functions to get information out of the Java class.

Something like this

<xsl:for-each select="mynamespace:my-function( node ) >
<xsl:call-template name="xxxxxxxxxx">
<xsl:with-param name="abc" select="."/>
</xsl
</xsl

<xsl:template name="xxxxxxxxxx">
<xsl:param name="abc"/>
<xsl:element name="Item" use-attribute-sets="Detail">
<xsl:attribute name="yyy">
<xsl:value-of select="mynamespace:my-second-function($abc)"/>
</xsl:attribute>
</xsl
</xsl
</xsl

my-function takes a NodeSet and returns a Vector of items
my-second-funcction takes an item and returns a String

This works nicely with Saxone but fails with xalan with a message

"SystemId Unknown; Line #0; Column #0; Can not convert #UNKNOWN (java.util.Vector) to a NodeList!"

Any help would be appreciated.

Postnext
Tony LavinioSubject: Native Java types and extension functions
Author: Tony Lavinio
Date: 18 May 2006 03:17 PM
Since callouts to non-XSLT extensions functions aren't specified in
the standard, each processor uses its own mechanisms.

In other words, what works for Saxon doesn't necessarily work for
Xalan.

See http://xml.apache.org/xalan-j/extensions.html#ext-functions
to see which datatypes are supported when calling into, and
http://xml.apache.org/xalan-j/extensions.html#ext-func-retval for
which types are used when returning values from Java when in Xalan.

And notice, sadly, that java.util.Vector is not among them.

Posttop
Mark  SpittleSubject: Native Java types and extension functions
Author: Mark Spittle
Date: 19 May 2006 03:55 AM
I saw that and assumed that java.util.Vector came under the "All Other Classes" category. I sort of expected that Xalan would have treated a "Non-XSLT Type" to be a java.lang.Object.

What I find strange is that Xalan seems to be quite happy accepting a Vector into a variable. However, when I try and pass that variable back into an extension function, it has become a NodeSet.

Maybe I'm just trying to use xslt beyond its scope. I have some XML which I need to enhance with data picked up from an external data source but selected according to rules embedded the xml data. XSLT Seemed like a good idea at the time.

 
Topic Page 1 2 3 4 5 6 7 8 9 Go to previous topicPrev TopicGo to next topicNext Topic
Download A Free Trial of Stylus Studio 6 XML Professional Edition Today! Powered by Stylus Studio, the world's leading XML IDE for XML, XSLT, XQuery, XML Schema, DTD, XPath, WSDL, XHTML, SQL/XML, and XML Mapping!  
go

Log In Options

Site Map | Privacy Policy | Terms of Use | Trademarks
Stylus Scoop XML Newsletter:
W3C Member
Stylus Studio® and DataDirect XQuery ™are from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2016 All Rights Reserved.