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 March 15th, 2012, 11:00 AM
Authorized User
 
Join Date: Mar 2012
Posts: 10
Thanks: 4
Thanked 0 Times in 0 Posts
Default How to pass populated java objects in <xsl:param>

Hi Michael,

I have a fully populated java object using which I would like call methods on, from the xsl file. I don't want to use

<xsl:variable name="ref" select="java:com.foo.bar.SomeClass.new()"/>,

since the new instance created does not have the properties which are required by the method I call.

I tried transformer.setParamater("ref", this) passing the fully populated object where I am transforming the xsl.

and then declared the parameter in xsl as <xsl:param name="ref" />

But the problem is I am not able to access it by saying,

<xsl:variable name="var" select="java:doSomething($ref)">

nor

<xsl:variable name="var" select="java:$ref"/>

and call methods using $var

Is there a way to achieve this? Please let me know if you need more details to clarify.

Thanks,
Aravind.
 
Old March 15th, 2012, 11:09 AM
samjudson's Avatar
Friend of Wrox
 
Join Date: Aug 2007
Posts: 2,128
Thanks: 1
Thanked 189 Times in 188 Posts
Default

This is probably specific to the XSLT processor you are using.
__________________
/- Sam Judson : Wrox Technical Editor -/

Think before you post: What have you tried?
The Following User Says Thank You to samjudson For This Useful Post:
aravindram87 (March 20th, 2012)
 
Old March 15th, 2012, 11:15 AM
Authorized User
 
Join Date: Mar 2012
Posts: 10
Thanks: 4
Thanked 0 Times in 0 Posts
Default

Thanks for the quick response Sam. I am using this implementation of Transformer to process the xsl - com.sun.org.apache.xalan.internal.xsltc.trax.Trans formerFactoryImpl Is this what you are talking about?
 
Old March 15th, 2012, 11:29 AM
Authorized User
 
Join Date: Mar 2012
Posts: 10
Thanks: 4
Thanked 0 Times in 0 Posts
Default

Sam,

You were absolutely right. I used a different implementation and I am able to achieve this.

Thanks a ton.

Aravind.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Saxon 9.1.0.3 issue with <xsl:with-param> Chelsea Valentine XSLT 4 March 23rd, 2010 03:03 PM
<xsl:copy-of> with <xsl:element> learningxsl XSLT 8 February 5th, 2010 09:26 AM
xsl:function pass param to attribute of xsl:instruction bonekrusher XSLT 4 March 31st, 2009 09:06 AM
embedded <xsl:element> into <xsl:with-param> petergoodman XSLT 2 July 9th, 2008 06:36 AM
Performance for <xsl:import> and <xsl:include> vikkiefd XSLT 2 April 16th, 2008 08:06 AM





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