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

RE: Let's face it: side effects are sometimes necessar

Subject: RE: Let's face it: side effects are sometimes necessary!
From: "Michael Kay" <michael.h.kay@xxxxxxxxxxxx>
Date: Tue, 3 Dec 2002 11:01:04 -0000
side effects of ants
> 
> I used to use <xsl:variable ...> elements on the toplevel of 
> an XSLT transform for their side-effects. The 
> xsl:variable/@select would call into some extension function, 
> that would set up some static data (initializations) of some gizmo.

At the top level of the stylesheet, surely it's much easier to declare
xsl:param's and supply the initial value from the calling application?
> 
> I am thinking of:
> 
> <xsl:variable name="gizmo" saxon:eval-immediately="yes"
>     xmlns:g="java:my.package.Gizmo"
>     select="g:new($gizmoInitializationParameter)"/>
>
If you specify saxon:assignable="yes", the variable will be evaluated
whether or not it is referenced (except in the case of global variables
that are overridden by another of higher precedence).

One reasonably reliable way to force any XSLT processor to evaluate your
extension functions is to make the function return an empty string, and
call the function in an <xsl:value-of/>. The system can't possibly know
that it will return an empty string, so it has to call the function; and
moreover, it's very unlikely that it will call it out-of-sequence,
because it has to put the results together in the right order.  

Michael Kay
Software AG
home: Michael.H.Kay@xxxxxxxxxxxx
work: Michael.Kay@xxxxxxxxxxxxxx 


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


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.