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

Re: [exsl] Naming exsl:return/exsl:result (Was: Re: Fu

Subject: Re: [exsl] Naming exsl:return/exsl:result (Was: Re: Functional programming in XSLT)
From: "Lassi A. Tuura" <lat@xxxxxx>
Date: Tue, 20 Mar 2001 19:04:09 +0100
Re: [exsl] Naming exsl:return/exsl:result (Was: Re:  Fu
> but how do you propose that a template return such nodes?

My idea was that when RTFs will go away, XSL could also do away with the
distinction of copying and returning node sets.  xsl:copy-of could just
return the node set, not make a new copy of it.  It the context requires
it, the result would be turned into a copy -- e.g. if it is being
inserted as a content of something else, such as the output tree.

I haven't thought through this; it might not be worth the hassle for
xsl:copy-of because of resulting confusion or difficult wordings in the
standard.  However, this change (or a new primitive) has nothing to do
with function result values in itself, it is just as useful even if
exsl:function did not exist.  It should be allowed where xsl:copy-of is
allowed, in particular in xsl:variable, xsl:param and xsl:with-param. 
It could be used to return values from exsl:function too.

For me the need for this primitive arises from removing RTFs -- and
simply has a natural extension to the functions that need to return
values.

Basically, why couldn't I say this?
 <xsl:call-template name="xref-to">
   <xsl:with-param name="node">
     <xsl:for-each select="document('glossary.xml')">
       <xsl:copy-of select="id($target)"/>
     </xsl:for-each>
   </xsl:with-param>
 </xsl:call-template>

It would certainly be possible to turn the <xsl:for-each> into an
exsl:function that uses exsl:return-value, but that is a bit of a waste
when the parameter initialisation is trivial but cannot be expressed as
a `select' attribute (as above).  In such a situation inserting it
directly into with-param would be a lot simpler.  Only: I need to be
guaranteed that I am getting the original nodes so that if I reprocess
them I get the same instances, not new copies.

> If instead you use exsl:function then what was a template becomes a
> function so you can put arbitrarily complex stuff into a single select.
> select="my:function(xxx)" where my:function is defined by one of the
> extension proposals in these threads.

Sure, and that will be nice.

//lat
-- 
Perfection of means and confusion of goals... characterize our age.
	--Albert Einstein

 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.