Link to home
Start Free TrialLog in
Avatar of dfu23
dfu23

asked on

Is there a simple way to justify a list-item (both the list-item-label and list-item-body) with XSL?

In a web application, a user is allowed to use a Word-like text editor to write portions of a document.  The HTML output of this editor is rendered into a PDF using XSL.  There is a requirement to allow arbitrary horizontal alignment (left/start, center, and right/end) at the line item level (that is, not simply at the list level) for bulleted or numbered lists.  Here are a few examples of possible "valid" (but naturally in poor design taste) lists.  Note that each set of three items represents a completely different list.

1. item
2. item
3. item
                              * item
                              * item
                              * item
                                                            1. item
                                                            2. item
                                                            3. item
1. item
                              2. item
                                                            3. item
                                                            * item
                              * item
* item
etc.

However, when we attempt to format the HTML, the best we can get is something like:
1. item
2.                              item
3.                                                            item
Avatar of Gertone (Geert Bormans)
Gertone (Geert Bormans)
Flag of Belgium image

Hi dfu23,

can you not just left allign the items in lists using CSS?

Cheers!
Avatar of _TAD_
_TAD_



When you generate your HTML, use an in-line style sheet

<HTML>
<HEAD>
<STYLE TYPE="text/css">
  LI { font-size: large; color: black }
  LI.LEFT { font-size: large; text-align: left;  color: black; }
  LI.RIGHT { font-size: large; text-align: right;  color: black; }
  LI.CENTER { font-size: large; text-align: center;  color: black; }
</STYLE>
<HEAD>

<BODY>

<OL>
  <LI class="LEFT">some Text</LI>
  <LI class="RIGHT">more text</LI>
</OL>

</BODY>
</HTML>


This will produce:
 
   1. some text
   2.              more text




You may also be interested in the list-style-position, margin-left, text-indent or padding-left

Here's  site to help you decide which style is best for you.
http://www.zvon.org/xxl/css1Reference/Output/index.html
Avatar of dfu23

ASKER

TAD,

If you look at my original question again, we are able to get the lists formatted as you describe.  However, we want the bullet/number to match the alignment of the text itself.  That is, either both are to the left, centered, or to the right.  Having the text to the left, centered, or to the right while the bullet/number is always to the left is not what we're looking for.

Any other ideas?
ASKER CERTIFIED SOLUTION
Avatar of _TAD_
_TAD_

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial