On 19.11.2017 14:38, rus tle profrustyleafiii(_at_)yahoo(_dot_)co(_dot_)uk
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 it’s 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=“30">
2. <Contentvalue="0”/>
3. </p>
4. <pfrequency=“30">
5. <Contentvalue=”10”/>
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>
--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/1167547
or by email: xsl-list-unsub(_at_)lists(_dot_)mulberrytech(_dot_)com
--~--