Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


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

From: Yves Forkl <Y.Forkl@------>
To:
Date: 2/1/2007 12:16:00 PM
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


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent