On 11/05/2010 21:19, Terry Ofner wrote:
Thank you David. The template works perfectly. I only needed to add one ] near
the end of the match line.
The take-away message for me: when one wants to apply-templates with regular
expressions,
use replace() instead of analyze-string. Is that an accurate summary of the
approach?
Not really, the main point is to apply the regexp (whether replace or
analyze-string to the text nodes rather than to the entire element or
mixed content.
You need to use analyze-string rather than replace if you need to
generate element nodes as part of the replacement text as replace() is a
atring-to-string function.
In this case as you were just extracting the initial digit sequence and
dropping it in an element I could use replace (at the cost of having to
apply the regexp twice once to extract the first bit and again to
extract the second.) If the regexp were more complicated an alternative
would have been to use analyze-string to split up the text node and to
return a sequence and then to pass that sequence to subsequent teplates.
David
--~------------------------------------------------------------------
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>
--~--