[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

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

Subject: Re: XSLT2: Keys vs. xsl:choose to distinguish groups
From: Yves Forkl <Y.Forkl@xxxxxx>
Date: Tue, 20 Mar 2007 10:40:03 +0100
Re:  XSLT2: Keys vs. xsl:choose to distinguish groups
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

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.