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

XSL Transformations Requirements Version 1.1 - a crazy idea?

Subject: XSL Transformations Requirements Version 1.1 - a crazy idea?
From: Francis Norton <francis@xxxxxxxxxxx>
Date: Tue, 05 Sep 2000 09:44:35 +0100
substring function in xsl transformations
The Requirements Document contains a reuirement for Portable Extension
Functions Implementations
(
http://www.w3.org/TR/2000/WD-xslt11req-20000825#section-Requirements-for-Portable-Extension-Function-Implementations
).

This discusses ways to make sure that extensions in Java or EcmaScript
will be portable between XSLT implementations, while specifically making
support for extensions in *any* language an optional feature.

The "Crazy Idea" thread from September 1999 came up with some
interesting ideas for allowing extension functions in XSLT itself - for
example, James Clark's reply:

<quote
src="http://www.mulberrytech.com/xsl/xsl-list/archive/msg05080.html">

> 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')" />

The trouble with that is that functions would only be able to return
result tree fragments. I had been thinking of something like:

<xsl:variable name="reverse"
 select="function($s)
          (concat($s ? $reverse(substring($s,2)) : '',
substring($s,1,1)))"/>

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

Something like you suggest would be useful too (I would think of it as a
way to call named templates from functions).

There are plenty of interesting possibilities for XSLT/XPath v2.

James

</quote>

If such a proposal was easy to implement, and could be shown to be
"syntax sugar" - then would it not be a good idea to specify and indeed
mandate it for XSLT 1.1 as the ultimate in portable extension function
support?

Francis.
-- 
Francis Norton.

Defy Convention? Deify Convention!


 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.