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

Re: Converting Mixed Content Into Unmixed Content

Subject: Re: Converting Mixed Content Into Unmixed Content
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Tue, 27 Nov 2007 09:46:59 -0500
Re:  Converting Mixed Content Into Unmixed Content
Alan,

Yes, this is a familiar problem, and no, there isn't an obvious answer. "Element splitting" would probably be the closest thing to a normative way of describing it. It's difficult because it's a variety of upconversion, introducing structure that is only implicit in the source data.

The best approach is an XSLT 2.0 approach: you have to treat it as a grouping problem -- use group-adjacent with a boolean grouping key (either a node is, or is not, an element you wish to split on).

In XSLT 1.0, most experts would probably approach this with a node-by-node walk across the set of elements to be split. Modes are involved. In my code I have called this a "step and tuck" approach since with each subsequent following sibling, you either tuck it into the element you are building (the new 'p' in your case), or you don't (in your case, turning aside to create a 'ul'). In the latter case, you then have to restart the stepping on the other side.

So, can you use XSLT 2.0? (Please say yes: your maintainer will thank you.)

Cheers,
Wendell

At 09:14 AM 11/27/2007, you wrote:
From this document....

<p>This is some text.  <ul><li>List item.</li></ul> <strong>This is
strong text.</strong> Also, normal text.</p>

I want to create

<p>This is some text.</p>
<ul><li>List item.</li></ul>
<p><strong>This is strong text.</strong> Also, normal text.</p>

Before I set out to solve this, I want to make sure that there is not
some obvious answer. I am pretty sure that I've seen this problem
numerous times when in the past I've followed this list. I'm unable
to think of the right terms to search for, so some suggestions on
search terms are all I really need.

--
Alan Gutierrez | alan@xxxxxxxxxxxxxx | http://blogometer.com/ | 504
717 1428
Think New Orleans | http://thinknola.com/





====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx Mulberry Technologies, Inc. http://www.mulberrytech.com 17 West Jefferson Street Direct Phone: 301/315-9635 Suite 207 Phone: 301/315-9631 Rockville, MD 20850 Fax: 301/315-8285 ---------------------------------------------------------------------- Mulberry Technologies: A Consultancy Specializing in SGML and XML ======================================================================

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.