[xsl] Flat to Structured: Handling List Items with Subordinate Paragraphs

Subject: [xsl] Flat to Structured: Handling List Items with Subordinate Paragraphs
From: Eliot Kimber <ekimber@xxxxxxxxxxxx>
Date: Tue, 26 May 2009 14:47:06 -0500
I'm back in WordML-to-XML land and I've run up against the problem of how to
map sequences of paragraphs that represent, for example, a sequence of list
items with logically subordinate list items, for example, I might have a
sequence of input elements like this:

<p type="para" level="1">Para 1</p>
<p container="ol" type="li" level="1">ol item 1</p>
<p container="li" type="para" level="2">Para w/in li</para>
<p container="ol" type="li" level="1">ol item 2</p>
<p container="li" type="para" level="2">Para w/in li</para>
<p type="para" level="1">Para 2</p>

Where the desired result is:

<para>Para 1</para>
<ol>
  <li>ol item 1
    <para>Para w/in li</para>
  </li>
  <li>ol item 2
    <para>Para w/in li</para>
  </li>
</ol>
<para>Para 2</para>

I've reviewed various discussions of sibling recursion, which I'm pretty
sure is what I need to apply to this problem.

But I'm having a very hard time wrapping my head around it--I suspect
procedural brain damage.

What I'm not seeing is how, through sibling recursion, I can start a result
wrapper and then end it. Likewise, doing something like for-each-group on
all the level-1 elements would provide no way to group the list items under
a common container.

I suspect there's some simple thing I'm missing here or some clever
recursion/grouping technique that escapes me.

Can anyone point me in the right direction?

Thanks,

Eliot
----
Eliot Kimber | Senior Solutions Architect | Really Strategies, Inc.
email:  ekimber@xxxxxxxxxxxx <mailto:ekimber@xxxxxxxxxxxx>
office: 610.631.6770 | cell: 512.554.9368
2570 Boulevard of the Generals | Suite 213 | Audubon, PA 19403
www.reallysi.com <http://www.reallysi.com>  | http://blog.reallysi.com
<http://blog.reallysi.com> | www.rsuitecms.com <http://www.rsuitecms.com> 

Current Thread