This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: Designs for XSLT functions (Was: Re: RE: syntax sugar for call-template)
- To: <xsl-list at lists dot mulberrytech dot com>
- Subject: Re: Designs for XSLT functions (Was: Re: [xsl] RE: syntax sugar for call-template)
- From: "Steve Muench" <Steve dot Muench at oracle dot com>
- Date: Thu, 22 Feb 2001 12:25:05 -0800
- References: <Pine.LNX.4.21.0102221455560.13644-100000@clarkevans.com>
- Reply-To: xsl-list at lists dot mulberrytech dot com
With no offense to the idea, appending nodes seems so
"JSP-ish" and 3GL-ish, and not very XSLT-ish to me.
Why couldn't you implement the function without
recursion with a technique like:
<exsl:function>
<xsl:variable name="foo">
<xsl:for-each>
<xsl:sort ... >
<xsl:if test="5 <= position()">
<xsl:copy-of select="."/>
</xsl:if>
</xsl:for-each>
</xsl:variable>
<exsl:return select="$foo"/>
</exsl:function>
______________________________________________________________
Steve Muench, Lead XML Evangelist & Consulting Product Manager
BC4J & XSQL Servlet Development Teams, Oracle Rep to XSL WG
Author "Building Oracle XML Applications", O'Reilly
http://www.oreilly.com/catalog/orxmlapp/
----- Original Message -----
From: "Clark C. Evans" <cce@clarkevans.com>
To: "Jeni Tennison" <mail@jenitennison.com>
Cc: <xsl-list@lists.mulberrytech.com>
Sent: Thursday, February 22, 2001 11:58 AM
Subject: Re: Designs for XSLT functions (Was: Re: [xsl] RE: syntax sugar for call-template)
| On Wed, 21 Feb 2001, Jeni Tennison wrote:
| > <xsl:variable select="my:first-alphabetically($nodes, 5)" />
| >
| > <exsl:function name="my:first-alphabetically">
| > <exsl:param name="nodes" />
| > <exsl:param name="number" />
| > <xsl:for-each select="$nodes">
| > <xsl:sort />
| > <xsl:if test="position() <= $number">
| > <exsl:append select="." />
| > </xsl:if>
| > </xsl:for-each>
| > </exsl:function>
|
| Yes. This is what I was intending. In general, any
| function which has to "build" a node-set could use
| this method. The recursive variant you had below
| didn't look like fun at all; kinda nasty hoop to
| jump to just do an "append".
|
| What do you all think?
|
| Clark
|
|
| XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
|
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list