On 17.11.2017 18:43, rus tle profrustyleafiii(_at_)yahoo(_dot_)co(_dot_)uk
wrote:
I am trying to remove attribute values in a list based on a frequency
parameter.
Is this possible in XSLT 2? I cannot see how to tackle
the problem without being able to store the last attribute value
added to the result tree so that I can compare against it for the
following attribute values? I am told that there is no way to query the
result tree and so I am at a loss as to whether XSLT can actually do
what I require?
To illustrate, please see the example below.
The frequency parameter is 30. I would like to remove all values that
are "within 30" of the last value used. If the first value is 0 then I
would like to remove all the following attribute values that are less
than 30 plus the last value added to the result tree (in this case 0).
Such a condition can be easier formulated in XQuery 3 with a window
clause https://www.w3.org/TR/xquery/#id-tumbling-windows
for tumbling window $w in p/Content
start $s when true()
end next $n when xs:decimal($n/@value) - xs:decimal($s/@value) ge 30
return ($w[1], subsequence($w, 2)/<Content value=""/>)
I think than in XSLT with group-adjacent.
As most people use XSLT 2 with Saxon 9 and Saxon also implements XQuery
that might be an option that I think is worth mentioning.
In XSLT 3 you could even call directly into an XQuery module using above
window clause if needed with
https://www.w3.org/TR/xpath-functions/#func-load-xquery-module.
--~----------------------------------------------------------------
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
--~--