xsl-list
[Top] [All Lists]

Re: [xsl] XSLT2: Keys vs. xsl:choose to distinguish groups

2007-03-20 02:40:38
Michael Kay wrote:
Why not use apply-templates to despatch based on the first member of the
group:

<xsl:for-each-group....
  <xsl:apply-templates select="current-group()[1]" mode="process-group"/>

<xsl:template match="A" mode="process-group">
  <xsl:for-each select="current-group()">
    ...

Thanks a lot, Michael! I had forgotten about this method, which is one of the finest approaches when having to build up nested groups. In the last days, I have been successful in applying this technique.


David Carlisle wrote:

> key returns a sequence of nodes you still need to use a choose (or
> apply templates) to cause any action to be taken with those nodes.

Thank you, David. I somehow had a wrong idea about the way keys are working. (And I'm sorry for having forged an incorrect test expression.) Using group-specific moded templates like Michael suggested is a much more elegant way of despatching than the case distinctions I thought of first.

  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>