This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: flattening nested xml


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.


<html>
  <head>
    <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 }
    </style>
  </head>
  <body>
    <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).
      </div>
    </div>
  </body>
</html>


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?

Cheers,
Stuart



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]