Re: [xsl] replace() and efficiency: troff-to-unicode conversion

Subject: Re: [xsl] replace() and efficiency: troff-to-unicode conversion
From: David Carlisle <davidc@xxxxxxxxx>
Date: Wed, 13 Sep 2006 00:05:42 +0100
>  If I understood correctly, your suggestion was along the 
> lines of:

yes although I misread your regex the first time,and in my first reply
everything is double quoted \\\\ instead of \\ It think th esecond
version (using a key) actually works ad advertised if you just slightly
fix the regex from

regex=".|\\\*?\(..|\\\*\(K\\\(wi">
to

regex="[a-zA-Z&amp;&quot;~]|\\\*?\(..|\\\*\(K\\\(wi">

> There are two matches here: \(?s and \(?c . When my <xsl:choose> finds 
> the first match (it's the first <xsl:when> within the <xsl:choose>), 
> doesn't it just replace all instances of \(?s and then not read the rest 
> of the <xsl:when> lines? That is, won't it fail to find the subsequent 
> \(?c ?

No each xsl:choose only executes one xsl:when but it will be called
multiple times. the string is first split up into a sequence of
substrings that match or dont and then xsl:analyze-string iterates along
that list much liek xsl:for-each with . beimg the matching (or not)
substring at each iteration, and the matching or non matching part being
taken at each step.

run the code i posted (or as ammended above) and you'll see what I
mean...
David

Current Thread