xsl-list
[Top] [All Lists]

Re: [xsl] Processing approach

2017-07-18 09:07:06

I have a template that matches nodeC based on its ID, copies it contents and 
appends child nodes.
Its at this time that much info gets derived which is useful elsewhere. 


In XSLT 1.0 there are a couple of approaches to this:

(a) put both the primary and secondary results into a variable, and then 
process this using the node-set extension

(b) put both the primary and secondary results in the result tree of the 
transformation, and then post-process this in a second pass

(these aren't actually very different: in both cases you're doing a pipeline of 
two transformations, the only difference is whether it's done all within one 
stylesheet or using separate stylesheets).

In XSLT 3.0 (or as vendor extensions) there's a range of options:

(a) memo functions: allow you to call a function twice, and the second time, 
the results are remembered from the first time.

(b) accumulators: similar to memo functions in that the result of a function 
can be used repeatedly without recomputation, but geared to the situation where 
the value of the function for each node is computed incrementally as you walk 
through the tree.

(c) maps: a function can in effect return multiple results, by returning a map.

Michael Kay
Saxonica
--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/1167547
or by email: xsl-list-unsub(_at_)lists(_dot_)mulberrytech(_dot_)com
--~--

<Prev in Thread] Current Thread [Next in Thread>