xsl-list
[Top] [All Lists]

Re: [xsl] Wrap changing element sequence into container: with 'for-each-group'?

2007-01-30 06:55:15
Hi List,

thank you for your help, David and Abel. While the two suggestions you proposed are elegant solutions, my problem has changed meanwhile. :-)
That is, I did not explain it correctly.

My context is as follows: I have a series of `p´ elements which should be treated differently according to their `style´ attribute. Rather than defining a set of push style templates with `match="p[style='value1']"´, I prefer to call, for each `p´, a named template acting as general dispatcher, which will call one out of a set of action-specific named templates. Each style is assigned to exactly one type of action.

What I am having trouble to do is adding a container around a specific (fixed-order) sequence of those `p´ elements, say, `p[style="a"]´ and `p[style="b"]´, where the first of these may not always occur. However, the processing of `p[style="b"]´, and more particularly the necessity of creating a container at that moment, varies with the presence of `p[style="a"]´. I came up with two alternative, but similar ideas:

1) "Tell" the template in charge of `p[style="b"]´ about the fact whether the container has already been added when processing `p[style="a"]´.

2) When processing `p[style="a"]´, hold execution of the container creation by putting it on a kind of stack that is shared with `p[style="b"]´. Only when processing the latter we create the container, after deleting it from the stack, if necessary.

Does that make sense to you? If so, which way can I go to implement it? (Tunnel parameters?) Or can you think of other approaches that might be preferable?

  Yves



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

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