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: Tue, 20 Feb 2001 13:37:51 -0500 (EST)
I've given a bit of thought to exsl:return and I see there
are two distinct, and perhaps seperable requirements:
  (a) to exit a exsl:function 'early
  (b) to allow the return of a node-set

Trying to keep them seperate, I came up with:

1.  For this discussion, assume that a function always 
    returns a node-set, aka list.  Call this growable 
    list the result-set.

2.  For normal template-style items, such as xsl:element,
    xsl:value-of, xsl:text, let the corresponding result-fragment
    be created; and then convert the result-fragment into a 
    tempoary node-set, and append the node-set to the result-set.

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.

4.  If execution must return 'early, then a new tag, <xsl:return /> 
    can be used to return the result-set constructed.

5.  If given a select statement, like <xsl:return select="xpath" />,
    then the xpath expression selected will be returned instead
    of the result-set being constructed.

Thoughts?  Certainly this will not stand muster as a serious
proposal... it is just a few ideas jotted down.  It is 
an attempt at the "accumulator" pattern.


 XSL-List info and archive:

Current Thread