xsl-list
[Top] [All Lists]

Re: [xsl] text replacement with mixed content

2011-08-31 09:24:26
Ok what you've done there is written a load of words... 5 people
writing test cases from that could have 5 different interpretations.
For example this just sounds like a riddle:

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

What's needed is an unamibiguous set of input and output combinations
of just xml, one for each variation of markup, with a short
description if its not obvious.  That does 2 things - its explains the
problem to other people in the best way, and provided all the tests
cover all the areas, you know you are done when all the tests pass.



On 31 August 2011 14:58, Geert Bormans 
<geert(_at_)gbormans(_dot_)telenet(_dot_)be> wrote:
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

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


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





-- 
Andrew Welch
http://andrewjwelch.com

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

<Prev in Thread] Current Thread [Next in Thread>