[Home] [By Thread] [By Date] [Recent Entries]

Subject: Re: Optional wrapper in generalized for-each-group
From: "Martin Honnen martin.honnen@xxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Sat, 26 Sep 2026 20:01:22 -0000
On 26/09/2026 21:43, rick@xxxxxxxxxxxxxx wrote:
However, I need content under a title to be wrapped in a conbody
element, like this:


I think you get that with the following adaption of the grouping function


B B <xsl:function name="cp:group" as="node()*"> B B B B <xsl:param name="elements" as="element()*"/> B B B B <xsl:param name="level" as="xs:integer"/> B B B B <!-- Make a variable for the heading name. --> B B B B <xsl:variable name="heading" select="'h' || $level"/> B B B B <xsl:variable name="heading-next" select="'h' || $level + 1"/> B B B B <xsl:for-each-group select="$elements" group-starting-with="*[local-name() = $heading]"> B B B B B B <xsl:choose> B B B B B B B B <xsl:when test="self::*[local-name() = $heading]"> B B B B B B B B B B <concept id="{generate-id()}"> B B B B B B B B B B B B <title> B B B B B B B B B B B B B B <xsl:apply-templates/> B B B B B B B B B B B B </title> B B B B B B B B B B B B <xsl:sequence select="cp:group(current-group() except ., $level + 1)"/> B B B B B B B B B B </concept> B B B B B B B B </xsl:when> B B B B B B B B <xsl:otherwise> B B B B B B B B B <xsl:where-populated> B B B B B B B B B B <conbody> B B B B B B B B B B B <xsl:apply-templates select="current-group()"/> B B B B B B B B B B </conbody> B B B B B B B B B </xsl:where-populated> B B B B B B B B </xsl:otherwise> B B B B B B </xsl:choose> B B B B </xsl:for-each-group> B B </xsl:function>

Current Thread
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member