xsl-list
[Top] [All Lists]

[xsl] Transform inline-block type elements to block-level elements

2006-11-24 14:02:35
(alternate subject: "Converting XHTML2 <p>- to XHTML1 <p>-content model")

The task is to break logically structured paragraphs with inline-block-
type elements into layout-oriented paragraphs (blocks).

Suppose I have a document with a <p> element (similar to what XHTML2
allows) as follows:

<?xml version="1.0" encoding="UTF-8"?>
<root>
    <p>one
      <em>two
        <ul>
            <li>three</li>
            <li><strong>four<code>
                <ul>
                    <li>five</li>
                </ul>
                six</code></strong></li>
        </ul>
      </em>
    </p>
</root>


then the desired result (similar to XHTML1) would be:

<?xml version="1.0" encoding="UTF-8"?>
<root>  
    <p>one<em>two</em></p>
    <ul>
        <li>
            <p><em>three</em></p>
        </li>
        <li>
            <p><em><strong>four</strong></em></p>
            <ul>
                <li><p><em><strong><code>five</code></strong></em></p></li>
            </ul>
            <p><em><strong><code>six</code></strong></em></p>
        </li>
    </ul>  
</root>

I've thought already about things like storing the nesting of (real)
inlines in a tunneled sequence of element names to be rolled out just
after writing the last block-level (<p>) element, or assigning block-
nesting level values to the inline-block elements in a first step, then
try to create the structure by grouping on levels in a second one, but I
still do not manage to put the pieces together in a usable way.


-Christian


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