[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] analyze-string question

Subject: Re: [xsl] analyze-string question
From: Michael Kay <mike@xxxxxxxxxxxx>
Date: Fri, 26 Oct 2012 08:12:24 +0100

I can't really help you with designing an algorithm for the problem, but perhaps we can help with the part of the question that relates to XSLT coding:

>If I do <xsl:analyze-string> on the entire preceding value (the output of a first pass), won't it atomize it (after all, what it's analyzing is a string), wiping out the internal markup? And if I try to apply <xsl:analyze-string> to the individual text nodes, the "<" and ">" aren't in the same text node. I realize that this may be simpler than it appears to me, and perhaps even much simpler, but at the moment I'm having trouble even conceptualizing the problem in a way that suggests a solution. I'd be grateful for a gentle (or even not-so-gentle) nudge in the right direction.

Generally there are two approaches to this. One is to convert the markup to text, then use analyze-string on the text, and then convert the text back to markup. The other is to convert the interesting bits of text to markup, and then use facilities like for-each-group on the markup, before converting back to text. Neither is particularly straightforward...

Michael Kay

Current Thread