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

Globals in xsl:script

Subject: Globals in xsl:script
From: Bill Martschenko <billmartschenko@xxxxxxxxx>
Date: Wed, 29 Sep 1999 00:14:53 -0700 (PDT)
xsl script example
I have a concern about globals in xsl:script.  Any
thoughts would be appreciated.

XSL specifies what and not how.  For example, by
specifying sort order, the only requirement is that
the final output is sorted.  The order in which nodes
actually have templates applied to them is not
specified.  I can imagine a sophisticated enough XSL
where the compiler would translate into dependency
graphs and use a topological order for eval.

In the sorting example, it is perfectly compliant for
the nodes to be evaluted in document order, the XSL
engine to collect all results, and then sort the
results *after* all templates have been instantiated.

Why is this important?  If templates call xsl:script
definitions and these definitions use globals, then
how is a script writer assured anything about the
sequence in which the script will be called.

Scripts that are strictly functions by the comp sci
definition have no side effects and hence don't care. 
Those with globals do.

MS has a sample on MSDN showing a 'totals' calculation
including intermediate sub-totals.  I think this
relies on implementation details the script writer
shouldn't use.

In fact, this specification of what and not how is
what functional programming languages like Sugar and
ML were all about.  Compiler can choose the best order
for eval.

I've posted a sample that used some functions with
zero side effects.  The functions look expensive, but
like functional programming languages, the compiler
can also rely on a 2nd pattern match of
"(//CATEGORY)[.='Category A'][0] to have the same
result as the 1st match.  Optimizations are possible,
that is.

Any thoughts?

Bill


__________________________________________________
Do You Yahoo!?
Bid and sell for free at http://auctions.yahoo.com


 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.