Re: [xsl] looping through result tree fragments to aggregate data

Subject: Re: [xsl] looping through result tree fragments to aggregate data
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Sat, 24 May 2003 13:35:23 -0400
Erika,

You can certainly solve the problem by pipelining the process, as Simon says, but it may also not be necessary.

In general, in XSLT 1.0 you are prevented from operating over result tree fragments (hence the name *result* tree fragments) for design reasons which have since come to be reconsidered, but which have been respected in good faith by the implementors of the engines. Most have, like MS, also provided an extension function to allow you to do this anyway (which is, along with this extension's popularity, undoubtedly a large reason why the constraint will be removed in XSLT 2). So the short answer is, "no, if you need to process over an RTF in a single pass, there's no better way than the extension function".

Since this particular extension function is so widely implemented, however, it's not as harmful a dependency as some might be; you can sometimes even use a standard syntax for it (go see http://www.exslt.org).

Also, depending on the original problem, sometimes you don't even need the original aggregation step, or can perform it in such a way that you can aggregate a node set, not an RTF. (One would have to see that for-each loop to know in your case. Does its operation merely collect a node set, or does it do something more complex?) If you can do this, you can process this node set; the problem goes away.

XSLT also provides means for testing the availability of extension functions, which you can use to make stylesheets more portable.

Cheers,
Wendell

At 12:31 AM 5/24/2003, Simon wrote:
Use pipelined XSLT!

simon

On Friday, May 23, 2003, at 07:48 PM, Erika Marlow wrote:

I am working on a report that uses a for-each loop to aggregate information
and create a result tree fragment in a variable. The person who developed
the original XSL used the msxsl:node-set() extension function to move over
the RTF.  Is there a better way to get data out of an RTF that doesn't use
the extension function? I have read through the XSLT rec. and don't quite
understand how the xsl:copy and xsl:copy-of tags work.  The XSL code and XML
data are cumbersome and I haven't included it here, but I will provide it on
request.

___&&__&_&___&_&__&&&__&_&__&__&&____&&_&___&__&_&&_____&__&__&&_____&_&&_ "Thus I make my own use of the telegraph, without consulting the directors, like the sparrows, which I perceive use it extensively for a perch." -- Thoreau


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


Current Thread