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
Conferences Close Tree View
+ Stylus Studio Feature Requests (1192)
+ Stylus Studio Technical Forum (14621)
+ Website Feedback (249)
- XSLT Help and Discussion (7625)
-> + Use of before and after string (3) Sticky Topic
-> - How do I substitute element ty... (1)
-> + How does one add working days ... (4)
-> - Help, I have existing XLT and... (1)
-> + Need help on XSLT issue - (2)
-> + EDI to XML Conversion (7)
-> - XML To JSON Conversion using X... (1)
-> + Formatting Paragraphs to same ... (2)
-> - Grouping of records (1)
-> + Problems with xsd 1.1 (4)
-> + XML to HL7 mapping (3)
-> + XSLT 3 and Iterate (2)
-> + XSL-FO to PDF preview (3)
-> + java.lang.RuntimeException: Er... (2)
-> + Create Acroforms with Stylus X... (2)
-> + How to change XSLT parameter s... (3)
-> + how to change format of the da... (2)
-> + Search "Next 8 Results " doesn... (2)
-> - Support for Git (1)
-> + newbee (8)
-- [1-20] [21-40] [41-60] Next
+ XQuery Help and Discussion (2017)
+ Stylus Studio FAQs (159)
+ Stylus Studio Code Samples & Utilities (364)
+ Stylus Studio Announcements (113)
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.

   
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.