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

Re: Re: Adjacent grouping?

Subject: Re: Re: Adjacent grouping?
From: "Martin Honnen martin.honnen@xxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Sun, 19 Nov 2017 14:00:39 -0000
Re:  Re: Adjacent grouping?
On 19.11.2017 14:38, rus tle profrustyleafiii@xxxxxxxxxxx wrote:
Hi Michael,

I have actually hit a further snag with this solution.

It appears to work well when all the content nodes have the same parent node as in the original question. However, on coming to apply this solution to my real world scenario each content node is actually a child of itbs own p node. I have tried - but I cannot work out how to tweak your solution to adjust to this new revelation. Any thoughts?

The new xml:

 1. <pfrequency=b30">
 2. <Contentvalue="0b/>
 3. </p>
 4. <pfrequency=b30">
 5. <Contentvalue=b10b/>
 6. </p>

You could adjust the iteration and the value selection with e.g.


<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:math="http://www.w3.org/2005/xpath-functions/math"
exclude-result-prefixes="xs math"
version="3.0">

<xsl:strip-space elements="*"/>
<xsl:output indent="yes"/>

<xsl:template match="root">
<xsl:copy>
<xsl:iterate select="p">
<xsl:param name="previous" as="xs:integer?" select="()"/>
<xsl:choose>
<xsl:when test="empty($previous) or xs:integer(Content/@value) gt $previous+30">
<xsl:copy-of select="."/>
<xsl:next-iteration>
<xsl:with-param name="previous" select="Content/@value"/>
</xsl:next-iteration>
</xsl:when>
<xsl:otherwise>
<xsl:copy>
<xsl:copy-of select="@*"/>
<Content value=""/>
</xsl:copy>
</xsl:otherwise>
</xsl:choose>
</xsl:iterate>
</xsl:copy>
</xsl:template>

</xsl:stylesheet>


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.