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

Re: Feedback on grouping solution

Subject: Re: Feedback on grouping solution
From: "Rick Quatro rick@xxxxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Sat, 26 Oct 2019 17:45:11 -0000
Re:  Feedback on grouping solution
Hi Martin,

That's an oversight on my part. Any elements outside of step elements have
to be processed individually. Can I change the for-each-group to just group
adjacent <step> elements? Thank you very much.

Rick

-----Original Message-----
From: Martin Honnen martin.honnen@xxxxxx
<xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Sent: Saturday, October 26, 2019 1:39 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re:  Feedback on grouping solution

On 26.10.2019 19:03, Rick Quatro rick@xxxxxxxxxxxxxx wrote:

> I need to process the <step> child elements so that the <figure>
> elements are always on the "right" (even-numbered position) in the
> output. Immediate children of the <procedure> do not factor into the
> odd/even sequence.
>
> The first child of each group of adjacent <step> elements starts a new
> odd/even series. To ensure that the each <figure> is in an
> even-numbered position, I want to insert a <spacer> element where it is
required.
>

> Here is my stylesheet. My basic question is: is there a better or more
> efficient way to do this? I really want to master grouping because it
> comes up in a lot of my tasks. Thank you for any input or criticism.
>
> <?xml version="1.0" encoding="UTF-8"?>
>
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>
>      xmlns:xs="http://www.w3.org/2001/XMLSchema"
> exclude-result-prefixes="xs" version="2.0">
>
>      <xsl:output indent="yes"/>
>
>      <xsl:template match="/procedure">
>
>          <procedure>
>
>              <!-- Group the children of the procedure, keeping
> adjacent steps together. -->
>
>              <xsl:for-each-group select="child::*"
> group-adjacent="local-name(.)">
>
>                  <xsl:choose>
>
>                      <xsl:when
> test="current-group()[1][not(self::step)]">
>
>                          <!-- Single element. -->
>
>                          <xsl:apply-templates
> select="current-group()[1]"/>

I don't understand this part, what is supposed to happen with two (or
more) adjacent <note/><note/> or other non step elements? Do you want to
drop any but the first of them?

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.