I have no idea. I can't even see why it works the way you say it does. As far as I can see, the first thing that should happen is that the
pattern "u//text()" matches a text node, and you produce a <RICHTEXT UNDERLINE="true"> element containing that text. From there on the xsl:apply-templates shouldn't match anything, because the text node doesn't have any children to apply to.
Edit: You said "If the source html contains <u><strong><em> tag..." and I took that to mean exactly what it said. That is, I took it to mean that you didn't mention the end tags and you had something like <u><strong><em>some text</em></strong></u>. But it's possible that you were really talking about
elements and just using sloppy terminology calling them tags. In that case you would have something like <u>some text</u><strong>some text</strong><em>some text</em>. In which case your templates make a bit more sense.
Okay. Let's go with the misleading terminology idea. All your templates say is "When you see a <u> element do this" and so on. So there aren't any instances when two of those templates will match a single text node, so what I said in my first reply is irrelevant.
The first template (span//text()) does nothing except to prevent span elements from producing anything in the output. Calling xsl:apply-templates in it does nothing because the text node it selects can't have any children.
So I don't see where the other templates are being called from. Possibly they are being called via the build-in processing rules.
[ April 20, 2007: Message edited by: Paul Clapham ]