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: Jeni Tennison <mail at jenitennison dot com>
- Subject: Re: Designs for XSLT functions (Was: Re: [xsl] RE: syntax sugar for call-template)
- From: "Clark C. Evans" <cce at clarkevans dot com>
- Date: Thu, 22 Feb 2001 14:58:45 -0500 (EST)
- cc: xsl-list at lists dot mulberrytech dot com
- Reply-To: xsl-list at lists dot mulberrytech dot com
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