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

Re: Crazy idea

Subject: Re: Crazy idea
From: Francis Norton <francis@xxxxxxxxxxx>
Date: Mon, 13 Sep 1999 12:02:45 +0100
Re: Crazy idea

Oren Ben-Kiki wrote:
> 
...
> 
> Yes, that's pretty annoying. It would have been so very nice if it were
> possible to write:
> 
> <xsl:call-template name="its-name" some-param-name="..."
> another-param-name="..."/>
> 
> As long that the parameter names don't clash with XSL attributes - XSLT
> could declare it would never define any attribute whose name matches some
> pattern (ends with "-param", say?). Today I've got little pieces of code
> which would be functions in any other language, but it turns out that the
> call to a named template is longer then the code it replaces!
> 

I was thinking of an extension to XSLT (I know, it's too late for this
version).

Something like:

<xsl:function name="reverse" namespace:fn="www.redrice.com">
	<xsl:param name="string" />
	<xsl:if test="$string">
		<xsl:value-of select="fn:reverse(substring($string,2))" />
	</xsl:if>
	<xsl:value-of select="substring($string,1,1)" />
</xsl:function>

so I could then call it with 

<xsl:stylesheet indent-result="yes" default-space="strip" 
	xmlns:xsl="http://www.w3.org/XSL/Transform/1.0"
	xmlns:fn="www.redrice.com">

...

<xsl:value-of select="fn:reverse('able was I ere I saw Elba')" />

It hadn't occurred to me that the compactness of calling functions is
more important than the compactness of writing them, but it does seem to
be true.

Francis.


 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.