xsl-list
[Top] [All Lists]

Re: [xsl] Grouping simple flat structure

2008-03-17 08:16:47
On 17/03/2008, Ian Proudfoot <ian(_dot_)proudfoot(_at_)itp-x(_dot_)co(_dot_)uk> 
wrote:
Thank you Andrew. I was not aware of the sibling recursion template.
 As I was already using the basic identity transform template, I replaced it
 with the modified version, but now some elements are not being copied to the
 output. Should it be possible to swap these two templates without re-working
 other templates?

Not really because a node that doesn't apply-templates to it's
following sibling will stop the recursion, whereas using the standard
identity the following sibling will get processed because of the
existing apply-templates call that was made from its parent.

For example:

<foo>
   <bar/>
   <baz/>
   <bar/>
</foo>

with a no-op template for baz:

<xsl:template match="baz"/>

Here using the standard identity template both <bar>s will get
processed because of the <xsl:apply-templates/> call when the context
node was <foo>.

However using sibling recursion only the first <bar> is processed from
<foo>, then <baz/> then it stops, so using sibling recursion every
template has a responsibility to process its following sibling.


-- 
Andrew Welch
http://andrewjwelch.com
Kernow: http://kernowforsaxon.sf.net/

--~------------------------------------------------------------------
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>