Subject: Re: [xsl] Find the number of elements that are prior to the series of elements that match a string?|
From: "Martin Honnen martin.honnen@xxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Tue, 12 Mar 2019 19:53:22 -0000
I have an XML document containing a long list of Byte elements, e.g.,
I have a string of hex values, e.g.,
You can see that the string is contained within this series of Byte elements:
What is an efficient way to solve this problem?
let $req := '04000000FF' let $len := string-length($req) return head( for sliding window $w in /Bytes/Byte start $b1 at $s when $b1 = substring($req, 1, 2) end at $e when $e - $s + 1 = $len idiv 2 where string-join($w) eq $req return $s - 1 )