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

Re: Wrap changing element sequence into container: wit

Subject: Re: Wrap changing element sequence into container: with 'for-each-group'?
From: Yves Forkl <Y.Forkl@xxxxxx>
Date: Thu, 01 Feb 2007 13:15:41 +0100
Re:  Wrap changing element sequence into container: wit
David Carlisle schrieb:

<xsl:apply-templates select="a"/>

         <container1>
           <xsl:copy-of select="b|c"/>
         </container1>

<xsl:apply-templates select="d|e|f"/>

         <container2>
           <xsl:copy-of select="g|h|i"/>
         </container2>

<xsl:apply-templates select="j"/>

it does not preserve the original order of the elements but
collects together all elements in each group. That isn't what i
understood you to want, but if that is what you want, you don't need any
grouping construct at all.

Running this against my sample input gives me the same results as with


<xsl:for-each-group select="*" group-adjacent="exists(self::b|self::c)">

as far as grouping the "b" and "c" elements is concerned: in the result, "c" follows "b", just as in the input.

Looking at the code, I assume what makes the difference is that without xsl:for-each-group, all "b" and "c" elements within their parent element would go into the same container1 instance instead of each "b"/"c" sequence receiving their own container. Am I right?

If so, it won't hurt me, as my "b" and "c" elements will always appear before any "d" element, therefore I think can do without xsl:for-each-group.

The lesson I learned: The hardest part with XSLT (2.0) is to find its easy solution to your complex problem. ;-)

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-2007 All Rights Reserved.