Solved

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

Posted on 2006-06-29
7
263 Views
Last Modified: 2006-11-18
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
0
Comment
Question by:dfu23
  • 3
7 Comments
 
LVL 60

Expert Comment

by:Geert Bormans
ID: 17016070
Hi dfu23,

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

Cheers!
0
 
LVL 22

Expert Comment

by:_TAD_
ID: 17018649


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


0
 
LVL 22

Expert Comment

by:_TAD_
ID: 17018683


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
0
 
LVL 14

Author Comment

by:dfu23
ID: 17077139
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?
0
 
LVL 22

Accepted Solution

by:
_TAD_ earned 250 total points
ID: 17080879
Here.... This does what you need.  






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

<Table>
   <TR>
     <TD Width=500>   <!-- This number changes the relative spacing -->
        <OL>
           <LI class="LEFT">some Text</LI>
           <LI class="center">other Text</LI>
           <LI class="RIGHT">more text</LI>
        </OL>
     </TD>
   </TR>
</Table>
</BODY>
</HTML>
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Introduction In my previous article (http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/SSIS/A_9150-Loading-XML-Using-SSIS.html) I showed you how the XML Source component can be used to load XML files into a SQL Server database, us…
The Confluence of Individual Knowledge and the Collective Intelligence At this writing (summer 2013) the term API (http://dictionary.reference.com/browse/API?s=t) has made its way into the popular lexicon of the English language.  A few years ago, …
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now