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

Re: Grouping question

Subject: Re: Grouping question
From: Martin Honnen <Martin.Honnen@xxxxxx>
Date: Thu, 14 May 2009 14:46:07 +0200
Re:  Grouping question
M Balaji wrote:

Grouping is working properly. But "h4" is appear the child of "h2".
"h4" is grouped under the frist sibling of "h2". Please refer the
below output, frist "h4" element is surronded by "p" tag.  How do I
solve this?

Here is an improved version of the function:

<xsl:function name="mf:group-heading" as="element()*">
<xsl:param name="els" as="element()*"/>
<xsl:param name="level" as="xsd:integer"/>
<xsl:for-each-group select="$els" group-starting-with="*[local-name() eq concat('h', $level)]">
<xsl:when test="local-name() eq concat('h', $level)">
<xsl:element name="{local-name()}">
<xsl:sequence select="mf:group-heading(current-group() except ., $level + 1)"/>
<xsl:when test="$level lt 6">
<xsl:sequence select="mf:group-heading(current-group(), $level + 1)"/>
<xsl:copy-of select="current-group()"/>

The former version did not properly handle the case when group-starting-with did not find a h[n] element.


	Martin Honnen

Current Thread


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.
First Name
Last Name
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.