xsl-list
[Top] [All Lists]

[xsl] Re: Getting the offset of a matching-substring in <xsl:analyze-string>

2012-03-16 15:57:41
That's what I did in the end. It would be nice not to have to, though.

Cheers,
Martin

On 12-03-15 05:49 PM, Imsieke, Gerrit, le-tex wrote:
I think you need a second pass to calculate the offsets.

On 2012-03-16 01:00, Martin Holmes wrote:
Hi there,

I'm doing some automated markup using <xsl:analyze-string>, and as part
of the output I'd like to record the offset and length of each matched
substring. So given input like this in a text node (simplified example):

This is a test.

and a match like this:

<xsl:analyze-string select="$input" regex="{'[a-zA-Z]+'}">

<xsl:matching-substring>

<w offset="???" length="{string-length(.)}">

<xsl:value-of select="."/>

</w>

<xsl>matching-substring>

</xsl:analyze-string>

I'm wondering if there's any way I can calculate the offset value (which
for "This" would be 1, for "is" would be 6, etc.).

Does anyone know if there's a way to do this?

All help appreciated,
Martin

--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--





--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--