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

Re: Find the number of elements that are prior to the

Subject: Re: Find the number of elements that are prior to the seriesof elements that match a string?
From: "Martin Honnen martin.honnen@xxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Tue, 12 Mar 2019 19:55:07 -0000
Re:  Find the number of elements that are prior to the
On 12.03.2019 20:21, Eliot Kimber ekimber@xxxxxxxxxxxx wrote:
I was thinking of doing something with looking up the individual byte() elements using key() on the string values but I couldn't think of an elegant way to split the input string into two-character chunks.

Interesting, why do you need the string splitting for the key? Wouldn't

<xsl:param name="input" as="xs:string">04000000FF</xsl:param>
<xsl:variable name="len" as="xs:integer" select="string-length($input) idiv 2"/>

<xsl:key name="window" match="Bytes/Byte" use="string-join((., following-sibling::Byte[position() lt $len]))"/>

<xsl:template match="/">
<xsl:value-of select="count(key('window', $input)[1]/preceding-sibling::Byte)"/>


Current Thread


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.
First Name
Last Name
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.