RE: [xsl] flattening nested xml

Subject: RE: [xsl] flattening nested xml
From: "Stuart Celarier" <stuart@xxxxxxxxxxx>
Date: Thu, 16 May 2002 10:45:52 -0700
Andrew, use CSS styling as much as you can for the presentation layer,
let XSLT transform the structure and content. Here is an HTML document
which I think solves your ultimate problem, viz, to outdent (yes, that
is the typographic, as opposed to indent, but they are also called
'hanging paragraphs') the top level nesting and have block paragraphs
for any nested paragraphs.

    <title>Andrew Welsh Is Stylin' Now</title>
    <style type="text/css">
      div { margin: 1em 0em; text-indent: 0em }
      div.outer { text-indent: -5em ; margin-left: 5em }
      div.outer:first-line { font-weight: bold }
    <div class="outer">
Ok, so far so good.  But if the data wraps, it will wrap beneath the
number and not indented where it should, so I contain the whole lot in a
div indented by 5em.  Of course, this simply shifts the whole lot to the
right by 5em, but if I include a text-indent of -5em it produces the
required output by reverse-indenting(?:) only the top line by -5em,
giving the impression of a neatly tabbed list.
      <div class="inner">
Great.  But this has brought with it problems.  If the para's contain
any block elements in them it treats the next line as a first line and
indents that by -5em.  Also, it affects the widths of divs if they are
effectively the 'first line' (and caused numerous other issues other
markup, but were all solvable).

This outdents the div.outer paragraphs, and lines up the nested
paragraphs with the main block of the outer paragraphs. I also used the
pseudo-selector 'first-line' to illustrate its application, just for
kicks. Is that what you are looking for?


 XSL-List info and archive:

Current Thread