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

Re: Grouping by character runs (and keeping element s

Subject: Re: Grouping by character runs (and keeping element structure)
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Mon, 31 Jul 2006 14:33:26 -0400
character run
Christian,

At 06:34 AM 7/27/2006, you wrote:
Continuing my grouping issues:

XSLT2 handles grouping on a node level quite conveniently. However,
adding structure to legacy, rather flat content (i.e.: character runs)
still poses challenges in grouping....

[Fabulous examples snipped, until]


A worst-case scenario of course would be:

__ EXAMPLE 3 __

<p><ul><b>Note</b> <i>#4</i>: Don't tumble dry your pet</ul>.</p>

TASK:
Group the leading paragraph text "Note #4:" including any contained
markup using <marker> to a child of <p> so that the result looks like:

<p><marker><ul><b>Note</b> <i>#4</i>:</ul></marker>
   <ul>Don't tumble dry your pet</ul>.</p>

SOLUTION:
Same problems as in EXAMPLE 2, but additionally note that the <ul>
element must be split/duplicated so that <marker> can be a child of <p>,
yet retains the full formatting info in form of the contained element
structure.

Is there a certain pattern on how to tackle these kind of problems in
XSLT, or is the language just not the tool of choice for this kind of
transformation?

My preference would be to go all the way up before going down again. Thus my first transform would target the arrangement


<note no="4">Don't tumble-dry your pet.</note>

... from which any of your targets could be created.

This may not always be possible; but my guess is that where it isn't, you already have more serious problems.

Cheers,
Wendell

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.