xsl-list
[Top] [All Lists]

[xsl] text replacement with mixed content

2011-08-30 14:36:18
Hi all,

thanks for reading this.

I have an interesting task.

All through a document I need to replace each occurrence of "my foo" with "<replaced>your bar</replaced>" But the texts contain mixed content tags, so I might as well find "my <bold>foo</bold>" that needs to become "<replaced>your bar</replaced>" as well

Note that the I need to keep the tags balanced, so I must not end up with "<replaced>your bar</replaced></bold>" in the later case

I have some algorithms in mind, but I am not happy with any of them.
So I thought I might as well ask here, hoping one of you can come up with something really elegant

the replacement tags are pulled out of another document,
so as a bonus, the text to be replaced could be "my.foo", requiring me likely to build correct regexes automatically

so, thanks in advance for your help

Geert

--~------------------------------------------------------------------
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>
--~--