[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Calling java in xsl.

Subject: Re: Calling java in xsl.
From: Kamal Bhatt <kbhatt@xxxxxxxxx>
Date: Wed, 15 Feb 2006 08:37:03 +1100
Re:  Calling java in xsl.
Michael Kay wrote:

<xsl:variable name="todayPlus" select="cal:add($today, 6, $offset)"/>

Now, what bothers me about this is the variable todayPlus which serves no purpose other than giving us an opportunity to call add. How can we avoid this useless call?




You're right to be bothered: if Saxon were executing this, it would decide
that the variable served no useful purpose, and wouldn't evaluate it. Even
if it were evaluated, the order of evaluation is not guaranteed.

Of course in XSLT 2.0 you can do this calculation within the language, so
the problem wouldn't arise. But if you do need to call extension functions
for their side-effects rather than their result, my usual advice is to use a
construct where the result appears to be used. In many cases the Java method
returns void, so (in Saxon at any rate) you can do

<xsl:sequence select="cal:add($today, 6, $offset)"/>



Thanks for that. Mainly for my own curiousity, how do we make this call directly in 2.0?

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.