[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

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


Subject: Re: [xsl] Flat to Structured: Handling List Items with Subordinate Paragraphs
From: Eliot Kimber <ekimber@xxxxxxxxxxxx>
Date: Tue, 26 May 2009 15:51:19 -0500

On 5/26/09 3:38 PM, "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx> wrote:

> At 2009-05-26 15:31 -0500, Eliot Kimber wrote:
>> On 5/26/09 3:04 PM, "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx> wrote:
>> 
>>>> Can anyone point me in the right direction?
>>> 
>>> Consider the solution below.  I'm making assumptions like a container
>>> is defined by adjacent elements with @container, and that the
>>> container type is homogenous (so I only need to look at the first),
>>> and that list items are always of type 'li'.  It gives what you are
>>> asking for, but you may need to modify it based on a more precise
>>> definition of containers.
>> 
>> Hmmm--took me a minute to see the boolean(@container) in this line:
>> 
>> <xsl:for-each-group select="*" group-adjacent="boolean(@container)">
>> 
>> So that has the effect of creating a group for each continguous sequence of
>> contained things,
> 
> Indeed.  In my class I have an explicit example of this because some
> students have the preconceived notion that the adjacent values are
> somehow obliged to be user data, when in fact the adjacent values can
> be any calculated value.

I don't think it's quite as easy as my sample data suggested.

Once I have a group of contained things, there's no guarantee that the
first-level containers are homogenous.

For example, I could have an ordered list followed by an unordered list,
which would give a group like:

<p type="li" container="ol" level="1">
<p type="p" container="li" level="2">
<p type="li" container="ol" level="1">
<p type="p" container="li" level="2">
<p type="li" container="ul" level="1">
<p type="p" container="li" level="2">

Where the result should be:

<ol>
  <li>
    <p>
  </li>
  <li>
    <p>
  <li>
</ol>
<ul>
  <li>
   <p>
  <li>
</ul>

I don't see a way to get that result using group-starting-with on the group
members.

But I think that sibling recursion might be more tractable on the group
members since I don't have to worry about excluding elements that don't have
a container at all.

Cheers,

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