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

Re: XSLT splitting (grouping?) hierarchical structure

Subject: Re: XSLT splitting (grouping?) hierarchical structure
From: "Martin Honnen martin.honnen@xxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 10 Feb 2022 08:57:34 -0000
Re:  XSLT splitting (grouping?) hierarchical structure
Am 10.02.2022 um 09:54 schrieb Martin Honnen martin.honnen@xxxxxx:

Am 10.02.2022 um 09:40 schrieb Imsieke, Gerrit, le-tex gerrit.imsieke@xxxxxxxxx:
Hi Matthieu,

At XML Prague 2019, I presented what I call the "upward projection
method" [1, 2]. It turned out that Wendell Piez had independently
developed his own upward projection approach [3, 4]. Both methods
group the leaf nodes, starting at the splitting points.

Gerrit

[1]

https://archive.xmlprague.cz/2019/files/xmlprague-2019-proceedings.pdf#page=3
47

[2]


https://subversion.le-tex.de/common/presentations/2019-02-09_xmlprague_xslt-u
pward-projection/slides/index.html



I think Gerrit's approach will help you although I think your set of
restricted-to nodes will be adapted slightly, instead of

B B current-group()/ancestor-or-self::node()

it seems you want to carry over the section/title from each section.


So somehow like this:


B <xsl:mode name="split" on-no-match="shallow-copy"/>


B  <xsl:template match="node()" mode="split">
B B B  <xsl:param name="nodes" tunnel="yes"/>
B B B  <xsl:if test=". intersect $nodes/ancestor-or-self::node()">
B B B B B  <xsl:next-match/>
B B B  </xsl:if>
B  </xsl:template>

B  <xsl:template match="section">
B B B  <xsl:variable name="section" select="."/>
B B B  <xsl:for-each-group select=".//node()" group-ending-with="split">
B B B B B  <section>
B B B B B B B  <xsl:apply-templates select="$section/node()" mode="split">
B B B B B B B B B  <xsl:with-param name="nodes"
select="current-group()[not(self::split)] |
$section/title/descendant-or-self::node()" tunnel="yes"/>
B B B B B B B  </xsl:apply-templates>
B B B B B  </section>
B B B B B  <xsl:copy-of select="current-group()[last()][self::split]"/>
B B B  </xsl:for-each-group>
B  </xsl:template>

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.