xsl-list
[Top] [All Lists]

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

2006-09-12 16:13:58

<xsl:template match="text()">
 <xsl:analyze-string select="." regex="\\\\\\(\\\?([a-z])"
   <xsl:matching-substring>
     <xsl:choose>
       <xsl:when test="regex-group(1)='s'">...
       <xsl:when test="regex-group(1)='c'">...

What I don't understand is what an XSLT 2 processor does when 
I pass it a text node like:

abab\(?sabab\(?cabab

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 ?

The xsl:matching-substring instruction is executed once for each match. So
it's executed once to process \(?s, and once to process \(?c. In the first
case, the first xsl:when fires. In the second case, the second xsl:when
fires.

Michael Kay
http://www.saxonica.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>
--~--

<Prev in Thread] Current Thread [Next in Thread>