[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: text replacement with mixed content

Subject: Re: text replacement with mixed content
From: Geert Bormans <geert@xxxxxxxxxxxxxxxxxxx>
Date: Wed, 31 Aug 2011 15:58:39 +0200
Re:  text replacement with mixed content
Let me summarize some rules for markup, to show I am not throwing away all markup (but indeed throw away some of it)

There is a pattern A that needs to be replaced with a replacement B
Pattern A is described in a string value that triggers replacement but interfering markup can break the pure string in the actual document.
A and B can contain multiple words
A can contain markup, B is purely text
B will be wrapped in an element to indicate it is a replacement(revision)
markup that ends in A but did start before A (with the exception of markup that started right before A) will be forced to close prior to A's replacement
eg.
<p><b>here is some bolded text that my </b> foo</p>
will become
given that "my foo" needs to become "your bar"
<p><b>here is some bolded text that </b><rev>your bar</rev></p>


but
<p>here is some bolded text that <b>my </b> foo</p>
will become
<p>here is some bolded text that <rev>your bar</rev></p>

this is all about revisions, and the tricky part is to maintain or not maintain earlier revisions

markup that starts and ends in A can be dropped
markup that starts in A and ends outside A (with the exception of markup ending right after closing A) must be forced to reopen
there is a predictable boundary (p in this example) an A should not cross that boundary
markup in A does not break words
soft hyphens and non breaking spaces (indicated by '-' in the example) can break "words"


hope this helps, pretty confident that the example covers most of this and the result is what I need

Ok I've not totally convinced by that expected output, if you are
dropping that level of markup (such as the <j>) then you are heading
towards just stripping all the markup...

If possible do some actual real world example, with solid expected
results.  When the task is "non-trivial" like this one, you really
don't want mistakes in the expected results.


-- Andrew Welch http://andrewjwelch.com

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.