Re: Designs for XSLT functions (Was: Re: [xsl] RE: syntax sugar for call-template)

Subject: Re: Designs for XSLT functions (Was: Re: [xsl] RE: syntax sugar for call-template)
From: "Clark C. Evans" <cce@xxxxxxxxxxxxxx>
Date: Wed, 21 Feb 2001 08:08:28 -0500 (EST)
On Wed, 21 Feb 2001, Jeni Tennison wrote:
> > 3.  Create a new tag, <xsl:append select="xpath" /> which will:
> >
> >     (a) if the xpath type is a node-set, then it appends each
> >         element of the node set onto the result-set.
> >
> >     (b) otherwise, a text node is appended with the string-value
> >         of the path expression.
> 
> I'm not sure why you need exsl:append (and also think it looks
> dangerously close to something [say it quietly] procedural). Can you
> give a use case that shows how useful it would be?

I know there is a way to do this... but let's say I wanted
a node set containing the 4th child of each node in a list.

 ...
 <xsl:variable name="list" select="..." />
 <xsl:for-each select="$list" />
   <exsl:append "./node()[4]" />
 </xsl:for-each>
 <exsl:return />
 ...

Not a very good example... but then again, I was trying
to think of a syntax that would allow a node set to be
built-up over the course of the function, and <exsl:return ... />
does not do this.

It isn't "procedural", since you are appending (not mutating) a list.

clark


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread